How to create a custom template page

Hi all

I’ve looking to create my own custom template page. A page that I could use the top section where you’d normally add a title or body classes, I could have my own inputs.

Would it be best to copy and mod an existing one, also what would be the best way to go about it?

Thanks for the time.

Hi all

to be a little more specific, what I’m trying to create is custom template page called video, I would then like to have a few custom headers that I could use to specify some details of the page, like a link to the video, sizing and so on.

How would I go about creating this?

Thanks again.

Hopefully this is not too late of a reply for you @daredevil. What I would say is there are probably quite a few ways to do this. I’d say the fun (and sometimes frustrating) part of Grav that you have so much flexibility.

Most of what you want to do is pretty well documented and that’s also one of the great things about Grav I think. So you’d likely want to look at this Page File information and template information. And you’d definitely want to read the entire Themes section of the documentation.

But I’ll detail quickly what I’d do to hopefully give you a head start… I’d create a new page template, let’s just call it “custom” though you may want to name it more specific to the job it will do, ie. “portfolio”. So you’d now have template file called custom.html.twig. Now create the page you want to use that template and create a markdown file in the page folder called custom.md which will ensure that page uses the page template of the same name.

Now in that custom template you’d use the extends functionality like so: {% extends 'partials/base.html.twig' %}.

And then you can overwrite the “blocks” in the base template (hopefully the base theme you are using has proper block setup so that you can overwrite just the parts you want).

Sorry about the late reply but thanks for much for this, it’s definitely a head start, at least now I know where to start.