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.

General

How to add default content on new page

Started by Nicolas RATEAU 8 years ago · 4 replies · 681 views
8 years ago

Hi everyone,

I have a small grav website that is basically a lyrics collection.
So everytime I need to put a new lyric in the collection, I'm creating a new page.
On each new content page (during editing in admin), I find myself doing again and again the same layout in order to have the same consistent presentation for all my lyrics.

Is there a way to put default content when creating a new page, in the content field ?

Hope I'm clear enough.

Thanks in advance for any help.

Panga.

8 years ago

Layout/style should be the responsibility of theme/templates and stylesheets and not the content.

Would you mind sharing what you are doing in the content field to get a consistent presentation?

8 years ago

Hi pamtbaau,

Thanks for replying here.

To explain shortly, here's how a page look like :

2018-09-16_23h11_30|690x466

To format this page, I used markdown as this :

2018-09-16_23h11_18|690x330

What I want, is a content area in the editor allready filled with this markdown layout (with dummy content) when I create a new page. This way I just have to replace the dummy content each time, without doing the markdown again.

Hope it's clearer this way. English is not really easy for me.

Thanks.

8 years ago

Hi @panga, you could do this by creating a custom blueprint and provide default content there. I do this exact thing with several of my themes, here is an example for you:
https://github.com/hibbitts-design/grav-theme-quark-open-publishing/blob/master/blueprints/item.yaml#L16

Most likely you will need to create an inherited theme and then there place your custom blueprint. More info:
https://learn.getgrav.org/themes/customization#theme-inheritance
https://learn.getgrav.org/forms/blueprints

You can also see a working example of both custom blueprints and an inherited theme with my Open Publishing Space skeleton https://getgrav.org/downloads/skeletons

👍 1
8 years ago

I can’t remember where, but there was an example somewhere that lets users use forms to add content without using the admin interface. Perhaps that is a viable alternative.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 82 12 hours ago
General · by pamtbaau, 17 hours ago
1 55 16 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 348 5 days ago
General · by Duc , 5 days ago
3 43 5 days ago