文章也可重定向

This commit is contained in:
Skywt2003 2021-11-19 15:04:31 +08:00
parent 16fccc7110
commit e4bd872b6d
2 changed files with 5 additions and 1 deletions

View File

@ -45,7 +45,7 @@ function themeFields($layout) {
$pageIcon = new Typecho_Widget_Helper_Form_Element_Text('pageIcon', NULL, NULL, _t('页面图标'), _t('仅对非隐藏页面有效。在这里为页面填入一个 fontawesome icon 代码在菜单栏链接前会显示图标。Fontawesome 是 5.15 版本,参见 <a href="https://fontawesome.com/v5.15/icons" target="_blank">FontAwesome 图标库</a>。留空则不显示图标。'));
$layout->addItem($pageIcon);
$linkTo = new Typecho_Widget_Helper_Form_Element_Text('linkTo', NULL, NULL, _t('页面重定向至'), _t('仅对页面有效。在这里输入一个 URL打开该页面时会自动重定向到这个 URL用于定制菜单栏。留空则不重定向。'));
$linkTo = new Typecho_Widget_Helper_Form_Element_Text('linkTo', NULL, NULL, _t('重定向至'), _t('在这里输入一个 URL打开该页面或文章时会自动重定向到这个 URL可以用于定制菜单栏。留空则不重定向。'));
$layout->addItem($linkTo);
}

View File

@ -1,6 +1,10 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
<?php if ($this->fields->linkTo): ?>
<script type='text/javascript'>window.location.href = '<?php echo $this->fields->linkTo ?>';</script>
<?php endif; ?>
<div class="col mt-5" id="main" role="main">
<article>
<?php if ($this->fields->headPic !=''): ?>