hugo-PaperMod
hugo-PaperMod copied to clipboard
Allow page params to override hidden cover image in list
I'd like to be able to have my site default to be to show covers in the list, but allow individual pages (in their front matter) to override this.
Is there some policy/security reason this isn't available? If not, and you're amenable to it, I'd be happy to submit a PR for this.
diff --git i/layouts/_default/list.html w/layouts/_default/list.html
index 0cc1ad9e..5bd508b9 100644
--- i/layouts/_default/list.html
+++ w/layouts/_default/list.html
@@ -49,7 +49,7 @@
{{- end }}
<article class="{{ $class }}">
- {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }}
+ {{- $isHidden := ( $page.Params.cover.hidden | default $page.Params.cover.hiddenInList | default .Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }}
{{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }}
<header class="entry-header">
<h2>
Config example:
config.yaml
params:
cover:
hidden: false
frontmatter:
cover:
hidden: true
Would show images in list view for all posts except for those with the indicated front matter.
https://github.com/adityatelange/hugo-PaperMod/blob/15b984bd215b7c4a73385e76486ec93b0aadcc53/layouts/_default/single.html#L24
https://github.com/adityatelange/hugo-PaperMod/blob/15b984bd215b7c4a73385e76486ec93b0aadcc53/layouts/_default/list.html#L52
I hope this is already present
The way I read that code is that if cover.hidden is defined in config.yaml, the page-level params cannot override the setting. Is this an intentional limitation?