【笔记】Meta标签学习笔记

前言

Meta标签学习笔记

Meta标签

关键字标注

  • 告诉搜索引擎该网页的关键字
1
<meta name="keywords" content="香蕉,苹果">

主要内容标注

  • 告诉搜索引擎该网页的主要内容
1
<meta name="description" content="水果百科">

索引标注

  • 告诉搜索引擎网页是否需要索引

content="":参数

none:搜索引擎忽略此网页,等价于noindex、nofollow
index:搜索引擎索引此页
noindex:搜索引擎不索引此页
follow:搜索引擎继续通过此网页的链接索引搜索其他的网页
nofollow:搜索引擎不继续通过此网页的链接索引搜索其他的网页

1
<meta name="robots" content="">

标注该网页作者

  • 通常后面也会有邮箱
1
<meta name="author" content="ZhangSan, [email protected]">

开发软件标注

  • 标注该网页是用什么软件编写的
1
<meta name="generator" content="notepad">

版本信息标注

1
<meta name="copyright" content="Xxx">

重访问标注

  • 如果页面不是经常更新,为了减轻搜索引擎爬虫为服务器带来的压力,可以设置一个爬虫的重访问时间。如果重访问时间果断,爬虫将按他们定义的默认时间访问
1
<meta name="revisit-after" content="10 days">

网页字符集标注

1
<meta http-equiv="content-Type" content="text/html;charset=utf-8">

缓存标注

  • 用于告知浏览器如何缓存某个响应及缓存多长时间

content="":参数

no-cache:先发送请求,与服务器确认资源是否被更改,如果未被更改,则使用缓存
no-store:不允许缓存,每次下载都需要去服务器上下载完整的响应
public:缓存所有响应,但并不是必须的
private:只为单个用户缓存,因此不允许任何中继进行缓存
max-age=60:表示当前请求开始,相应响应在多久内能被缓存和重用,而不去服务器重新请求

1
<meta http-equiv="cache-control" content="">

到期时间标注

  • 用于设定网页的到期时间,过期后必须到服务器上重新上传
1
<meta http-equiv="expires" content="Sunday 26 October 2016 02:00 GMT">

自动刷新标注

  • 网页将在设定的时间内,自动刷新并转向设定的网址
1
<meta http-equiv="refresh" content="5; URL=http://www.baidu.com">

网页过期标注

1
<meta http-equiv="Set-Cookie" content="cookievalue=tokenID; path=/; expires=Monday,31-Dec-18 10:00:00 GMT">

完成

参考文献

Web前端开发(初级)