From 165081d97d665b73bc468e2b1188258fc6019dc6 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Wed, 16 Jun 2021 11:08:07 +0200 Subject: [PATCH] sort tags everywhere --- layouts/_default/search.json | 2 +- layouts/_default/single.html | 2 +- layouts/index.json | 2 +- layouts/partials/article_card.html | 4 ++-- layouts/partials/featured_articles.html | 2 +- layouts/partials/head_meta_opengraph.html | 2 +- layouts/partials/head_meta_seo.html | 2 +- layouts/partials/js_paginator.html | 12 +++++++----- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/layouts/_default/search.json b/layouts/_default/search.json index 22ce283..ce3d578 100644 --- a/layouts/_default/search.json +++ b/layouts/_default/search.json @@ -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 diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b9e4f4e..8ea3b99 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -16,7 +16,7 @@

Tags: - {{ range .Params.tags }} + {{ range sort .Params.tags }} {{ .Date.Format "2006-01-02" }} - {{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }} + {{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }} | - {{ range .Params.tags }} + {{ range sort .Params.tags }} #{{ . }} {{ end }} {{ end }} diff --git a/layouts/partials/featured_articles.html b/layouts/partials/featured_articles.html index 59936f0..edd3c94 100644 --- a/layouts/partials/featured_articles.html +++ b/layouts/partials/featured_articles.html @@ -17,7 +17,7 @@ {{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
- {{ range .Params.tags }} + {{ range sort .Params.tags }} #{{ . }} {{ end }} {{ end }} diff --git a/layouts/partials/head_meta_opengraph.html b/layouts/partials/head_meta_opengraph.html index fa4acc0..98f0e05 100644 --- a/layouts/partials/head_meta_opengraph.html +++ b/layouts/partials/head_meta_opengraph.html @@ -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 }} {{ end }} {{ end }} diff --git a/layouts/partials/head_meta_seo.html b/layouts/partials/head_meta_seo.html index 3780fab..fb606ff 100644 --- a/layouts/partials/head_meta_seo.html +++ b/layouts/partials/head_meta_seo.html @@ -1,7 +1,7 @@ {{ if .IsPage }} {{ if .Params.tags }} - + {{ end }} {{ if .Params.description }} diff --git a/layouts/partials/js_paginator.html b/layouts/partials/js_paginator.html index 3cff31f..e4ad8e9 100644 --- a/layouts/partials/js_paginator.html +++ b/layouts/partials/js_paginator.html @@ -16,7 +16,7 @@

- ${article.title} + ${article.title}

@@ -28,10 +28,12 @@ {{ if .Site.Params.imageInArticlePreview }} ${renderImage(article.image)} {{end}} -

-

${article.summary}

-

Continue reading 

-
+ {{ if (site.Params.articleSummary | default true) }} +
+

${article.summary}

+

Continue reading 

+
+ {{ end }}