From d708194145c394b0b4de185ebf8e55889c40f765 Mon Sep 17 00:00:00 2001 From: alexisben <alex@noesya.coop> Date: Tue, 17 Jan 2023 16:07:33 +0100 Subject: [PATCH] handle post layout by config --- assets/sass/_theme/_configuration.sass | 2 - assets/sass/_theme/sections/posts.sass | 90 +++++++++++++------------- layouts/partials/posts/posts.html | 2 +- 3 files changed, 45 insertions(+), 49 deletions(-) diff --git a/assets/sass/_theme/_configuration.sass b/assets/sass/_theme/_configuration.sass index 57a9d2ae..b0abc58c 100644 --- a/assets/sass/_theme/_configuration.sass +++ b/assets/sass/_theme/_configuration.sass @@ -336,8 +336,6 @@ $article-media-aspect-ratio: 2 !default $post-media-background: $article-media-background !default $post-categories-color: color-contrast($color-text, 20%) !default $post-time-color: $color-text-alt !default -// Layout posts list (ne concerne pas les blocks posts) -$posts-layout-list: true !default // Si layout posts grid (ne concerne pas les blocks posts) $posts-grid-columns: $block-posts-grid-columns !default diff --git a/assets/sass/_theme/sections/posts.sass b/assets/sass/_theme/sections/posts.sass index 48a556b9..2e8688af 100644 --- a/assets/sass/_theme/sections/posts.sass +++ b/assets/sass/_theme/sections/posts.sass @@ -20,54 +20,52 @@ .authors__term, .categories__term, .persons__page - @if $posts-layout-list - .posts - article - border-bottom: 1px solid $color-border - display: flex - margin-bottom: $spacing1 - padding-bottom: $spacing1 - flex-direction: row - h1 + p - margin-top: $spacing0 - @include media-breakpoint-up(desktop) - @include grid - margin-bottom: $spacing3 - padding-bottom: $spacing3 - div:not(.media) - grid-column: 4/13 - @include media-breakpoint-down(desktop) - flex: 1 - margin-left: $spacing0 - p:not(.title) - @include media-breakpoint-down(desktop) - display: none - .media - background: none - margin: 0 + + .posts--list + article + border-bottom: 1px solid $color-border + display: flex + margin-bottom: $spacing1 + padding-bottom: $spacing1 + flex-direction: row + h1 + p + margin-top: $spacing0 + @include media-breakpoint-up(desktop) + @include grid + margin-bottom: $spacing3 + padding-bottom: $spacing3 + div:not(.media) + grid-column: 4/13 + @include media-breakpoint-down(desktop) + flex: 1 + margin-left: $spacing0 + p:not(.title) @include media-breakpoint-down(desktop) - width: 33.33333% - @include media-breakpoint-up(desktop) - grid-column: 1/4 - &, img - aspect-ratio: auto + display: none + .media + background: none + margin: 0 + @include media-breakpoint-down(desktop) + width: 33.33333% @include media-breakpoint-up(desktop) - time - font-size: $h5-size - position: absolute - right: 0 - top: 0 - div:not(.media) - h1, - p, - a - max-width: col(6, 9) - - @else - .posts - @include grid(1) - @include grid(2, desktop) - @include grid($posts-grid-columns, xxl) + grid-column: 1/4 + &, img + aspect-ratio: auto + @include media-breakpoint-up(desktop) + time + font-size: $h5-size + position: absolute + right: 0 + top: 0 + div:not(.media) + h1, + p, + a + max-width: col(6, 9) + .posts--grid + @include grid(1) + @include grid(2, desktop) + @include grid($posts-grid-columns, xxl) .posts__page @include media-breakpoint-down(desktop) diff --git a/layouts/partials/posts/posts.html b/layouts/partials/posts/posts.html index 7a0a4cfd..0dd9340c 100644 --- a/layouts/partials/posts/posts.html +++ b/layouts/partials/posts/posts.html @@ -1,4 +1,4 @@ -<div class="posts"> +<div class="posts posts--{{- site.Params.posts.index.layout -}}"> {{ if not .Pages }} <p>{{ i18n "categories.no_post" }}</p> {{ end }} -- GitLab