Add post_tags partial

This commit is contained in:
vimux 2018-02-23 15:54:37 +03:00
parent 8dd523595d
commit 8ea72745ac
3 changed files with 21 additions and 0 deletions

View file

@ -4,6 +4,7 @@
<article class="post"> <article class="post">
<h1 class="post__title">{{ .Title }}</h1> <h1 class="post__title">{{ .Title }}</h1>
<div class="post__content">{{ .Content }}</div> <div class="post__content">{{ .Content }}</div>
{{ if .Params.tags }}{{ partial "post_tags.html" . }}{{ end }}
</article> </article>
</div> </div>
</div> </div>

View file

@ -0,0 +1,8 @@
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
<div class="post__tags">
{{ range $k, $v := $.Params.tags }}<a class="post__tag" href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }}
</div>
{{ end }}
{{ end }}

View file

@ -374,6 +374,18 @@ summary {
text-decoration: none; text-decoration: none;
} }
.post__tags {
margin-top: 2rem;
}
.post__tag {
display: inline-block;
padding: 0 6px 3px;
margin: 0 5px 5px 0;
line-height: 1.5;
background: #151515;
}
/* Pagination */ /* Pagination */
.pagination { .pagination {
margin-bottom: 10px; margin-bottom: 10px;