Fix #3: add categories support

This commit is contained in:
Dmitry Kolosov 2020-01-27 22:38:45 +03:00
parent 2b7ab07c57
commit 95d551b945
7 changed files with 86 additions and 4 deletions

View File

@ -17,13 +17,19 @@ tag:
other: "tag"
Tags:
other: "tags"
other: "Tags"
Posts:
other: "Posts"
category:
other: "category"
Categories:
other: "Categories"
toAllTags:
other: "To all tags"
other: "to all tags"
toAllCategories:
other: "to all categories"

View File

@ -14,7 +14,7 @@ toOldPosts:
other: "к старым записям"
tag:
other: "Тег"
other: "тег"
Tags:
other: "Теги"
@ -22,8 +22,14 @@ Tags:
Posts:
other: "Записи"
category:
other: "Категория"
Categories:
other: "Категории"
toAllTags:
other: "Ко списку всех тегов"
other: "ко списку всех тегов"
toAllCategories:
other: "ко списку всех категорий"

View File

@ -14,6 +14,16 @@
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="/categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if and (.Params.categories) (.Params.tags) }}
|
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}

View File

@ -9,6 +9,16 @@
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="/categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if and (.Params.categories) (.Params.tags) }}
|
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}

View File

@ -12,6 +12,16 @@
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="/categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if and (.Params.categories) (.Params.tags) }}
|
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}

View File

@ -0,0 +1,28 @@
{{ define "main" }}
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
<div class="article-info">
<a href="/categories/">{{ i18n "toAllCategories" | humanize }}</a>
</div>
{{ range .Data.Pages }}
<article class="post-list">
<header>
<h1>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>
</header>
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
</div>
{{ .Summary }}
<div class="read-more">
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
</div>
</article>
{{ end }}
{{ end }}

View File

@ -159,6 +159,18 @@ article header h1 a {
display: inline;
}
.article-categories {
display: inline;
list-style-type: none;
padding: 0;
margin-right: 1em;
}
.article-categories li {
display: inline;
margin-left: 1em;
}
.article-tags {
display: inline;
list-style-type: none;