Currently pager plugins are disabled. But what if we need paged feed, e.g. for huge XML sitemaps?

E.g. on /sitemap.xml should be:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap.xml?page=0</loc>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap.xml?page=1</loc>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap.xml?page=2</loc>
   </sitemap>
</sitemapindex>

And on /sitemap.xml?page=* should be view generated by views_data_export.

What is recommended way to implement it?

Comments

Bobík created an issue.

WorldFallz’s picture

Did you ever figure out a way to page or otherwise limit potentially gigantic exports?

Honza Pobořil’s picture

Yes, I fixed it by myself, but our company did not released it publicly.

Solution was pretty simple:

  1. Create display plugin inheriting Views data export XML
  2. Turn off some not needed features like batch export
  3. In method alter SQL to COUNT rows or add LIMIT to page if page parameter is there
  4. In render method just cancel output and render sitemap index if query is COUNT

I do not remember if it is all. But I remember that recovering something of views pager's behavior was almost impossible.

Hope it help :-)