diff --git a/assets/sass/_theme/blocks/posts.sass b/assets/sass/_theme/blocks/posts.sass index 43c045a4065c0d89673f919ee0ef496e3c3a5b0a..4949d3cc0c0b098a8a96cb7fe643c8535e23066b 100644 --- a/assets/sass/_theme/blocks/posts.sass +++ b/assets/sass/_theme/blocks/posts.sass @@ -206,3 +206,18 @@ margin-right: auto .post width: col(4, 10) + +// Move this part to blocks/categories when categories block is ready +.block-posts + .categories--grid + li + background: $color-background-alt + padding: $spacing1 + position: relative + a + @include h3 + font-weight: bold + text-decoration: none + @include stretched-link + p + display: block \ No newline at end of file diff --git a/assets/sass/_theme/sections/categories.sass b/assets/sass/_theme/sections/categories.sass index 2d3c05e69b14c4a40cb1b10e8f293f6a43127f02..cad384611410c89581f8c91525f730e4c5b56694 100644 --- a/assets/sass/_theme/sections/categories.sass +++ b/assets/sass/_theme/sections/categories.sass @@ -1,10 +1,15 @@ ul.categories - @include list-section - li - a:first-child - & + p - text-align: right - white-space: nowrap + &:not(.categories--grid) + @include list-section + li + a:first-child + & + p + text-align: right + white-space: nowrap + &--grid + @include list-reset + @include grid(1) + @include grid(4, md) .categories__term main diff --git a/i18n/en.yml b/i18n/en.yml index 2e68d87bbccecf5896fb8a145714f9c9c00bc9d1..c1db35e9bb45b649278c07611ffccfa1e4b31cd4 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -1,6 +1,10 @@ blocks: call_to_action: title: Call to action + categories: + title: Catégories + items: + count: "{{ .Count }} articles" chapter: title: Chapter contact: diff --git a/i18n/fr.yml b/i18n/fr.yml index 5b434c9169ffd8140a4d85079f46180514a6710d..459999773d3f015966ad7b63c3030981c446bcf5 100644 --- a/i18n/fr.yml +++ b/i18n/fr.yml @@ -1,6 +1,12 @@ blocks: call_to_action: title: Appel à actions + categories: + title: Catégories + items: + count: + one: "1 article" + other: "{{ .Count }} articles" chapter: title: Chapitre contact: diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html index b3ea58912c4e2a88b3f5d78fc8356bddf99feabc..81364943e4b5a489017f9f643dbe536e1d3556fd 100644 --- a/layouts/partials/blocks/templates/posts.html +++ b/layouts/partials/blocks/templates/posts.html @@ -26,10 +26,22 @@ )}} {{- end }} - {{ partial (printf "blocks/templates/posts/%s.html" $layout) (dict - "posts" .posts - "heading_level" $block.ranks.children - )}} + {{ if eq .mode "categories" }} + <ul class="categories categories--grid"> + {{ range site.Taxonomies.categories }} + <li data-title="{{ .Page.Title }}"> + {{ partial "categories/category.html" .Page }} + <p>{{ i18n "blocks.categories.items.count" (dict "Count" (len .)) }}</p> + </li> + {{ end }} + </ul> + {{ else if .posts }} + {{ partial (printf "blocks/templates/posts/%s.html" $layout) (dict + "posts" .posts + "heading_level" $block.ranks.children + )}} + {{ end }} + </div> </div> </div>