1

I wanna have a constant sidebar or footer that i can edit in the grav admin backend. Cant find any similar example on the web.

At the moment i have a normal page folder structure:

pages
 ├── 01.home
 ├── 02.contact
 └── 03.program

now i wanna include on each site the same footer or sidebar - which i can edit in the backend. My shitty solution for this is to implement a form in the template blueprint.yaml so that i add the footer and sidebar stuff in there.

But i think there is an better solution for this - which i cant find. I thought of such a partial or module which i can include in the template then.

Regards Karl

gustav
  • 336
  • 3
  • 12

2 Answers2

0

This is typically done via partials. Your theme should have a base file (in the partials directory) that contains a content block. This same file should also include other files such as your sidebar and footer.

Then, each template type should override the content block.

Jacobm001
  • 4,431
  • 4
  • 30
  • 51
0

My Open Course Hub Grav skeleton does this exact thing, where a Markdown page is used to store a global footer and sidebar.

For example, here is where I check and display Footer content: https://github.com/hibbitts-design/grav-theme-course-hub-bootstrap/blob/master/templates/partials/base.html.twig#L74-L77

And here is an example Footer Markdown folder: https://github.com/hibbitts-design/grav-skeleton-course-hub/tree/master/pages/footer

You can also download the complete Course Hub skeleton at https://getgrav.org/downloads/skeletons