diff options
author | uPagge <git@upagge.ru> | 2021-05-14 09:55:51 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-05-14 09:55:51 +0300 |
commit | a34e5c2763b54e95ab283aa1729bbe7b1a90bcc0 (patch) | |
tree | bbc3ff308fbc6d7470b56acb958a0b4a169ad724 | |
parent | adb93312b1c9906256cffd3338916c9dfe11e19c (diff) |
see-also and postSort
-rw-r--r-- | i18n/en.toml | 3 | ||||
-rw-r--r-- | i18n/ru.toml | 3 | ||||
-rw-r--r-- | layouts/index.html | 20 | ||||
-rw-r--r-- | layouts/shortcodes/see-also.html | 15 |
4 files changed, 32 insertions, 9 deletions
diff --git a/i18n/en.toml b/i18n/en.toml index 2429940..3184fa7 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -18,6 +18,9 @@ other = "Next article" [navPrev] other = "Previous article" + +[seeAlso] +other = "See also" # === Post === # === Taxonomy === diff --git a/i18n/ru.toml b/i18n/ru.toml index 6d75dc2..47dc096 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -19,6 +19,9 @@ other = "Следующая статья" [navPrev] other = "Предыдущая статья" + +[seeAlso] +other = "Посмотрите также" # === Post === # === Taxonomy === diff --git a/layouts/index.html b/layouts/index.html index e78e7f2..7662e51 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -52,18 +52,20 @@ <div class="post-pinned"> {{- .Render "summary" -}} </div> - <hr/> {{end}} {{end}} {{end}} - <div class="post-sort"> - <ol> - <li><a href="/posts/">Все посты</a> </li> - <li><a href="/">Основные посты</a></li> - <li><a href="/views">Лучшее</a></li> - <li><a href="/feed">Фид</a></li> - </ol> - </div> + {{ if .Site.Params.PostSort }} + <hr/> + <div class="post-sort"> + <ol> + {{- range .Site.Params.PostSort -}} + {{- $url := .url | relLangURL -}} + <li><a href="{{ $url }}">{{ .name }}</a></li> + {{ end }} + </ol> + </div> + {{ end }} {{- range $pages.Pages -}} {{- .Render "summary" -}} {{- end -}} diff --git a/layouts/shortcodes/see-also.html b/layouts/shortcodes/see-also.html new file mode 100644 index 0000000..eca58d1 --- /dev/null +++ b/layouts/shortcodes/see-also.html @@ -0,0 +1,15 @@ +{{ $posts := where .Site.RegularPages "Section" "blog"}} +{{ $related := .Site.RegularPages.RelatedIndices .Page "tags" | first 3 }} +{{ if eq (len $related) 0 }} +{{ $related = $posts.ByDate | first 3 }} +{{ end }} +{{ with $related }} +<div class="see-also"> + <span class="see-title">{{ T `seeAlso` }}</span> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ end }} +</div>
\ No newline at end of file |