Typecho是默认所有链接都在当前窗口打开,个人认为这样挺不适合阅读以及增大跳出率,所以本人修改为“弹出新窗口”,有了这个,再也不需要每个链接都加“target=_blank”。
- 让评论者的主页在新窗口打开
首先打开\var\Widget\Abstract\Comments.php这个文件。找到第376行(或附近):
echo '<a href="' , $this->url , '"' , ($noFollow ? ' rel="external nofollow"'
: NULL) , '>' , $this->author , '</a>';
替换为
echo '<a href="' , $this->url , '"' , ($noFollow ? ' rel="external nofollow"'
: NULL) , ' target="_blank">' , $this->author , '</a>';
- 让文章里的链接在新窗口打开
打开/var/CommonMark/HtmlRenderer.php文件,找到104行
case CommonMark_Element_InlineElement::TYPE_LINK:
替换为
case CommonMark_Element_InlineElement::TYPE_LINK:
$attrs['href'] = $this->escape($inline->getAttribute('destination'), true);
$attrs['target'] = $this->escape(_blank, true);
if ($title = $inline->getAttribute('title'))
{
$attrs['title'] = $this->escape($title, true);
}
此文仅作为备份。
最新评论
博主,我想问一下如何更新缓存啊?我更新了头像,迟迟不能更新
谢谢楼主,2023年11月,极1S安装成功。
你好,方便了解下wp的这个主题么,非常适合码字,看footer没有搜到,有参考或者分享么,谢谢。
不太清楚站长的情况,我把UA含有Apache-HttpClient字段的访问拦击了,文章被爬虫自动抓取发布的情况就大幅好转了。
哈哈,以上都不好用,鉴定完毕!
换服务器了?
博主觉得那家好用