Replace <li> in page lists with semantic HTML <article>

This commit is contained in:
BBaoVanC 2022-05-21 23:20:22 -05:00
parent 73dc916d5a
commit a65a435b1d
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
9 changed files with 122 additions and 116 deletions

View File

@ -123,8 +123,8 @@
gap: 40px;
}
.page-list ul,
.series-taxonomy ul {
.page-list,
.series-taxonomy-list {
display: flex;
flex-direction: column;
list-style: none;
@ -132,12 +132,13 @@
gap: 40px;
}
.series-taxonomy ul {
.series-taxonomy-list {
gap: 80px;
}
.page-list li,
.series-taxonomy li {
.page-list .post,
.series-taxonomy-list .series-taxonomy,
.series-taxonomy .post {
padding-top: 8px;
padding-left: 24px;
padding-right: 24px;
@ -206,7 +207,7 @@
margin: 0;
}
.taxonomy-list ul {
.taxonomy-list {
list-style: none;
padding: 0;
display: flex;
@ -214,7 +215,7 @@
gap: 10px;
}
.taxonomy-list li {
.taxonomy-list .taxonomy-term {
background-color: var(--background-1);
color: var(--text-1);
padding: 8px 12px;
@ -230,7 +231,7 @@
}
@media (max-width: 480px) {
.taxonomy-list li {
.taxonomy-list .taxonomy-term {
flex-direction: column;
gap: 4px;
}
@ -244,7 +245,7 @@
/* Series list format */
.series-pages ul {
.series-page-list {
display: flex;
gap: 10px;
flex-flow: row wrap;
@ -255,7 +256,7 @@
border-radius: 16px;
}
.series-pages li {
.series-page-list .post {
flex: 1;
min-width: 49%;
}
@ -304,8 +305,13 @@
/* Header formatting (website title and article section headers) */
h1.header {
.header {
margin: 16px 0;
}
.header h1 {
font-size: 1.5em;
font-weight: bold;
}
.header a,
@ -347,6 +353,7 @@ h1.header {
}
/* Related posts */
.full-width-page-list {
/* make left/right 0 margin so it takes up full width */
@ -359,16 +366,16 @@ h1.header {
margin-right: 20px;
}
.full-width-page-list li {
.full-width-page-list .post {
min-width: 300px;
max-width: 300px;
}
.full-width-page-list li:first-child {
.full-width-page-list .post:first-child {
margin-left: 20px;
}
.full-width-page-list li:last-child {
.full-width-page-list .post:last-child {
margin-right: 20px;
}
@ -393,7 +400,7 @@ h1.header {
}
}
.full-width-page-list .page-list ul {
.full-width-page-list .page-list {
display: flex;
flex-direction: row;
gap: 20px;
@ -401,6 +408,7 @@ h1.header {
}
/* Social media share buttons */
.share-buttons {
background: var(--background-1);
@ -439,6 +447,7 @@ h1.header {
*/
/* See also formating */
.see-also {
background-color: var(--background-1);
@ -453,6 +462,7 @@ h1.header {
}
/* Back to top */
#back-to-top {
position: fixed;

View File

@ -1,23 +1,21 @@
<div class="post">
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/short.html" . }}
{{ partial "post-metadata/short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}
<div class="post-description">
{{ partial "description-or-summary.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>

View File

@ -1,26 +1,24 @@
<div class="post">
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/series.html" . }}
{{ partial "post-metadata/series.html" . }}
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="series-pages">
<ul>
{{ $i := 0 }}
{{ $total := len .Data.Pages }}
{{ range .Data.Pages.Reverse }}
{{ $i = add 1 $i }}
{{ .Scratch.Set "series_position" $i }}
{{ .Scratch.Set "series_total" $total }}
<li>{{ .Render "summary/series_post" }}</li>
{{ end }}
</ul>
</div>
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="series-page-list">
{{ $i := 0 }}
{{ $total := len .Data.Pages }}
{{ range .Data.Pages.Reverse }}
{{ $i = add 1 $i }}
{{ .Scratch.Set "series_position" $i }}
{{ .Scratch.Set "series_total" $total }}
<article class="post">
{{ .Render "summary/series_post" }}
</article>
{{ end }}
</div>

View File

@ -1,29 +1,27 @@
<div class="post">
<div class="post-series-position">
{{ if .Scratch.Get "series_position" }}
({{ .Scratch.Get "series_position" }}/{{ .Scratch.Get "series_total" }})
{{ end }}
</div>
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" .) }}
</div>
<div class="post-series-position">
{{ if .Scratch.Get "series_position" }}
({{ .Scratch.Get "series_position" }}/{{ .Scratch.Get "series_total" }})
{{ end }}
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>
</div>
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>

View File

@ -6,11 +6,11 @@
<div class="page-list">
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/author" }}</li>
{{ end }}
</ul>
{{ range . }}
<article class="post">
{{ .Render "summary/author" }}
</article>
{{ end }}
{{ else }}
<div>
{{ i18n "no_posts" }}

View File

@ -1,10 +1,10 @@
<div class="page-list">
{{ with . }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ range . }}
<article class="post">
{{ .Render "summary/post" }}
</article>
{{ end }}
{{ else }}
<div>
{{ i18n "no_posts" }}

View File

@ -1,6 +1,10 @@
<h1 class="header">
<a href="{{ .Site.Home.Permalink | absLangURL }}">{{ .Site.Title | markdownify }}</a>
</h1>
<header class="header">
<h1>
<a href="{{ .Site.Home.Permalink | absLangURL }}">
{{ .Site.Title | markdownify }}
</a>
</h1>
</header>
<div class="topbar">
<nav class="navbar" aria-label="{{ i18n "aria_navbar" }}">

View File

@ -4,13 +4,13 @@
{{ .Title | markdownify }}
</h1>
<div class="series-taxonomy">
<div class="series-taxonomy-list">
{{ with .Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/series" }}</li>
{{ end }}
</ul>
{{ range . }}
<article class="series-taxonomy">
{{ .Render "summary/series" }}
</article>
{{ end }}
{{ else }}
<div>
{{ i18n "no_posts" }}

View File

@ -13,21 +13,19 @@
<div class="taxonomy-list">
{{ with .Data.Terms.Alphabetical }}
<ul>
{{ range . }}
{{ with .Page }}
<li>
<div class="taxonomy-list-left">
<a href="{{ .Permalink }}">
<p>{{ .Title | markdownify }}</p>
</a>
{{ partial "post-metadata/taxonomy.html" . }}
</div>
{{ partial "description-or-summary.html" . }}
</li>
{{ end }}
{{ range . }}
{{ with .Page }}
<article class="taxonomy-term">
<div class="taxonomy-list-left">
<a href="{{ .Permalink }}">
<p>{{ .Title | markdownify }}</p>
</a>
{{ partial "post-metadata/taxonomy.html" . }}
</div>
{{ partial "description-or-summary.html" . }}
</article>
{{ end }}
</ul>
{{ end }}
{{ else }}
<div>
{{ i18n "no_posts" }}