Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请求支持自动分割Sitemap以处理超过300个链接的站点 #35

Open
eden2f opened this issue Jul 28, 2024 · 1 comment
Open

Comments

@eden2f
Copy link

eden2f commented Jul 28, 2024

您好,Halo开发团队!

首先,非常感谢你们创建并维护了如此出色的博客框架。我在使用Halo搭建博客时遇到了一个关于站点地图(Sitemap)的问题,特此提出,希望能得到你们的帮助。

问题描述:

目前,许多搜索引擎平台在处理站点地图时,单个sitemap文件支持的链接数量上限通常为300个。然而,随着博客内容的不断增长,尤其是当博客文章数量超过300篇时,Halo默认生成的单个sitemap(位于站点根目录下的sitemap.xml)将无法包含所有页面链接,导致搜索引擎无法完全抓取和索引所有内容。

期望的解决方案:

鉴于上述问题,我恳请Halo官方考虑在后续版本中引入以下功能或提供解决方案:

自动分割Sitemap:根据链接数量自动将sitemap分割成多个文件(如sitemap_index.xml、sitemap1.xml、sitemap2.xml等),并在sitemap_index.xml中列出所有子sitemap文件的位置,以便搜索引擎能够发现并处理所有子sitemap中的链接。
配置文件选项:提供配置选项,允许用户自定义每个sitemap文件的最大链接数,以便根据不同平台的限制进行调整。
文档更新:如果实现了上述功能,请确保在官方文档中详细说明如何配置和使用这些新特性,以帮助用户更好地利用它们来优化站点的SEO。

影响与优势:

实现这一功能将大大提升使用Halo框架的博客在搜索引擎中的可见度和索引效率,特别是对于内容丰富的博客来说,这一改进尤为重要。此外,这也将使得Halo框架在SEO优化方面更加灵活和强大,吸引更多用户采用。

非常感谢你们对社区问题的关注与回应!期待你们的回复和更新。

@ruibaby
Copy link
Member

ruibaby commented Jul 30, 2024

感谢反馈,实现方案可以参考我们使用的论坛(Flarum)的做法,https://bbs.halo.run/sitemaps/sitemap.xml

进一步的建议:将 sitemap 列表按照数据类型进行拆分,其中可能出现过量的数据按照分页区分,比如:

sitemap.xml:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-categories.xml</loc>
        <lastmod>2024-05-06T07:17:15+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-tags.xml</loc>
        <lastmod>2024-05-06T07:17:16+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-posts.xml</loc>
        <lastmod>2024-05-06T07:17:16+00:00</lastmod>
    </sitemap>
</sitemapindex>

/sitemaps/sitemap-posts.xml:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-post-1.xml</loc>
        <lastmod>2024-05-06T07:17:15+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-post-2.xml</loc>
        <lastmod>2024-05-06T07:17:16+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>https://bbs.halo.run/sitemaps/sitemap-post-3.xml</loc>
        <lastmod>2024-05-06T07:17:16+00:00</lastmod>
    </sitemap>
</sitemapindex>

此外,也可以考虑结合 #31 实现。比如目前 Halo 的应用市场可能也会有生成 sitemap 的需求。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants