Hi!请登陆

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

2020-10-24 59 10/24

只保留关键字标签(description)与描述标签 (keywords)

先献上代码:

<?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="yijile" />
文章引用/pingback:<link rel="pingback" href="https://yijile.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://yijile.com/action/xmlrpc?wlw" />
Feed地址/rss2:<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="https://yijile.com/feed/" />
Feed地址rss旧版/rss1:
Feed atom(应该可以说是比rss2兼容性更好吧)/atom:

上面有提到当“=”后面没有内容就将值屏蔽了,如果“=”后面有内容就代替默认的

如:generator=Wordpress,那么前端调用后就是<meta name="generator" content="Wordpress" />

相关推荐