Okay, I’ve made my repo public so you can take a look.
Here’s what I want:
At /podcast/
I want every episode ever listed.
At /podcast/season-1/
I only want season 1 listed
Same for /season-2/
and /season-3/
, respectively.
The Problem:
Right now the /podcast/
URL returns correctly but seems to randomly pull the title and description from /season-3/_index.md
instead of from /podcast/_index.md
/season-2/
displays empty.
/season-1/
displays as a podcast episode page, instead of a list page.
Paginated interior pages off of /podcast/
seem to randomly pull titles and descriptions.
I’m really at a loss here.
Run hugo --printPathWarnings
WARN Duplicate target paths: /podcast/index.html (4), /podcast/index.xml (4), /podcast/page/2/index.html (4), /podcast/page/3/index.html (4), podcast/page/1/index.html (4)
The number (4) indicates that 4 pages are published to the given path.
Look at your permalinks configuration and compare it to the documentation .
That was half the battle!
Here’s how I got it to work:
In hugo.yaml
, I had the following:
permalinks:
page:
articles: /articles/:year/:month/:title/
section:
articles: /articles/
podcast: /podcast/
Replaced with the following:
permalinks:
page:
articles: /articles/:year/:month/:title/
section:
articles: /articles/
In layouts/podcast/list.html
I had the following:
<section class="w-full flex flex-col md:flex-row flex-wrap justify-around">
{{ $pages := where .Site.RegularPages "Section" "podcast" }}
{{ $pages = $pages.ByDate.Reverse }}
{{ range (.Paginate $pages 9).Pages }}
{{ .Render "summary" }}
{{ end }}
</section>
I replaced with the following:
<section class="w-full flex flex-col md:flex-row flex-wrap justify-around">
{{ $pages := .RegularPagesRecursive.ByDate.Reverse }}
{{ range (.Paginate $pages 9).Pages }}
{{ .Render "summary" }}
{{ end }}
</section>
Now everything displays exactly how I want.
system
Closed
April 10, 2024, 8:54pm
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.