Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

New pages with default frontmatter

Started by Don Robertson 8 years ago · 2 replies · 2022 views
8 years ago

Hi - I have been trying out Grav, and there is one thing that I find a bit puzzling.

If I want to make a new page, I have to make a folder and an md file in that folder. Is there any way to do this automatically - as far as I can see, if you want to add a page that has a lot of meta information in the frontmatter, you have to either copy a file over manually, or use the admin plugin, then add the frontmatter manually in the Advanced panel.

Seems like a clumsy way to add a post to the site. Not easy for the non techies do do.

Is there an easier way?

8 years ago

Hi @dcrobertson, one option is to add default data into the blueprint for that page type in the theme in question. For example, here is how I do this in my Grav Open Course Hub project:
https://github.com/hibbitts-design/grav-theme-course-hub-bootstrap/blob/master/blueprints/item.yaml#L6-L18

In addition, you could also add a custom "Add Page" type button in the Admin Panel and along with this provide default data for a new page https://learn.getgrav.org/cookbook/admin-recipes#add-a-custom-page-creation-modal

So, for example here is my modified admin.yaml file:
https://github.com/hibbitts-design/grav-skeleton-course-hub/blob/master/config/plugins/admin.yaml#L48-L56

And here are my two linked blueprint files:
https://github.com/hibbitts-design/grav-skeleton-course-hub/tree/master/blueprints/admin/pages

Hope the above is of help.
Paul

8 years ago

Thanks for the info - I will take a look. I searched in the docs, but did not see anything. Probably staring me in the face - in 50pt type and using the 'blink' tag.

Cheers
Don

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 54 11 hours ago
Support · by Anna, 3 days ago
2 60 14 hours ago
Support · by Justin Young, 15 hours ago
1 30 15 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 57 5 days ago