typehco自定头部header信息义

首页keywords和Description内容:使用这样的代码,可以自定义相关header内容:

<?php if($this->is('index')): ?>
<?php $this->header('description=介绍内容。'); ?>
<?php else: ?>
<?php $this->header(); ?><?php endif; ?>

彻底删除Typecho模版中程序版本号、模版名称等多余Meta标签

<?php $this->header('generator=&template=&pingback=&xmlrpc=&wlw=&atom=&rss1=&rss2='); ?>

请替换模版中<?php $this->header(); ?>,考虑SEO友好所以保留description及keywords如果其它有需求可以自行保留比如rss,一般都会在界面增加rss按钮一般可以为浏览器等工具提供探测。

基本用法:

keywords= (表示替换keywords标签内容,当"="后面没有内容则表示屏蔽调用,也就是删除)

& (处理多个时用到,如果有下一个需要屏蔽放下一个前面区隔开就可以了)
值解释:

内容描述/description: <meta name="description" content="随意" />
关键字/keywords:<meta name="keywords" content="随意" />
程序信息/generator:<meta name="generator" content="Typecho 0.9/13.12.12" />
模版名/template:<meta name="template" content="abc" />
文章引用/pingback:<link rel="pingback" href="https://abc.com/action/xmlrpc" />
离线写作接口/xmlrpc:<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://yijile.com/action/xmlrpc?rsd" />
离线写作接口/wlw:<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://abc/action/xmlrpc?wlw" />
Feed地址/rss2:<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="https://yijile.com/feed/" />
Feed地址rss旧版/rss1:<link rel="alternate" type="application/rdf+xml" title="RSS 1.0" href="https://yijile.com/feed/rss/"; />
Feed atom(应该可以说是比rss2兼容性更好吧)/atom:<link rel="alternate" type="application/atom+xml" title="ATOM 1.0" href="https://yijile.com/feed/atom/"; />
上面有提到当“=”后面没有内容就将值屏蔽了,如果“=”后面有内容就代替默认的

如:generator=Wordpress,那么前端调用后就是<meta name="generator" content="Wordpress" />
这样就伪装为wp了

文章由官网发布,如若转载,请注明出处:https://www.veimoz.com/220
0 评论
2.7k

发表评论

!