I’m trying to limit the “Related Content” to the current section: “articles”. I have several sections (e.g. articles, course, podcast, newsletter, work, etc), and content from those sections are being included when I use this at the end of my “articles” template:
{{ $related := .Site.Pages.Related . }}
{{ with $related }}
{{ range . | first 4 }}
From what I gather, RelatedIndices
would get me there, but it would require keying off of something within the Frontmatter. I’d prefer to key off of the Section
, but I’m not sure how to do that, or if it is even possible.
I ran into a similar situation with my RSS feed (limiting the feed to just the Articles). I was able to solve this by limiting the range
like:
{{ range (where .Site.Pages ".Section" "articles") }}
Thanks for any pointers you might be able to provide!