diff options
author | Dionysis Grigoropoulos <dgrig@erethon.com> | 2016-07-05 22:30:49 +0300 |
---|---|---|
committer | Dionysis Grigoropoulos <dgrig@erethon.com> | 2016-07-05 22:39:52 +0300 |
commit | c9af6d63c3d7173197574b000b7578f15dea713b (patch) | |
tree | 21d3a4874a54c70b387a73b39c01491727669a22 | |
parent | fb27396c776fd5555c65b541becf398d0f7bfe56 (diff) |
Hide tags/categories if a post doesn't have any
-rw-r--r-- | layouts/indexes/tag.html | 6 | ||||
-rw-r--r-- | layouts/partials/post_footer.html | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/layouts/indexes/tag.html b/layouts/indexes/tag.html index d3ee56d..e688005 100644 --- a/layouts/indexes/tag.html +++ b/layouts/indexes/tag.html @@ -27,13 +27,13 @@ </time> <footer> <span class="categories"> <!-- show categories and tags --> - posted in: {{ if isset .Params "categories" }} + posted in: {{ range .Params.categories }} <a class="category" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }} - {{ end }} </br> - tags: + {{ end }} {{ if isset .Params "tags" }} + tags: {{ range .Params.tags }} <a class="category" href="{{ "/tags/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }} {{ end }} </span> diff --git a/layouts/partials/post_footer.html b/layouts/partials/post_footer.html index 261ed5f..cfa4d48 100644 --- a/layouts/partials/post_footer.html +++ b/layouts/partials/post_footer.html @@ -5,12 +5,12 @@ <span class="byline author vcard">Posted by <span class="fn">{{ with .Site.Params.author }}{{ . }}{{ end }}</span></span> <!-- can't put the .Date.Format inside the datetime attribute because of double quotes, so it's outside --> <time>{{ .Date.Format "Jan 2, 2006" }}</time> - <span class="categories"> - Tags: - {{ if isset .Params "tags" }} + {{ if isset .Params "tags" }} + <span class="categories"> + Tags: <!-- need to convert the tags to lower for the URLs to work --> {{ range .Params.tags }}<a class="category" href="{{ "/tags/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a> {{ end }} - {{ end }} + {{ end }} </span> </p> |