I am making a very simple product page for my site. With very little component development experience, I decided to build this page with Javascript only. The URLs will be like https://mystie.com/product?id=13367, where I use Javascript to get the product info from an outside JSON api:
$.get('https://jsonapi.url/?id=13367',function(product){ displayProductPage(product) }) For this page I use gantry's custom page and put a custom module on it, the function displayProductPage will render html for the product and append it to the custom module.
It's after I finished the html/css/javascript part when I realized I had missed one important thing: I need to set the meta tags according to the product id: og:image, og:description etc., so when people share the page Facebook will get the correct info of the product.
I've asked the same question in Gantry's github page but haven't got it solved yet.
So far, I've been able to find the PHP code to set the meta tag, I believe it's as simple as
$doc = JFactory::getDocument(); $doc->setMetaData('og:title', $link_title); I just don't know where to put these codes in my project.
PS: One quickest and simplest solution might be just put the PHP code in the custom module but I've never done that before. While waiting for answers I will be going through this option.