常见META标签和针对SEO优化的设置

META在网页上是不可见的,它提供了网页的元数据,但是在机器上是可读的。因此常用来进行SEO优化

下面首先介绍常见的META标签

META有两个属性:http-equivname属性

http-equiv

相当于http的作用,定义一些http参数

<meta http-equiv='' content=''>
content-Type--设置网页字符集
<meta http-equiv='content-Type' content='text/html;charset=utf-8'>
<!-- 但是以上方式目前不推荐使用,最好使用h5方式 -->
<meta charset='UTF-8'>
X-UA-Compatible--浏览器使用哪种版本渲染页面
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
cache-control--指定请求响应遵循的缓存机制

content可以有其他值:max-age、no-store、public、private、nositeapp(禁止百度转码)

<meta http-equiv="cache-control" content="no-cache"> 
expires--网页到期时间
refresh--自动刷新并转向指定页面
<meta http-equiv="refresh" content="2;URL=http://www.baidu.com/"> //意思是2秒后跳转向百度首页
Set-Cookies--设置cookie,如果网页过期,那么这个cookie也会自动删除

name

主要用于描述网页,比如关键词等。content作为name的描述信息

keywords--设置网页的关键字
<meta name='keywords' content='girl,beauty'>
description--网页内容的描述
<meta name='description' content="concentrate on girls' beauty">
viewport--移动端视口
robots--定义搜索引擎爬虫的搜索方式

具体参数:

  • none        搜索引擎忽略此页面
  • noindex         搜索引擎不索引此页面
  • nofollow        搜索引擎不索引当前页面链接关联到的页面
  • index             搜索引擎索引此页面
  • follow             搜索引擎索引当前页面链接关联到的页面

以上三者都是对SEO优化其作用的配置,还有<title>标签,设置网页的标题,也对SEO优化起作用

原文地址:https://www.cnblogs.com/ashen1999/p/12742455.html