How to set og:image only for Home page?

Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Fri Mar 24, 2017 9:10 pm
Reply with quote
Report this post
Hi,
on this page ( http://mnt.mk/ ) the og:image is always the first image from the slider. How can I put static, fixed image for the homepage only?

Thanks,
Gorast
User avatar
Platinum Boarder

teitbite
Wed Mar 29, 2017 9:21 am
Reply with quote
Report this post
Hi

Easiest will be to add this code to /layout/blocks/head.php

Code: Select all
<?php
if( JRequest::getVar('Itemid') == ID_OF_YOUR_HOMEPAGE ):
    print '<meta property="og:image" content="URL_TO_STATIC_IMAGE" />';
endif;
?>
User avatar
Moderator

GK User
Sun Jun 04, 2017 12:25 pm
Reply with quote
Report this post
Worked like charm.
I added || and the rest of the menu items just to cover it.
This makes me thinking of trying to make plugin so admins can upload custom images for menus :D

Thanks,
Gorast
User avatar
Platinum Boarder

teitbite
Wed Jun 07, 2017 8:05 am
Reply with quote
Report this post
Hi

This is not a bad idea :) Such question was asked couple of times already, so it sure be useful to some people.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.