How to have index in all page with Hugo-scroll theme

Hi, I’m a new and I’m happy to post my question here,

I build my hugo site with the theme “hugo-scroll”.

I made several pages in markdown, the problem is that when I navigate on these pages, I no longer have the elements of the index (which is a navbar in a way).

How could I do so that when I go to another page than the homepage the header is always present?

On the left the homepage with the header and on the right the page without the header with only a md.
I would like if it is possible to have the header also on the right page.

I hope I have been clear and I hope you could help me. Thank you !

I’m not sure how to do that specifically with that theme as for that I’d have to dive into the theme’s source. But, in general terms, you can create a file at layouts/partials/filename.html. This will create something like a reusable component. Then, you can use it in your layouts/_default/baseof.html as {{ partial "filename" . }}. Adding it in baseof.html will basically add the component on all pages, but, if you want it to appear only on your .md pages, you could use that line in layouts/_default/single.html.

Hope this helps!

1 Like

Thank you very much ! I’ll check it out and get back to you if it worked!

It’s very nice, single.html is the html of all md so it’s very easy to modify somethings.

Thank you very much !

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.