diff --git a/assets/sass/_theme/blocks/pages.sass b/assets/sass/_theme/blocks/pages.sass index 6a5065f91c41c84595756991e7d9e9f8383a21c3..0a3bd92fe416fa8772cf515389cb4102c12355e7 100644 --- a/assets/sass/_theme/blocks/pages.sass +++ b/assets/sass/_theme/blocks/pages.sass @@ -167,12 +167,16 @@ .block-content .top margin-bottom: $spacing1 + .description + margin-bottom: $spacing2 ul.title-only @include grid(2, desktop) grid-row-gap: $spacing0 !important grid-column-gap: half($grid-gutter) !important li margin-top: 0 + a + @include meta article gap: half($grid-gutter) .media @@ -184,38 +188,56 @@ .block-title a @include stretched-link(before) - .block-content - @include grid - .top - align-items: initial - grid-column: 1 / 8 - margin-bottom: 0 - display: grid - grid-template-rows: subgrid - grid-row: span 2 - .block-title - width: auto - .description - @include body-text - margin-top: 0 - // Default behavior (without page description) + .top + .description + p + @include h2 + article + .media + width: col(4) + .page-content + width: col(8) + &:not(.with-description) ul.title-only - @include grid(4, desktop) + @include grid(4, desktop, space(2)) grid-column: 1 / 13 li margin-top: 0 - // If page description - .top + ul - grid-column: 9 / 13 - grid-row: 2 - display: block + ul:not(.title-only) + @include grid(2, desktop) li + li - margin-top: $spacing0 - article - .media - width: col(2, 6) - .page-content - width: col(4, 6) + margin-top: 0 + &.with-description + .block-content + @include grid(12, desktop, $spacing2) + row-gap: half($grid-gutter) + .top + align-items: initial + grid-column: 1 / 8 + margin-bottom: 0 + display: grid + grid-template-rows: subgrid + grid-row: span 2 + .block-title + width: auto + .description + @include body-text + margin-top: 0 + // If page description + .top + ul + grid-column: 9 / 13 + grid-row: 2 + display: block + li + li + margin-top: $spacing0 + article + margin-top: $spacing3 + &.with-images + .top + grid-column: 1 / 7 + .top + ul + grid-column: 7 / 13 + &--alternate .top diff --git a/layouts/partials/GetTruncateContent b/layouts/partials/GetTruncateContent index e540e620942c1fe4746c0dbd5e6e5f1c3d00a6ea..23bd565a877e816efd9163d98f26c99e23a28292 100644 --- a/layouts/partials/GetTruncateContent +++ b/layouts/partials/GetTruncateContent @@ -1,9 +1,9 @@ {{ $length := .length | default 150 }} -{{ $text := replace .text "<" " <" }} +{{ $text := .text }} {{ if gt .length 0 }} + {{ $text = replace .text "<" " <" }} {{ $text = chomp (truncate $length "…" (safeHTML (plainify $text))) }} - {{ return $text }} -{{ else }} - {{ return .text }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ return $text }} \ No newline at end of file diff --git a/layouts/partials/blocks/templates/pages.html b/layouts/partials/blocks/templates/pages.html index 8c76cce8ea31da1c615e9fbae7f4cf72af755e48..226dd0e9db8fb7dc1d6a82af08cc2794b5db69a4 100644 --- a/layouts/partials/blocks/templates/pages.html +++ b/layouts/partials/blocks/templates/pages.html @@ -4,8 +4,6 @@ {{- $layout := .block.data.layout | default "grid" -}} {{- with .block.data -}} - - {{- $show_main_page := false -}} {{- $show_main_description := .show_main_description -}} {{- $show_descriptions := .show_descriptions -}} {{- $show_images := .show_images -}} @@ -19,7 +17,6 @@ {{ end }} {{- with $page }} - {{- $show_main_page = true -}} {{- $page_link = $page.Permalink }} {{ if eq $title "" }} {{ $title = .Title }} @@ -39,13 +36,18 @@ {{ end }} {{ end -}} + {{ if $main_description }} + {{/* SHOULD BE FIXED WITH ORTHOTYPO */}} + {{ $main_description = printf "<p>%s</p>" $main_description }} + {{ $block_class = printf "%s %s" $block_class "with-description" }} + {{ end }} + {{ if $show_images }} + {{ $block_class = printf "%s %s" $block_class "with-images" }} + {{ end }} + <div class="{{ $block_class }} {{ $page_class }}"> <div class="container"> <div class="block-content"> - {{ if $main_description }} - {{ $main_description = printf "<p>%s</p>" $main_description }} - {{ end }} - {{ partial "blocks/top.html" (dict "title" $title "link" $page_link