Pagination Issues with wp2static and lokl

Hello.

I am new to static generators so maybe my questions are stupid but I want to ask for some help.

Situation: I installed Lokl. Created a new wordpress, imported some posts and the theme from my production wordpress site and everything looks and works perfectly in localhost:port

I activate the zip deployment, set up the name of the static site and run wp2static. I copy the file to a static server in aws, unzip it and try to load the site.

Problem 1: Post pagination doesn’t work. Wp2static is looking for /blog/ as a prefix for pagination.
Solution: I modify DetectPostsPaginationURLs.php to remove the /blog/prefix

Problem 2: Post pagination in tags and categories doesn’t work. Apparently wp2static generates a /tag/TAGNAME/page/number file, instead of a /tag/TAGNAME/page/number/index.html file. So when I access to /tag/margout-darko/page/2/ I get a 404 error.
Solution: If I access to /tag/margout-darko/page/2 (without the trailing slash) the file exists and it works, but all links generated by wp2static for tags and categories have a trailing slash :confused: . So I fixed it with some RewriteRules that remove the trailing slashes in categories and tags urls.

Problem 3: I have a lot of links to localhost:4315 in the wp2static generated zip. Really a LOT. Most links go properly to the Deployment URL, but there are thousands to the static url. After some research I find that all this wrong links are in pages of categories and tags (except the first one).
Solution: Not solved.

I tried deactivating all plugins except the wp2static related ones with the same result.

If anyone can help me a bit with this situation or point me in a direction where i can research about what is happening, I will appreciate it a lot.

Thanks!

Zor.

1 Like

Hi @zor,

Thanks for giving it a try and sorry for the issues!

With WP2Static, there’s been some recent effort by @john-shaffer with the Advanced Crawling Add-on. I haven’t published a release for that yet, as it’s currently working only with 7.1.6 of WP2Static, not the latest from source code. That may help some of the issues.

Within Lokl, there’s also the Static HTML Output plugin (maybe not in the PHP 8 Lokl instances, as some work needed for compatibility fixes). That plugin handles detection and crawling differently than WP2Static and should sort out those failed rewrites and pagination issues.

host:port rewriting was tested a lot more (with automated test coverage) in Static HTML Output, where I haven’t got any such automated tests in WP2Static yet, so confidence in rewriting is lower. That said, many users are able to get site exports happening without issue, so it seems to be case by case if the site structure is lucky to allow it to work smoothly.

I’m slowly but surely working on improving the quality across the board, so things will continue to improve. Failing all that, there are some alternatives listed to try.

Thanks again for sharing the experience and I hope we can get exports running smoothly for you soon!

Thanks so much for the super fast answer!

I will check the advanced crawling add-on and definitely try the Static HTML Output.

I was also considering a quick and dirty sed script for fixing the localhost url problem :slight_smile:

Is there any recomendation or defined workflow for wp2 static? I have seen people deploying to S3 and Netlify, and i am just planning to scp the file to an AWS instance with apache2, maybe even using lsyncd to automate it…

Thanks for the amazing work. I am surprised your plugin/system is not much more popular!!!

Zor

1 Like

S3 + CloudFront tends to be best for performance.

Netlify is great for quickly getting a site up.

Both offer CLI syncing tools which will only deploy the changes (as their addons in WP2Static should do).

It should be/aims to be flexible enough for you to bend into your ideal workflow, so what you’re preparing sounds great! WP2Static has more hooks and easier to drive via WP_CLI / custom functions.

Retweet this one to help spread the word about this still very unknown way to deal with WP!

Exports running fast and smoothly. Was very easy to solve, thanks to your help. I just added comments through telegram using comments.app.

Next step is to try s3 + cloudfront!

1 Like

Great to hear, @zor! Thanks for reporting back!

And I hadn’t heard of Comments.app, looks very handy!