Joomla Template - 修改/添加 Meta Tag (Facebook Share)

.. Joomla 1.5 / 2.5 Template 内的:
<jdoc:include type="head" />
会加入默认的 <meta tag>,我们可以用以下 code 自由修改/添加 Meta Tags:
$mydoc =& JFactory::getDocument();

//edit <meta name="Description" content="XXX">
$mydoc->setDescription('MY_DESCRIPTION');

Facebook Share 用 meta tag:

$mydoc =& JFactory::getDocument();

//Add <meta property="og:title" content="XXX" />
$mydoc->setMetaData('og:title', 'MY_TITLE');   

//Add <meta property="og:site_name" content="XXX" />
$mydoc->setMetaData('og:site_name', "MY_SITE_NAME");   
           
//Add <link rel="image_src" href="xxx" />
$mydoc->addHeadLink( 'MY_IMAGE_URL' , 'image_src', 'rel' );
 
最后,你亦可直接修改 system source code:
Edit: libraries > joomla > html > html > behaviors.php




想在手机阅读更多Joomla资讯?下载【香港硅谷】Android应用
分享到Facebook
技术平台: Nasthon Systems