diff options
author | tosi29 <tosi16@gmail.com> | 2019-11-12 19:10:29 +0300 |
---|---|---|
committer | tosi29 <tosi16@gmail.com> | 2019-11-12 19:10:29 +0300 |
commit | 91e70cc81439caa7df786e26c91580d49708bd80 (patch) | |
tree | 6325ae98d2cc1cce06ba6e14e4d283208f6d5200 | |
parent | aedd72882d70eeeabcc6129db4c45ef6b2019cf9 (diff) |
Hide icon if no categories/tags
-rw-r--r-- | layouts/_default/single.html | 24 | ||||
-rw-r--r-- | layouts/_default/summary.html | 14 |
2 files changed, 25 insertions, 13 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0c7ad9f..2358412 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -24,23 +24,29 @@ <footer class="post-footer"> - <span class="post-categories"> - {{ $categories := .Params.categories }} - {{- range $items := .Site.Taxonomies.categories -}} + {{ $categories := .Params.categories }} + {{ $all_categories := .Site.Taxonomies.categories }} + {{ with $categories }} + <span class="post-categories"> + {{- range $all_categories -}} {{ if in $categories .Page.Title }} <a href="{{- .Page.Permalink -}}">{{ .Page.Title }}</a>  {{ end }} {{- end }} - </span> - - <span class="post-tags"> - {{ $tags := .Params.tags }} - {{- range $items := .Site.Taxonomies.tags -}} + </span> + {{ end }} + + {{ $tags := .Params.tags }} + {{ $all_tags := .Site.Taxonomies.tags }} + {{ with $tags }} + <span class="post-tags"> + {{- range $all_tags -}} {{ if in $tags .Page.Title }} <a href="{{- .Page.Permalink -}}">{{ .Page.Title }}</a>  {{ end }} {{- end }} - </span> + </span> + {{ end }} </footer> {{ partial "ad_double_rectangle.html" . }} {{ partial "relatedposts.html" . }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index a7e9ac2..f0a60d0 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -35,23 +35,29 @@ </div> <footer class="post-footer"> + {{ $categories := .Params.categories }} + {{ $all_categories := .Site.Taxonomies.categories }} + {{ with $categories }} <span class="post-categories"> - {{ $categories := .Params.categories }} - {{- range $items := .Site.Taxonomies.categories -}} + {{- range $all_categories -}} {{ if in $categories .Page.Title }} <a href="{{- .Page.Permalink -}}">{{ .Page.Title }}</a>  {{ end }} {{- end }} </span> + {{ end }} + {{ $tags := .Params.tags }} + {{ $all_tags := .Site.Taxonomies.tags }} + {{ with $tags }} <span class="post-tags"> - {{ $tags := .Params.tags }} - {{- range $items := .Site.Taxonomies.tags -}} + {{- range $all_tags -}} {{ if in $tags .Page.Title }} <a href="{{- .Page.Permalink -}}">{{ .Page.Title }}</a>  {{ end }} {{- end }} </span> + {{ end }} </footer> </article>
\ No newline at end of file |