Skip to content
Snippets Groups Projects
Commit b3b354ce authored by alexisben's avatar alexisben
Browse files

handle descriptions in list mode

parent 2a58cf80
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
.top
a
text-decoration: none
.grid, .cards
.grid, .cards, .list
article
position: relative
display: flex
......@@ -128,34 +128,57 @@
&--list
ul
@include list-reset
&.title-only
li
line-height: 1
li
display: block
line-height: 1
+ li
margin-top: $spacing0
a
> a
@include icon(arrow, before, true)
padding-right: $spacing0
@include hover-translate-icon(before, 5)
@include link
text-decoration-color: rgba(0,0,0,0)
article
.page-title
@include h3
a
@include icon(arrow, after, true)
@include hover-translate-icon(after)
text-decoration-color: transparent
@include media-breakpoint-down(desktop)
.top
margin-bottom: $spacing0
ul
margin-top: $spacing1
@include media-breakpoint-up(desktop)
ul:not(.title-only)
li + li
margin-top: $grid-gutter
article
gap: $grid-gutter
flex-direction: row
.media
flex-shrink: 0
margin-bottom: 0
@include in-page-with-sidebar
.block-content
.top
margin-bottom: $spacing1
ul
ul.title-only
@include grid(2, desktop)
grid-row-gap: $spacing0 !important
grid-column-gap: half($grid-gutter) !important
li
margin-top: 0
article
gap: half($grid-gutter)
.media
width: calc(#{col(2, 8)} + #{half($grid-gutter)})
.page-content
width: col(6, 8)
@include in-page-without-sidebar
.block-title
......@@ -176,7 +199,7 @@
@include body-text
margin-top: 0
// Default behavior (without page description)
ul
ul.title-only
@include grid(4, desktop)
grid-column: 1 / 13
li
......@@ -188,6 +211,11 @@
display: block
li + li
margin-top: $spacing0
article
.media
width: col(2, 6)
.page-content
width: col(4, 6)
&--alternate
.top
......
{{ $length := .length | default 150 }}
{{ $text := replace .text "<" " <" }}
{{ $text = chomp (truncate $length "…" (safeHTML (plainify $text))) }}
{{ return $text }}
{{ if gt .length 0 }}
{{ $text = chomp (truncate $length "…" (safeHTML (plainify $text))) }}
{{ return $text }}
{{ else }}
{{ return .text }}
{{ end }}
\ No newline at end of file
......@@ -42,12 +42,16 @@
<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
"heading_level" $block.ranks.self
"description" (printf "<p>%s</p>" $main_description)
)}}
"description" $main_description
) }}
{{- partial (printf "blocks/templates/pages/%s.html" $layout) (dict
"pages" .pages
......
<ul>
{{ $show_descriptions := .show_descriptions }}
{{ $show_images := .show_images }}
{{ $heading_level := .heading_level | default 3 }}
{{ $heading_tag := partial "GetHeadingTag" (dict
"level" $heading_level
"attributes" "class='page-title'"
)}}
<ul class="list {{ if and (not $show_descriptions) (not $show_images) }} title-only {{ end }}">
{{ range .pages }}
{{ $page := site.GetPage .file }}
{{ with $page }}
<li>
<a href="{{- .Permalink -}}">
{{- partial "PrepareHTML" .Title -}}
</a>
{{ if or $show_descriptions $show_images }}
<article>
<div class="page-content">
{{ $heading_tag.open }}
<a href="{{- .Permalink -}}">
{{- partial "PrepareHTML" .Title -}}
</a>
{{ $heading_tag.close }}
{{ if and $show_descriptions .Params.summary }}
<p>{{ partial "GetTruncateContent" ( dict
"text" .Params.summary
"length" site.Params.pages.index.truncate_description
) }}</p>
{{ end }}
</div>
{{ if $show_images }}
{{- partial "pages/page-media.html" . -}}
{{ end }}
</article>
{{ else }}
<a href="{{- .Permalink -}}">
{{- partial "PrepareHTML" .Title -}}
</a>
{{ end }}
</li>
{{- end -}}
{{ end }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment