mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
cover: granular controls for hiding cover image #156
in site config => params: cover: hidden: true # hide everywhere but not in structured data hiddenInList: true # hide on list pages and home hiddenInSingle: true # hide on single page per-page in front-matter => hidden: true # only hide on current single page
This commit is contained in:
parent
e252e761f5
commit
c9fa6c7915
@ -31,7 +31,8 @@
|
||||
{{- $class = "post-entry tag-entry" }}
|
||||
{{- end }}
|
||||
<article class="{{ $class }}">
|
||||
{{- partial "cover.html" (dict "cxt" . "IsHome" true) }}
|
||||
{{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList)}}
|
||||
{{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }}
|
||||
<header class="entry-header">
|
||||
<h2>
|
||||
{{ .Title }}
|
||||
|
@ -28,7 +28,8 @@
|
||||
</div>
|
||||
{{- end}}
|
||||
</header>
|
||||
{{- partial "cover.html" (dict "cxt" . "IsHome" false) }}
|
||||
{{- $isHidden := ((.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInSingle) | default .Params.cover.hidden )}}
|
||||
{{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }}
|
||||
{{- if .Params.ShowToc }}
|
||||
<div class="toc">
|
||||
<details {{if .Params.TocOpen }} open{{ end }}>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- with .cxt}} {{/* Apply proper context from dict */}}
|
||||
{{- if .Params.cover.image }}
|
||||
{{- if (and .Params.cover.image (not $.isHidden)) }}
|
||||
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
|
||||
<figure class="entry-cover">
|
||||
{{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }}
|
||||
|
Loading…
Reference in New Issue
Block a user