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 {{ $mscratch.Add "articles" (dict
"title" .Title "title" .Title
"date" (.Date.Format "2006-01-02") "date" (.Date.Format "2006-01-02")
"tags" (or .Params.tags slice) "tags" (sort (or .Params.tags slice))
"summary" .Summary "summary" .Summary
"text" (lower .Plain) "text" (lower .Plain)
"link" .Permalink "link" .Permalink

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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