Are there plans to add og tags and rich snippets?

Will “antimatter” have og tags and rich snippets added or is this something that should be added to a custom template?

I guess I’m not sure if this can be done as a plugin, or if its even worth it as a plugin since template files will need an override. It seems like a custom theme is the way to go.

I think added support for them is a good plan for Grav. That way you can use them if you wish to. However I don’t want to automate these as that is too limiting and we have had trouble doing this in the past. Right now they could easily be done via custom headers of the page and then the theme could be modified to output them if they are provided. I guess we just need to understand which ones are the key ones. Perhaps a pull request against antimatter?

Actually the more I think of it the more I think it should be done by a plugin. There’s really nothing theme specific here. Just need to think of the best way to inject these values into the template header.

I actually think a metadata plugin might work out pretty well for us. It could replace some of the existing metatag stuff we have in the themes, and also allow the easy addition of ObjectGraph and other metatags as needed without effecting the theme.

Of course until we have such a plugin, you can certainly achieve the required tags using custom headers and a custom set of meta tags in your theme.

I guess I can see a couple options there. Metadata is doable for the header for sure, but some of the microdata,, markup seems like it might need its own approach.

I guess if the focus of the og tags was either a metadata plugin or a social plugin, the facebook js and/or other scripts could be included as options as well.

yah, microdata is another kettle of fish. That is integrated into the content, and would need an approach more tightly integrated with the theme and the template files.

FYI, i already have a functioning plugin that supports all the basic metadata fields. I will add support for OG tags tomorrow. I think this can be part of 0.9.2.


Thanks Andy!

Ok so little update. I started doing this in a plugin and had it all working. However, I decided to refactor it into the Pages object in a pretty generic way to allow for the addition of facebook, opengraph, twitter, and even standard metatags to be set in site.yaml and also from page. Page of course overrides any defaults set in in the site configuration.

What this means is that you can manually set any of these metatags from the Page which is very useful. I can still see the need for a metadata plugin however. This plugin could automatically set things dynamically without the need to manually add them. I also moved the metadata HTML generation into a partial so this means you can override the output via twig too.

I think this is the most flexible system. Basically the functionality is there now to extend these tags even more and add completely custom ones if you need them, while still providing the core functionality in Grav.

This will be part of the immanent 0.9.2 release.

This is now available in 0.9.2 release. I will update the documentation tomorrow but an example is already in the announce blog post: