Support categories parameter for posts (#73)

This commit is contained in:
George Cushen 2017-01-12 09:51:57 +00:00
commit 7901d14d75
2 changed files with 15 additions and 1 deletions

View file

@ -8,13 +8,26 @@
</time>
</span>
{{ if isset $.Params "categories" }}
{{ $categoriesLen := len $.Params.categories }}
{{ if gt $categoriesLen 0 }}
<span class="article-categories">
<i class="fa fa-folder"></i>
{{ range $k, $v := $.Params.categories }}
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a
>{{ if lt $k (sub $categoriesLen 1) }}, {{ end }}
{{ end }}
</span>
{{ end }}
{{ end }}
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
<span class="article-tags">
<i class="fa fa-tags"></i>
{{ range $k, $v := $.Params.tags }}
<a class="article-tag-link" href="{{ $.Site.BaseURL }}tags/{{ . | urlize | lower }}">{{ . }}</a
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a
>{{ if lt $k (sub $tagsLen 1) }}, {{ end }}
{{ end }}
</span>

View file

@ -403,6 +403,7 @@ article {
}
.article-metadata .article-date,
.article-metadata .article-categories,
.article-metadata .article-tags {
margin-right: 10px;
}