diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | content/all-posts.md | 4 | ||||
| -rw-r--r-- | i18n/en.toml | 3 | ||||
| -rw-r--r-- | i18n/ru.toml | 7 | ||||
| -rw-r--r-- | layouts/page/all-posts.html | 22 | ||||
| -rw-r--r-- | layouts/partials/mini-toc.html | 19 |
6 files changed, 49 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 905aad2..6859e89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `{{< mini-toc >}}` shortcode - Provide an ability to use `keywords` meta tag - Provide ability to render feeds menu +- Provide ability to get list of all posts any kind of content ### Changed diff --git a/content/all-posts.md b/content/all-posts.md new file mode 100644 index 0000000..7505929 --- /dev/null +++ b/content/all-posts.md @@ -0,0 +1,4 @@ +--- +title: All posts +layout: all-posts +--- diff --git a/i18n/en.toml b/i18n/en.toml index f1a413f..bc92d51 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -39,3 +39,6 @@ [send] other = 'Send' + +[all_publications] + other = 'All publications' diff --git a/i18n/ru.toml b/i18n/ru.toml index a2db4b2..2598df1 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -5,7 +5,7 @@ other = 'Вернуться наверх' [more] - other = 'Далее...' + other = 'Читать далее...' [updated_at] other = 'Обновлено' @@ -17,7 +17,7 @@ other = 'Ваше имя' [email_addres] - other = 'Email' + other = 'Обратный адрес' [message] other = 'Сообщение' @@ -39,3 +39,6 @@ [send] other = 'Отправить' + +[all_publications] + other = 'Все публикации' diff --git a/layouts/page/all-posts.html b/layouts/page/all-posts.html new file mode 100644 index 0000000..a26b084 --- /dev/null +++ b/layouts/page/all-posts.html @@ -0,0 +1,22 @@ +{{ define "main" }} +{{/* Define a section to pull recent posts from. + This will default to the section with the most number of pages. */}} +{{ $mainSections := site.Params.mainSections | default (slice "posts") }} + +{{/* Create a variable with that section to use in multiple places. */}} +{{ $section := where site.RegularPages.ByDate.Reverse "Section" "in" $mainSections }} + +<div class="articles"> + {{ with .Title }}<h1 class="page-title">{{ . }}</h1>{{ end }} + + {{ with .Content }} + <div class="category-content"> + {{ .Content }} + </div> + {{ end }} + + {{ range $section }} + {{ .Render "teaser" }} + {{ end }} +</div> +{{ end }} diff --git a/layouts/partials/mini-toc.html b/layouts/partials/mini-toc.html index 629169b..6b52f47 100644 --- a/layouts/partials/mini-toc.html +++ b/layouts/partials/mini-toc.html @@ -1,25 +1,34 @@ {{/* Define a section to pull recent posts from. This will default to the section with the most number of pages. */}} -{{ $mainSections := site.Params.mainSections | default (slice "post") }} +{{ $mainSections := site.Params.mainSections | default (slice "posts") }} {{/* Create a variable with that section to use in multiple places. */}} -{{ $section := where site.RegularPages "Section" "in" $mainSections }} +{{ $section := where site.RegularPages.ByDate.Reverse "Section" "in" $mainSections }} {{/* Check to see if the section is defined for ranging through it */}} {{ $sectionCount := len $section }} {{ if ge $sectionCount 1 }} - {{ $mxPosts := site.Params.recentPostsSize | default 5 }} + {{ $maxPosts := site.Params.recentPostsSize | default 5 }} <div class="toc" role="navigation"> <h2>{{ i18n "latest_publications" }}</h2> <ul class="texts"> - {{/* Range through the first $mxPosts items of the $section */}} - {{ range (first $mxPosts $section) }} + {{/* Range through the first $maxPosts items of the $section */}} + {{ range (first $maxPosts $section) }} <li class="text-title"> {{ partial "post-toc-summary" . }} </li> {{ end }} </ul> + + {{ if gt $sectionCount $maxPosts }} + <p> + <a href="{{ "all-posts" | relURL }}"> + {{ i18n "all_publications" }} + <span aria-hidden="true">→</span> + </a> + </p> + {{ end }} </div> {{ end }} |
