Thank you for creating an awesome plug in. I have been using it for awhile. It works well for my needs.
However, I encounter an issue, hopefully someone can help me out.
I have a Wordpress system with multi user. Everyone can create/update/delete content. At this time, if I run the WP2Static to generate static site, it will collect all the updates from all user and publish them. My question is:
Could I manually detect, crawl, process and deploy a certain url on my website?
For example, If I have 2 users updated 2 different pages (’/about us’ and ‘/contact us’), I just want to generate the static version for ‘/about us’ because it is ready and content is approved. I will add and generate the ‘/contact us’ page later to my static site.
I have read through WP2Static action but not sure where I should start to find a solution for my above issue.
Interesting question. There have been some requests to support individual landing page exports over the years and I’ve given some ideas on how that may work, but not really tried myself.
With modern WP2Static approach, if this is an ad-hoc thing, that you just need to export some pages and not others, I’d suggest using post-processing filters to either allow just what you want or exclude that which you don’t want to deploy.
One thing to keep in mind here, is any of WP2Static’s caching may not factor in that you’ve modified the deployment, so you may wish to disable/clear caches while doing this kind of thing.
Considering the whole process as a construction line in a factory, you’d be modifying the process at the end, when all the goods are packaged in the box and you just want to remove a bunch of things before it goes out for delivery. For this, probably look at the wp2static_post_process_complete action.
Because editing a single page has likely affected some static assets, like images, or a pagebuilder’s stylesheets/fonts, I think it’s safer to let everything be crawled/exported and just filter out the page(s) you don’t want included. Of course, if that page shares a link to an image which edits to the other page have changed, you start to introduce more possibilities for breakage.
Hopefully that gives some ideas. Let me know if any other questions.
I should note here, that for most deployment methods, there’s no deletion of files happening, ie with AWS S3. So, you could safely use this approach.
I’m not as certain with Netlify, where we send a digest of all files each time we deploy and it only transfers what’s needed. Not sure if they delete those filenames not included in the digest…
Thank you @leonstafford for your answer. I see your point here, so we just let everybody’s edit/update included in generating html but we will consider only deploy to S3 (in my case) any url we want.
Could you give me draft idea of which WP2static action I should use to archive the above goal?
Like how can I exclude an url when WP2Static S3 running deploy?
So, using that action above, I would modify the processed site directory (something like ./wp-content/uploads/wp2static-processed-site and remove the bits I don’t want. All the deployers build their deployment list from the physical files in that directory.
That also means, you can use other tools to do the deployment using that folder, like aws s3 sync from AWS’s CLI tools, if it doesn’t all need to be triggered via WP2Static (or you’re running WP2Static via it’s WP_CLI commands)
I guess no changes here since that?
I also need to export just a few landing pages (mostly as Pages in WP).
Was looking for a build-in filter or some recipe but here is the only one I found: just to export everything and after manually (with own script) delete not needed content? Am I right?
Will it help if I just uncheck Posts here Screenshot by Lightshot so WP2Static just exports only WP Pages? And if my landings have some content from /uploads, will it work?