-
Notifications
You must be signed in to change notification settings - Fork 272
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
Pagination Detecting Incorrectly #758
Comments
On inspection it looks like this well-meaning PR from @john-shaffer introduced an assumption of post pagination pages being prefixed with /blog: https://github.com/leonstafford/wp2static/pull/574/files Manually removed this and recompiled, which fixes the issue for my case. |
Apparently some sites have posts paginated under /blog/, while in others it's under /. I can't find any useful documentation about how to determine the prefix. |
That should be sorted in https://github.com/leonstafford/static-html-output/ it's a bit of a multi-step query with some extra logic thrown in to cover the |
Looking at this code again today while doing some test tidy up and it does stand out as weird to have the |
get_post_type_archive_link is probably the missing piece within |
last commit didn't quite hit it:
should have it sorted soon, now that I'm doing some testing within real site |
To simulate the custom "Blog" or other name, that you encountered @john-shaffer, I reproduced, by creating 2 x new Pages, "Homepage" and "Blog". I then set these to Then, we see the correct URL detected, in this case: I just need to fix the bad URL shown above, which is when |
Now looking better (missed a Without a Posts page set in WP Settings, detects:
With Posts page set to |
ugh, taking my time with this one :P was misunderstanding what I'm getting back from that fn. may opt for the one which gives either the posts url or false, as demo'd here in wp_cli's shell:
|
Both work fine for me, but I would suggest |
Sweet, will try combining the two, as I like the |
(without the get_permalink, the |
Put up some work in progress, currently at:
|
Fixed those disparate URLs by correcting the number of expected method calls in the unit tests. Lastly, for tests, need to fix the extra trailing slash on the Posts Page segment. Then check again in real site. |
Without Posts page defined:
With Posts Page defined:
|
So... one of the URLs in the tests isn't reflective of real WP case, will need to sort that out to produce same results as we're seeing in the WP site, then can fix failing tests and hopefully be done with it :D |
With Posts Page:
Without Posts Page:
Looking good! The incorrect URL in the test case was a pagination base with a leading Not a very sexy exercise to go through this, but good practice for me! Thanks for reporting and inputs y'all! |
Just noticed this:
For post pagination, live site is using
siteurl.com/page/1
but isn't being detected.What it is detecting though is
siteurl.com/blog/page/1
which doesn't exist and 404s on crawl.The text was updated successfully, but these errors were encountered: