rainlab/sitemap-plugin

Add support for multiple sitemaps, per theme

Opened this issue · 8 comments

This plugin only creates a single sitemap file....?

You need to update this to be able to create multiple sitemaps e.g.

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap1.xml.gz</loc>
      <lastmod>2004-10-01T18:23:17+00:00</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap2.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
</sitemapindex>

Interesting. Please provide a story where multiple sitemaps would be required, or justify why this is necessary.

A sitemap can have a max of 50,000 links so for example octobercms.com has a forum and so you would fill up the sitemap very quickly (hopefully) and then get stuck.

I was thinking maybe RainLab Blog and Forum plugins being able to create a separate sitemap for each category you create for example. This is something I need to code for one of my websites as each forum section - I have thousands of posts and so need to create many sitemaps.

~I am sure other people can suggest many ideas; but it's really useful to be able to create several sitemaps etc. thanks.

Sitemap limit: http://www.sitemaps.org/faq.html#faq_sitemap_size

We are aware of the protocol limit of 50,000 records, according to the Google guidelines it cannot exceed this amount any way. I'm still yet to see a compelling reason why this is needed.

Hard to give some reasons etc. Maybe someone else can suggest some input here.

Best idea I could suggest would be like this:

(octobercms forum)

News / Announcements (sitemap 1) => http://octobercms.com/forum/chan/newsannouncements
Feature Requests (sitemap 2) => http://octobercms.com/forum/chan/feature-requests
Help / Support (sitemap 3) => http://octobercms.com/forum/chan/october-helpsupport
etc.

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap1.xml.gz</loc>
      <lastmod>2004-10-01T18:23:17+00:00</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap2.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap3.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
</sitemapindex>

If I moved one of my vBulletin Forums over this is how I would set it up for Octobercms etc.

For Blogs I would setup different sitemaps for each of the category...

I guess could give a webmaster more control say Google bot has not crawled a section of their website and they want to send that section to Google webmaster tools to get it crawled etc.

Many reasons, but only if it's worth your time (of course) just a suggestion.

Another story/reason, say I add octobercms.com to Google News I would have to create two sitemaps then.

  1. A Google News Sitemap
  2. A Normal Sitemap

Search engines like Bing, Yahoo!, Yandex, Baidu, Naver etc can only crawl a normal sitemap and not a Google News, Images, Video, Mobile sitemap etc.

Google News sitemap: https://support.google.com/news/publisher/answer/74288?hl=en

Yes I see, to satisfy this feature, this plugin needs the following enhancements:

  • Add the ability to create multiple definitions; instead of default loading the definitions assigned to the active theme.
  • Sitemap definitions can make reference to other definitions as included items.
  • Add a checkbox list to the definition allowing multiple themes to be selected; one theme per definition.
  • When a definition is selected for a theme, it acts as the default/entry sitemap.xml
  • Other sitemaps can be assigned unique codes, available via sitemap.xml?code
  • Add an is_active boolean to control definition visibility.

@daftspunk do you still plan on implementing this?

This is much easier to implement as a theme template using the resources component and building nodes using Twig like any other navigation:

url = "/sitemap-two.xml"

[resources]
headers[Content-Type] = 'application/xml'
==
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" 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://mysite.tld/blog</loc>
        <lastmod>2022-10-10T00:14:00+00:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
    </url>
</urlset>