I want to insert a canonical link for my OJS website. I managed to find the header.tpl and it looks like this:
{**
* templates/common/header.tpl
*
* Copyright (c) 2013-2015 Simon Fraser University Library
* Copyright (c) 2003-2015 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Common site header.
*}
{strip}
{translate|assign:"applicationName" key="common.openJournalSystems"}
{include file="core:common/header.tpl"}
{/strip}
I wand to add some block of code to specify the canonical url for my site so i did the following:
{**
* templates/common/header.tpl
*
* Copyright (c) 2013-2015 Simon Fraser University Library
* Copyright (c) 2003-2015 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Common site header.
*}
{strip}
{translate|assign:"applicationName" key="common.openJournalSystems"}
{include file="core:common/header.tpl"}
{/strip}
<?php
if ( is_front_page() )
echo '<link rel="canonical" href="' . home_url( '/' ) . '" />';
?>
Will the above work? or cause my site to break. Is there a better way to achieve what i want to do? I'm suspecting plugins but could not identify any to get the job done. My website is an OJS website.
Thanks for all the help.