diff --git a/config.yaml b/config.yaml index 0160f9df8ab1c9fa62b0eb5e1e146b9f8549e860..d2434eaa38f952d5bd2133282e5c532db96e88f4 100644 --- a/config.yaml +++ b/config.yaml @@ -81,6 +81,12 @@ params: show_description: true truncate_description: 200 # Set to 0 to disable truncate layout: list # grid | list + options: + hide_image: false + hide_summary: false + hide_category: false + hide_author: false + hide_date: false share_links: facebook: true twitter: true diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html index af9fadeb2e3d1fc4a1a01c61501b4b76b23c591c..6d19f1de7be706d66618ba85f3b3292e7403a632 100644 --- a/layouts/partials/blocks/templates/posts.html +++ b/layouts/partials/blocks/templates/posts.html @@ -3,6 +3,7 @@ {{- $term := false -}} {{- $layout := .block.data.layout | default "grid" -}} + {{- with .block.data }} {{- $options := dict "hide_image" .hide_image diff --git a/layouts/partials/blocks/templates/posts/highlight.html b/layouts/partials/blocks/templates/posts/highlight.html index de4d08ae900e4d51941b51130315cf883e1708ce..4f46f762d0551801b62fd3c88038ca89529df29a 100644 --- a/layouts/partials/blocks/templates/posts/highlight.html +++ b/layouts/partials/blocks/templates/posts/highlight.html @@ -32,10 +32,10 @@ <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a> {{ $heading_tag.close }} - {{ if and site.Params.posts.index.show_categories (eq $options.hide_cathegory false) }} + {{ if eq $options.hide_cathegory false }} {{- partial "posts/categories" . -}} {{ end }} - {{ if and site.Params.posts.index.show_description (eq $options.hide_summary false) }} + {{ if eq $options.hide_summary false }} {{- if (partial "GetTextFromHTML" .Params.summary) -}} <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict "text" .Params.summary @@ -48,7 +48,7 @@ {{- if eq $options.hide_date false -}} <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> {{ end }} - {{ if and site.Params.posts.index.show_author (eq $options.hide_author false) }} + {{ if eq $options.hide_author false }} {{- partial "posts/author" . -}} {{ end }} </div> diff --git a/layouts/partials/blocks/templates/posts/large.html b/layouts/partials/blocks/templates/posts/large.html index f54b79ee474855c66d934c21585c0ce7b97d5bd8..f9c61b60eb7d593276d5b4cbf10c274011cea38c 100644 --- a/layouts/partials/blocks/templates/posts/large.html +++ b/layouts/partials/blocks/templates/posts/large.html @@ -25,19 +25,19 @@ {{ $heading_tag.close }} <div class="post-meta"> - {{ if and site.Params.posts.index.show_author (eq $options.hide_author false) }} + {{ if eq $options.hide_author false }} {{- partial "posts/author" . -}} {{ end }} {{ if eq $options.hide_date false }} <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> {{ end }} - {{ if and site.Params.posts.index.show_categories (eq $options.hide_cathegory false) }} + {{ if eq $options.hide_cathegory false }} {{- partial "posts/categories" . -}} {{ end }} </div> - {{ if and site.Params.posts.index.show_description (eq $options.hide_summary false) }} + {{ if eq $options.hide_summary false }} {{- if (partial "GetTextFromHTML" .Params.summary) -}} <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict "text" .Params.summary diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html index b1149355f8df4bb44f8041c846ea503b4b6ba559..892102f845eb0d899e24a3f3caa2e395b3e40b82 100644 --- a/layouts/partials/posts/post.html +++ b/layouts/partials/posts/post.html @@ -15,56 +15,54 @@ {{ with $post }} -{{ if .Params.image }} - {{- $direction = partial "GetImageDirection" .Params.image -}} -{{ end }} + {{ if .Params.image }} + {{- $direction = partial "GetImageDirection" .Params.image -}} + {{ end }} -<article class='post {{ if $alternate }} {{- if (not (isset .Params "image")) -}} without-image {{- end -}}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> - <div class="post-content"> - {{- $title := partial "PrepareHTML" .Title -}} + <article class='post {{ if $alternate }} {{- if (not (isset .Params "image")) -}} without-image {{- end -}}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> + <div class="post-content"> + {{- $title := partial "PrepareHTML" .Title -}} - {{ $heading_tag.open }} - <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a> - {{ $heading_tag.close }} + {{ $heading_tag.open }} + <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a> + {{ $heading_tag.close }} - {{ if and site.Params.posts.index.show_categories $show_category }} - {{- partial "posts/categories" . -}} - {{ end }} + {{ if $show_category }} + {{- partial "posts/categories" . -}} + {{ end }} - {{ if and site.Params.posts.index.show_description $show_summary }} - {{- if (partial "GetTextFromHTML" .Params.summary) -}} - <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict - "text" .Params.summary - "length" site.Params.posts.index.truncate_description - ) }}</p> - {{- end -}} - {{- end -}} - - {{ if or $show_author $show_date }} - <div class="post-meta"> - {{ if $show_date }} - <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> - {{ end }} - {{ if and site.Params.posts.index.show_author $show_author }} - {{- partial "posts/author" . -}} - {{ end }} - </div> - {{ end }} - - - </div> - {{ if $show_image }} - <div class="media"> - {{- if and .Params.image -}} - {{- partial "commons/image.html" - (dict - "image" .Params.image - "sizes" site.Params.image_sizes.sections.posts.item - ) -}} - {{- else -}} - {{- partial "commons/image-default.html" "posts" -}} + {{ if $show_summary }} + {{- if (partial "GetTextFromHTML" .Params.summary) -}} + <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict + "text" .Params.summary + "length" site.Params.posts.index.truncate_description + ) }}</p> + {{- end -}} {{- end -}} + + {{ if or $show_author $show_date }} + <div class="post-meta"> + {{ if $show_date }} + <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> + {{ end }} + {{ if $show_author }} + {{- partial "posts/author" . -}} + {{ end }} + </div> + {{ end }} </div> - {{- end -}} -</article> + {{ if $show_image }} + <div class="media"> + {{- if and .Params.image -}} + {{- partial "commons/image.html" + (dict + "image" .Params.image + "sizes" site.Params.image_sizes.sections.posts.item + ) -}} + {{- else -}} + {{- partial "commons/image-default.html" "posts" -}} + {{- end -}} + </div> + {{- end -}} + </article> {{ end }} \ No newline at end of file