我想为我的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}我想要添加一些代码块来为我的网站指定规范的url,所以我做了以下操作:
{**
* 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网站。
谢谢你的帮助。
发布于 2016-08-06 00:57:21
请注意,这是PKP支持论坛上发布的问题的副本,论坛中有一些进一步的讨论:
http://forum.pkp.sfu.ca/t/manually-insert-canonical-url-in-ojs-header-tpl/17415/4
https://stackoverflow.com/questions/38779059
复制相似问题