Auto Title For Different Subsection

Dear All

I have 3 section (blog, poem, quote) with several subsection inside poem section folder like this ->

/blog/ (blog posts with here) 

/poem/ (only here) 
|_ /2010/ (poem 2010 posts with here) 
|_ /2011/ (poem 2011 posts with here) 
|_ /2012/ (poem 2012 posts with here) 
|_ /and more... /

/quote/ (quote posts with here) 

On the single.html I added this part ->

<header class="entry">
<a href="{{ .Permalink }}">
<div class="center">
<h2>{{ .Section | humanize }}</h2>

It work for single post inside blog and quote folder. But for single poem inside 2010, 2011, 2012, etc, the header still display parent section (Poem), not subsection (Poem 2010, Poem 2011, Poem 2012, etc).

Here is the example ->

Any suggestion to fix? Also, how to make every header linking to every section and subsection? Because if I use <a href="{{ .Permalink }}"> (like my code above), it always linked to the current page?



From the docs: .Section returns

the first path element in the directory, for example, /blog/funny/mypost/ => blog .

Try .Parent instead.

Hugo has an example breadcrumb navigation:

Tried {{ .Parent }} but it returns to filepath, not parent.

.Parent would return the Page; use .Parent.Title if you want to use the title of the parent page.


Yes, finally it works with {{ .Parent.Title }} and {{ .Parent.URL }}

Thanks, @pointyfar :beer: