Skip to content

In Progress: Remove post limit on sitemaps#5394

Closed
nbloomf wants to merge 106 commits intoAutomattic:masterfrom
nbloomf:master
Closed

In Progress: Remove post limit on sitemaps#5394
nbloomf wants to merge 106 commits intoAutomattic:masterfrom
nbloomf:master

Conversation

@nbloomf
Copy link
Copy Markdown
Contributor

@nbloomf nbloomf commented Oct 21, 2016

Addresses #3314: Remove 1000 post limit on sitemaps.

Changes proposed in this Pull Request:

Replace sitemap generating code.

Testing instructions:

  1. Create a few test posts and upload some images.
  2. Activate the sitemaps module of Jetpack.
  3. Go to "example.com/news-sitemap.xml".
  4. Go to "example.com/sitemap.xml". (It may take a refresh or two the first time.)

Note that sitemap.xml links to two other files; one is the root of a tree of sitemaps for pages, the other is the root of a tree of sitemaps for images.

These changes allow for arbitrarily large sitemap trees per the spec. To test this functionality without having to create an arbitrarily large site, adjust the constant SITEMAP_MAX_ITEMS in modules/sitemaps.php, (5 is a good value.) This constant determines the maximum number of URLs on a single sitemap, so that if it's set to 5 and we have 6 posts then the tree structure kicks in.

The constant SITEMAP_INTERVAL is the minimum number of seconds between rebuilds; it's currently set to 60 for testing.

We reuse the filter jetpack_sitemap_post_type to allow plugin authors to include custom post types in the sitemap.

Proposed changelog entry for your changes:


@nbloomf
Copy link
Copy Markdown
Contributor Author

nbloomf commented Nov 1, 2016

Hmm... the WordPress 404 means that the URL intercept callback isn't working. My dev environment has PHP 7.0.11; tomorrow I will try using 5.6 and lower to see if I can reproduce the error.

The permalink settings shouldn't have an effect - the module hijacks the usual routing process on sitemap URLs.

@nbloomf
Copy link
Copy Markdown
Contributor Author

nbloomf commented Nov 2, 2016

@eliorivero : I think I found the reason why the module wasn't working for you. When you get a chance, see if it's working in the latest commit.

BTW, I think I messed up the commit history by merging Automattic/jetpack:master back into this branch and then reverting the merge. Never mind I don't know what I'm doing

@nbloomf
Copy link
Copy Markdown
Contributor Author

nbloomf commented Nov 3, 2016

I have messed something up while trying to merge commits back from Automattic/jetpack:master and now this repo is broken. I will open a new PR with a fresh fork. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Sitemaps Trial Project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants