php - 如何创建 sitemap.xml 来告诉 Googlebot 抓取更新的内容?

标签 php mysql xml rss sitemap

我的网站中有一个网址,显示最近更新的链接。

www.example.com/recent_update_post

在这个页面中,它包含大约 100 个链接,具体取决于每次更新的帖子数量,我是第一次使用站点地图。

所以我的问题是,这样做 Google 会抓取 www.example.com/recent_update_post 以及页面中的整个链接吗?

<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

   <url>

      <loc>www.example.com/recent_update_post</loc>

      <changefreq>hourly</changefreq>

      <priority>0.8</priority>

   </url>

</urlset> 

如果不是,这意味着每次我的内容发生这样的变化时我都必须动态创建xml文件?

<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

   <url>

      <loc>www.example.com/post/1</loc>

      <lastmod>2005-01-01</lastmod>

      <changefreq>hourly</changefreq>

      <priority>0.8</priority>

   </url>

   <url>

      <loc>www.example.com/post/2</loc>

      <lastmod>2005-01-01</lastmod>

      <changefreq>hourly</changefreq>

      <priority>0.8</priority>

   </url>

   ...


   <url>

      <loc>www.example.com/post/100</loc>

      <lastmod>2005-01-01</lastmod>

      <changefreq>hourly</changefreq>

      <priority>0.8</priority>

   </url>

</urlset> 

最佳答案

使用这个https://github.com/pawelantczak/php-sitemap-generator 此类可用于生成站点地图并通知搜索引擎更新。

关于php - 如何创建 sitemap.xml 来告诉 Googlebot 抓取更新的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30664211/

相关文章:

php - 在 linux mint 32 位操作系统中配置 xampp

php - 如何正确获取 Symfony 3 中的 EntityManager?

mysql - PostgreSQL 或 MySQL 中的默认选择顺序是什么?

MySQL Java 通过不同字段获取对象

php - 使用php备份和恢复SQL Server数据库

php - 使用 php 和 jquery 将数组值添加到 mysql 数据库

mysql - 如何在不违反唯一约束的情况下交换 MySQL 中两行的值?

java - 使用 XMLPullParser 解析数据时出现问题

java - 使用vtd-xml解析xml文件

java - 从互联网上获取 xml 提要并将其放入我的 Assets 中