perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
855 stars 246 forks source link

Pagination Issue when Using Sitemap #171

Open deminy opened 10 years ago

deminy commented 10 years ago

I have a site that has tens of thousands of pages, with Boost enabled.

Today when I check the Sitemap page http://example.com/sitemap.xml I noticed there were only two links there.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://example.com/sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>http://example.com/sitemap.xml?page=1</loc><lastmod>2014-05-20T04:09Z</lastmod></sitemap>
<sitemap><loc>http://example.com/sitemap.xml?page=2</loc><lastmod>2014-05-20T04:09Z</lastmod></sitemap>
</sitemapindex>

When I clicked either link, I got exactly same XML content as above back.

A quick (and dirty) fix I made was like following

diff --git a/apps/drupal/drupal_boost.conf b/apps/drupal/drupal_boost.conf
index 5ae54bf..1c867a5 100755
--- a/apps/drupal/drupal_boost.conf
+++ b/apps/drupal/drupal_boost.conf
@@ -370,7 +370,7 @@ location = /rss.xml {

 ## XML Sitemap support.
 location = /sitemap.xml {
-    try_files $uri @drupal-no-args;
+    try_files $uri @drupal;
 }

 ## Support for favicon. Return an 1x1 transparent GIF if it doesn't

With above fix, now I can see 10k+ links on Sitemap pages like http://example.com/sitemap.xml?page=1 and http://example.com/sitemap.xml?page=2

A formal (and better) fix is appreciated. Thanks

parulsharma99 commented 8 years ago

Could you please let me know where you have made these changes. Your help is appreciated.

proteo commented 7 years ago

Just got this problem myself. I figured that the problem was this configuration after spending hours trying to find the problem in Drupal and even rebuilding the whole sitemap (+200,000 links, it took several hours) :|

@parulsharma99 I guess you don't need this anymore but for those coming here looking for a solution, you need to change the line mentioned by @deminy in the /apps/drupal/drupal*.conf file you've chosen according to the algorithm suggested in the readme.