Is there a way to set default Parent Page and Page File when adding new pages in the Admin Panel? For a blog, I would set default to Home and Item.
There is no way currently although that is an interesting idea… If you can add it to the Grav Admin plugin issues list, i can make sure it stays on the radar: https://github.com/getgrav/grav-plugin-admin/issues
Thanks!
Is this possible now, with the latest updates? For my usecase I want to have a default settings for Add Page to select a specific Parent Page and Page Template. Then have the frontmatter area pre-defined but empty on the page template.
Yes add a default.yaml in your template’s blueprints/
folder, like
title: Default
'@extends':
type: default
context: blueprints://pages
form:
fields:
tabs:
type: tabs
fields:
advanced:
fields:
overrides:
fields:
header.child_type:
default: item
header.visible:
default: 0
thanks for that info, I’m not sure where to add a blueprint.yaml exactly. Is this documented somewhere so I can read and use it all properly?
I’m reading the blueprints area now of manual, if you have a specific page or link with more specific details please share.
Put that snippet above in user/themes/[yourtheme]/blueprints/default.yaml
, it should work automatically - in Grav 1.1
thank you!
that didn’t work for what I wanted but the example and further reading in manual helped me figure it out. so I added two lines in the /user/plugins/admin/blueprints/admin/pages/new.yaml
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
data-default@: '\Grav\Plugin\admin::getLastPageRoute'
default: '/home'
and
data-options@: '\Grav\Common\Page\Pages::types'
#data-default@: '\Grav\Plugin\admin::getLastPageName'
default: 'post'
---
Oh yes, to edit the defaults in the “New page” modal, that’s the way.