I am trying to add title / text in general to the sidebar of this page: Show your work! | GeorgeKan but I cannot get it to work. I set the title in the index.md file in the folder but that did not work. Also made sure to remove the title configuration from the _index.md file in the folder above but again did not help. Why is the title from the index.md sidebar not shown?
The theme I am using is Hugo Apero: GitHub - hugo-apero/hugo-apero: Apéro is a Hugo theme for personal websites. A Hugo theme you'll want to hang out with . This is the source for the theme files to install.
I am new to this but I have searched and tried different configurations to change this (unfortunately with nothing to show for it) Any help or hint would be great.
The page in question is rendered by:
themes/hugo-apero/layouts/project/single-sidebar.html
which calls:
{{ partial "shared/sidebar-scaffold.html" . }}
which calls:
{{ partial "shared/sidebar/sidebar-header.html" $section }}
which contains:
<!--section level-->
{{ with .Params.sidebar }}
{{ with .title }}<h1 class="f3">{{ . | markdownify }}</h1>{{ end }}
{{ with .description }}<p class="f6 lh-copy measure">{{ . | markdownify }}</p>{{ end }}
{{ with .author }}<p class="f7 measure lh-copy i mh0-l">Written by {{ . | markdownify }}</p>{{ end }}
{{ end }}
Notice that the context passed to sidebar-header is the current page’s section, not the current page itself.
That means that sidebar.title
, sidebar.description
and sidebar.author
defined in content/books/show_your_work/index.md are never read (ignored).
Thank you very much that is very helpful! (Ok I did not manage to go this far on my own )
In order for me to change this configuration, would I need to add a page level configuration in the same file?
If it were me, I would reach out to the theme author for guidance.
However, if you want to experiment:
mkdir -p layouts/partials/shared/
cp themes/hugo-apero/layouts/partials/shared/sidebar-scaffold.html layouts/partials/shared/
and change layouts/partials/shared/sidebar-scaffold.html from:
{{ partial "shared/sidebar/sidebar-header.html" $section }}
to:
{{ partial "shared/sidebar/sidebar-header.html" $page }}
But I don’t know what this would break…
Well naturally I went and did your recommendation For the time being nothing has broken and I managed to put the text I wanted in there. Thank you very much for the help!
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.