本文介绍将网站地图sitemap提交给搜索引擎。

1. 生成sitemap

(1)使用现成工具

网上有不少工具可以在线生成网站地图sitemap,比如Create your Google Sitemap Online - XML Sitemaps Generator。输入网站URL,便可生成sitemap,以下是生成的部分结果。

<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

<url>
  <loc>https://dianyao.co/</loc>
  <lastmod>2022-04-12T14:14:53+00:00</lastmod>
  <priority>1.00</priority>
</url>
<url>
  <loc>https://dianyao.co/index.html</loc>
  <lastmod>2022-04-12T14:14:53+00:00</lastmod>
  <priority>0.80</priority>
</url>
<url>
  <loc>https://dianyao.co/about.html</loc>
  <lastmod>2022-04-12T14:14:53+00:00</lastmod>
  <priority>0.80</priority>
</url>

</urlset>

然而,xml-sitemaps.com生成的sitemap,只包含了url所在页面的链接,并没有遍历整个网站的链接。

(2)自己写代码生成

我新的网站,大部分内容组织成GitBook,写个简单Python脚本,找到所有链接,并按上述的格式生成sitemap。

2. 上传sitemap文件

将sitemap文件上传到网页服务器,通常放在网站的根目录,比如我的:

https://dianyao.co/sitemap.xml

3. 提交sitemap

(1)百度

进入百度搜索资源平台,点击搜索服务 --> 普通收录 --> 资源提交 --> sitemap,填写sitemap的url --> 提交。如下图所示:

baidu-sitemap

(2)Bing

Bing Webmaster Tools,登录,验证网站,点击左侧网站地图,提交网站地图,如下图所示。

bing-sitemap

(3)Google

Google Search Console,登录,验证网站拥有者,添加TXT记录,主机记录为@,记录值为google-site-verification=...。添加sitemap,如下图所示。

google-sitemap

本文系Spark & Shine原创,转载需注明出处本文最近一次修改时间 2022-04-13 22:32

results matching ""

    No results matching ""