concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Add an option to add OpenGraph meta tags to product pages #869

Closed mlocati closed 3 months ago

mlocati commented 3 months ago

What about adding OpenGraph metadata tags meta tags to product pages?

This improve the display of product pages when shared on social networks.

For example, pages shared on Facebook now show the product pictures (without the opengraph tags, Facebook picks the first image found on the page, which is the website logo in my case).

Here's a sample set of meta tags automatically added to the header_extra_content page attribute:

<meta property="og:type" content="product" />
<meta property="og:url" content="https://www.example.com/products/my-product" />
<meta property="og:title" content="My Product Name" />
<meta property="og:description" content="This is the product description." />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="My Site Name" />
<meta property="og:product:amount" content="123" />
<meta property="og:product:currency" content="EUR" />
<meta property="og:image" content="https://www.example.com/application/files/1234/5678/9012/image.jpg" />
<meta property="og:image:alt" content="My Product Name" />
Mesuva commented 3 months ago

My only hesitation with this is that I normally will handle OG tags within the theme, since a site might have blog posts and other things where the OG tags are important.

But it probably makes more sense to have Community Store handle this, since it's in charge of the product data. I guess the theme can elect to not output tags on product pages..

Mesuva commented 3 months ago

But I think you have an option to control it anyway - fantastic stuff

mlocati commented 3 months ago

Yep, the option is disabled by default (you can turn it on in the settings page)