php - set og tags for homepage only

Solution:
If you want to edit the template directly, here is a conditional check you can do to see if the homepage is being displayed:
(Assuming you are using Joomla 2.5 or 3.x. See this link for more info & other versions)
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo '<meta property="og:image" content="http://www.example.com/facebook.jpg" /> ';
}
?>
Ideally, you would create a plugin to add the meta tag to your HTML HEAD so updates to your template do not overwrite your changes.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: composer detected issues in your platform: your composer dependencies require a php version ">= 7.3.0".
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.