Meta tags to show ONLY in head of site homepage

Hi everyone,

So, I have some Facebook meta-tags that I'd like to show ONLY in the <head> of my website's homepage and NOT on any other page. It is a SQL php driven site that uses a small, unknown CMS. I'm adding these headers so users can "like" my homepage and so that Facebook will consider the homepage as my "facebook page".

I'm trying this:


<?php
if (mysite.com) echo '
<meta property="og:title" content="mysite.com" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://mysite.com" />
<meta property="og:image" content="http://mysite.com/uploads/1327767957.jpg" />
<meta property="og:site_name" content="mysite.com" />
<meta property="og:description"
content="This is what we do. Blah blah blah." />
<meta property="fb:admins" content="0000001" /> ';
?>


The problem is that all of my deeper pages also contain mysite.com in the url, so the if statement makes the meta-tags display in the <head> on all pages of the site, not just the homepage.

Any idea how I can rework this to get the meta-tags to only display on the homepage of this site?


That would largely depend on the CMS and it's handling of templates, I would think. isn't there some hook in it to determine "main page"?

if (page=='home') {
// output these tags
}
0 Komentar untuk "Meta tags to show ONLY in head of site homepage"

Back To Top