sort tags everywhere

This commit is contained in:
Gabriele Musco 2021-06-16 11:08:07 +02:00
parent 6f8e3cfdb4
commit 165081d97d
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
8 changed files with 15 additions and 13 deletions

View File

@ -6,7 +6,7 @@
{{ $mscratch.Add "articles" (dict
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (or .Params.tags slice)
"tags" (sort (or .Params.tags slice))
"summary" .Summary
"text" (lower .Plain)
"link" .Permalink

View File

@ -16,7 +16,7 @@
<p class="articleTagsContainer">
<span></span>
<strong>Tags:</strong>
{{ range .Params.tags }}
{{ range sort .Params.tags }}
<a
{{ if site.Params.discreteTags | default false }}
class="discreteTag"

View File

@ -14,7 +14,7 @@
{{ $mscratch.Add "articles" (dict
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (or .Params.tags slice)
"tags" (sort (or .Params.tags slice))
"summary" .Summary
"link" .Permalink
"image" (or .Params.Image "")) }}

View File

@ -9,7 +9,7 @@
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
| <!-- Pipe character as visual separator between date and tags-->
<span title="Tags"></span>
{{ range .Params.tags }}
{{ range sort .Params.tags }}
<a href="/tags/{{ . | urlize }}">#{{ . }}</a>
{{ end }}
{{ end }}

View File

@ -17,7 +17,7 @@
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
<br />
<span title="Tags"></span>
{{ range .Params.tags }}
{{ range sort .Params.tags }}
#{{ . }}
{{ end }}
{{ end }}

View File

@ -10,7 +10,7 @@
property="article:published_time"
content='{{ .Date.Format "2006-01-02T15:04:05Z-0700" }}' />
{{ if .Params.tags }}
{{ range .Params.tags }}
{{ range sort .Params.tags }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}

View File

@ -1,7 +1,7 @@
<meta name="author" content="{{ .Site.Params.Author }}" />
{{ if .IsPage }}
{{ if .Params.tags }}
<meta name="keywords" content='{{ delimit .Params.tags ", "}}' />
<meta name="keywords" content='{{ delimit (sort .Params.tags) ", "}}' />
{{ end }}
{{ if .Params.description }}
<meta name="description" content="{{ .Params.description }}" />

View File

@ -28,10 +28,12 @@
{{ if .Site.Params.imageInArticlePreview }}
${renderImage(article.image)}
{{end}}
{{ if (site.Params.articleSummary | default true) }}
<div class="articlePreview">
<p>${article.summary}</p>
<p><a href="${article.link}">Continue reading </a></p>
</div>
{{ end }}
</div>
<hr />
</article>