【转】meta标签的使用

在HTML里大致包括头部信息、基底信息、元信息等
在html的头元素中是以结束的,一般情况下,里有titile标题、css样式、javascript脚本、meta描述等
title大家应该很清楚了、就是对网页标题的描述,现在从meta开始说
我们在做seo的时候,经常会提到关键字,好有利于网站被搜索引擎给抓到
会被提高网站的搜索率。那我们需要怎么做呢?
答:用meta标签。

META:

1、
<meta name="keywords" content="关键字">
这里的name属性为keyname(不能修改,meta的name的值是固定的那几个),keyname就是设置网页关键字的值
content就是定义了是哪几个关键字。不同关键字需要用逗号隔开

2、
Meta除了设置关键字,还可以设置页面的描述,也有利于网站被搜索引擎的抓取
可以用他来描述网站的主体什么的
<meta name="description" content="页面描述">
这里description的意思就是设置页面描述的元素,然后在content里具体描述

3、
在我们用软件来写网站的时候,软件一般都会在头里添加一个meta标签。细心的人一定会发现。
<meta name="generator" content="编译器名称">

4、
Meta设置作者信息,你在网上发布代码的时候,总想让别人知道这段代码是你写的

那总不能在网站里写<h1>by:Black-Hole</h1>不知道装逼会被打么,所以最好的方法就是在meta里说明下
低调奢华有内涵,还高大上
<meta name="author" content="作者名">

5、
Meta还可以限制搜索引擎来对页面的搜索,比如后台,我不想被搜索引擎给搜索到,这是就可以用meta来设定了
<meta name="robots" content="搜索方式">
<meta name="robots" content="搜索方式">
Robots就是来设定搜索方式,content就是来详细描述搜索方式
这时的content不能随便写,他又固定的几个值:
All: 能搜索到当前网页及其连接的网页
Index: 只能搜索到当前页面
Nofollow:不能搜索当前网页连接的网页
Noindex: 不能搜索当前页面
None:不能搜索当前页面及其连接的网页
我直接在后台页面加个<meta name="robots" content="noindex">麻麻再也不用担心
我被搜索到了,当然,你也可以用robots.txt来指定

6、
用meta来设置当前来页面的文字,这里有两个方法。
<meta http-equiv="Content-type" content="text/html; charset=gb2312">
<meta http-equiv="Content-language" content="zh_CN">
http-equiv用来设置http通信时的标头,content则是具体这些标头内容。
下面是实例代码,这个是我博客的写法、贴出来供大家参考
<html lang="zh-cn" data-lang="zh-cn" data-template="default"> <!--<![endif]-->
<head>
 <title>技术分享、分享我的技术-dwtedx个人博客</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="keywords" content="技术文章,it技术学习网站,it技术分享,it技能有哪些" />
 <meta name="description" content="dwtedx个人博客,不仅仅是个人博客、加入我的博客、
 你的专属个人地盘、深度为程序员量身订作、一个可讨论技术,可分享技术,
 把自己掌握的技术与业内其它哥们分享也是一种美、可留言互动的平台、期待你的加入、、、" />
 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
 <meta name="author" content="dwtedx,qinyoulong">
 <meta content="index,follow" name="robots" />
 <meta content="Copyright 2017 All Rights Reserved." name="copyright" />
</head>
<body>
 这个是你网站的正文
</body>
</html>

原文转自http://dwtedx.com/itshare_165.html


Popular posts from this blog

Fancyapps — easily build overlay windows with carousel

Meet Mantine: A TS-Based Open-Source React Components Library

Meet Tippy.js: The Complete Tooltip Popover Plugin