Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add differents meta tag every joomla article

I'd like to add facebook open graph tags in my joomla website. I edited index.php and add manually:

<head>
    <title>The Rock (1996)</title>
    <meta property="og:title" content="The Rock"/>
    <meta property="og:type" content="movie"/>
    <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
    <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
    <meta property="og:site_name" content="IMDb"/>
    <meta property="fb:admins" content="USER_ID"/>
    <meta property="og:description"
          content="A group of U.S. Marines, under command of
                   a renegade general, take over Alcatraz and
                   threaten San Francisco Bay with biological
                   weapons."/>

  </head>

In this way meta tags is applied to all my website pages.

How can I add different meta tags for every joomla article?

like image 794
Samm Avatar asked Dec 21 '22 14:12

Samm


2 Answers

A basic method of stitching the meta tags is explained in this article.

$opengraph    = '<meta property="og:title" content="'.$game->title.'"/>' ."\n";
$opengraph .= '<meta property="og:type" content="'."BLOG_replacewithyourtype".'"/>' ."\n";
$opengraph .= '<meta property="og:url"  content="'. $myabsoluteurl.'"/>' ."\n";
$opengraph .= '<meta property="og:image" content="'."http://YOURSITE.com/.../images/".$blog->imagename.'"/>' ."\n";
$opengraph .= '<meta property="og:site_name" content="'."YOUR SITE TITLE".'"/>' ."\n";
$opengraph .= '<meta property="fb:admins" content="'."YOUR FACE BOOK DEVELOPER CODE".'"/>' ."\n";
//add the tags to the head of the page;[/
$document->addCustomTag($opengraph);
like image 111
Wayne DSouza Avatar answered Dec 28 '22 09:12

Wayne DSouza


You can use one of the Open Graph Plugins for Joomla standard content if you like. Maybe like http://itprism.com/free-joomla-extensions/social-marketing-seo/open-graph-meta

like image 41
Mike Avatar answered Dec 28 '22 09:12

Mike