Display dynamic page content on every page?

I’m making a website for a local event (that happens monthly), and I want to have the date and location of the next event in the header and sidebar of every page. Having read the documentation, it doesn’t seem possible to have more than one kind of content in a template. Is there a way to do this?

It sort of depends where you are going to store and therefor read this event information.

If you are storing this in the page header of a specific page, you could create a small twig template that simply finds this page, and then gets those header values. So something like:

Assuming a page like this in /user/pages/event-page/default.md:

title: Next Event
date: 10/23/15
location: Maui, HI

and then some custom twig template you can include on every page:

{% event_page = page.find('/event-page') %}
<h2>Next Event</h2>
<p>Date: {{ event_page.header.date }}<p>
<p>Location: {{event_page.header.location }}</p>

Yep, this is pretty much what I was looking for, thanks! It’s a little unintuitive (to me, anyway) to look for other page data using the current page. I was expecting something more along the lines of Grav.findPage(’/event-page’)

There are a variety of methods on the Page object. As this method relates to page types specifically, it makes sense to encapsulate that logic in the Page object itself. Really it’s a personal preference of mine to keep like-functionality together :slight_smile: