Last active
June 4, 2024 19:16
-
-
Save budparr/c019eecce25ca4b8809fa91f16bee3ec to your computer and use it in GitHub Desktop.
multiple where statements Remember that Hugo uses parameters in the range statement from the inside out. Order matters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ range first 3 (where (where .Site.Pages.ByDate.Reverse "Section" "posts") ".Title" "!=" .Title) }} | |
<!-- latest posts --> | |
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ range sort (where .Site.Pages "Section" "contributors") "Params.last_name" }} | |
{{ $yoyo := .Title }} | |
{{ if .Params.last_name }} | |
<h2>title: {{ $yoyo }} | last: {{ .Data.Prev }}</h2> | |
{{ end }} | |
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://discuss.gohugo.io/t/confusion-regarding-template-conditionals-and-strings/2042/5 | |
<div class="posticon"> | |
{{ if (not (isset .Params "mdrposticon")) | or (eq .Params.mdrposticon "") }} | |
<img src="/icons/default.png" /> | |
{{ else }} | |
<img src="{{.Params.mdrposticon }}" /> | |
{{ end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment