我想为我的 OJS 网站插入一个规范链接。我设法找到了 header.tpl,它看起来像这样:
{**
* 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}
我想添加一些代码块来指定我的网站的规范网址,所以我做了以下事情:
{**
* 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( '/' ) . '" />';
?>
上面的方法有用吗?或导致我的网站崩溃。有没有更好的方法来实现我想做的事情?我怀疑插件,但无法识别任何完成工作。我的网站是一个 OJS 网站。
感谢所有的帮助。