Dynamic page/content routing

Is it possible to use Grav for dynamic content in the more traditional PHP type way?

So a master page with links and the links would take you to a page which pulls in the dynamic content eg. page.php?id=1 etc.

Using Grav, you would either have to automatically generate the individual pages or the more likely option would be to use url routes.

Any ideas, is this possible or is Grav not the right tool for the job here?
Thanks

Do you mean something like Grav’s modular pages?

Hi, I don’t think so, unless I’m missing a way these could be utilised.

Can you be more specific, then, about what exactly you’re trying to accomplish? Grav plugins certainly can be used to generate content (e.g., shortcodes). I just can’t tell from your initial post what your specific use case is.

Thanks for your patience, I realise I probably hadn’t explained my self very well, I’ll try now :slight_smile:

I’m looking to use the youtube api to pull in playlists to create lists of thumbnail links on my master page. The thumbnails would then link to a video player page containing the relevant video and content.

I’m relatively new to Grav and haven’t delved into the likes of building plugins yet. With my current level of understanding I would approach this by creating a page for each video and then using a collection on the master page to link to them. My aim is to find a way where I don’t need to create a new page for every video. I’m looking for a more automated process using a dynamic page to display each video. The thumbnails would link to the video player page and pass an id to pull in the relevant video content.

eg.
videopage.php?videoid=1
videopage.php?videoid=2
videopage.php?videoid=3

Ultimately these urls would need to be made pretty by using the video title for example.
Hope that makes a little more sense.

Thanks!

To actually embed a video, use the YouTube plugin already available.

If the URLs of the video are known, you could put them in the frontmatter of the page and the twig can iterate through them and display multiple videos.

You could also create a single generic viewer page that accepts a query parameter that you pull in and display.

Hi bobwal,

I think you might be looking for the flex directory plugin: https://github.com/trilbymedia/grav-plugin-flex-directory