1

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.

Selase
  • 175
  • 5
  • 24

1 Answers1

0

Note that this is a duplicate of a question posted on the PKP support forum, which has some further discussion:

http://forum.pkp.sfu.ca/t/manually-insert-canonical-url-in-ojs-header-tpl/17415/4

asmecher
  • 1,055
  • 7
  • 12
  • Hi @asmercher: Alec, I didnt quite understand the response on PKP support forum. I didnt know what i was supposed to do to get the canonical url issue resolved. The above code snapshots shows what my header.tpl page looks like. I'm guessing i will only need to include `;` so as to specify the default link for the website as [link](http://ijmasr.com) . Can you please confirm if that will work or if there is something else i need to do? – Selase Aug 07 '16 at 15:59