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

Set meta headers by default

Started by Muut Archive 10 years ago · 12 replies · 808 views
10 years ago

Hello,

I know how to set defaults meta headers in the configuration site, but I don't know how to prefill the common meta in my FrontMatter header for all my pages. I dont want to c/v all my every-pages meta at each creation of a page...

Do you know how I can deal with it ?

Thank you
Arcturus Capture d’écran 2016-09-10 à 17

10 years ago

There is no way currently. Could be done with a plugin though.

10 years ago

Ok thanks, any suggestion for that plugin ?

10 years ago

Might be an interesting project. I'll tinker a bit.

10 years ago

Oh, so you're saying you'd want to set metadata by taxonomy? Like the same meta for all pages in a category or tag?

10 years ago

Obviously you can put meta tags in your templates, if they're truly global.

10 years ago

@rhukster So can you inject headers during the onBuildPagesInitialized event? Ideally I'd just inject the metadata headers into page header and let the core Grav system process them. I'll keep looking for a plugin that does something like that, but let me know if you know of one.

10 years ago

Ahh. Found Common\Page\Header API. We'll see how that goes.

10 years ago

My goal is simply having typical metadata (H1, image, etc.) add by default in the header markdown of each article to fill them ^^ no needs of a huge things. But thanks to you for your ideas and projects :D

10 years ago

Can you give an example of what you mean? "Metadata" usually means <meta> tags or the YAML at the top of the raw article file, but <h1> and <img> tags are neither of those things. If you want some sort of boilerplate to appear in each article, you can do that by modifying twig templates. Any example would be helpful.

10 years ago

Yes :) For each page I want the title be the <title> and I want to create a different "h1" for exemple. I want also set up manually Facebook markups or the Twitter ones. It's not convenient to set it in the twig template, because I want edit it for each page.

10 years ago

Ok nice but still, I just want that the admin panel just add this things in the frontmatter of each page :

title: "Things"
h1: "Things"
facebook-page: "things"

And not have to copy/paste it every time :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1361 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1123 9 years ago