Open Graph implementation for subpages as parts

Hi.

I build my self a couple of page blocks, in a very similar approach to the One pager | Kirby CMS [Kirby Onepager in Cookbook] that is using Subpages as parts. I also wrote an individual social sharing button snippet. It’s all working nicely. Today I thought about the Open Graph Implementation for the articles. I would like to share the article title, author, link to article etc. not the once from the page holding the articles (the onepager like page).

Since open graph tags have to go in the head section, does anybody have a good idea how to share the og data of the article without having to send the visitor on an article specific subpage first.

If I understand correctly, all your posts are on a single page, but you want different OG settings for each post.

IMO, the only way to achieve this would be individual URLs for each page, either through a separate page for each post, or by through a parameter/query added to your main page.

Hey Sonja, sounds like you understood what I was trying to explain.

or by through a parameter/query added to your main page.

Is there a ressource you can point me to, where I can look up this concept to see if it could work?

In principle, this would work like filtering by tags, as explained for example here: Filter collections by tags | Kirby CMS

With the difference that you would not filter by tags, but most likely by the id of the post block. So this will mimic a single page, and your OG tags would be created individually, depending on the single post selected through the id parameter or query string.

1 Like