Hi,
I have a question regarding post processing;
- is it possible to remove not needed files e.g. in theme directory like package.json
Thanks,
Robert
Hi,
I have a question regarding post processing;
Thanks,
Robert
Hi @rkleinert,
There’s a few ways to handle this at the moment, with easier methods coming into the plugin soon.
In the Static HTML Output project, we no longer detect a mass of unused files from themes/plugins when starting the crawl. This will get applied into WP2Static in future versions.
All plugins should support some management of exclusion/inclusion rules, but there aren’t any currently in WP2Static (I moved it into it’s own add-on, which isn’t finalized yet).
So, in your position, you may use one of the hooks available from within your theme’s functions.php file or as a standalone simple WP plugin you add:
wp2static_modify_initial_crawl_list
will help avoid it getting into the initial crawl list at all.
That’s going to be best for now. Later, as we re-incorporate detection of URLs/assets during crawling, the below can help remove what can’t be excluded from detection:
wp2static_crawling_complete
or wp2static_post_process_complete
will give you a convenient place to remove actual files/folders on the filesystem from the crawl or post processing steps.
Have a try with the wp2static_modify_initial_crawl_list
filter and let me know if stuck.
Cheers,
Leon
Hi @leonstafford,
thank you very much for your reply.
Do you have a dummy function for this filter for me?
Also I saw that some URLs didn’t get replaced (or should I open up a new topic?)
Here’s the html file: https://we.tl/t-CD917i3Py5 and also as screenshot in attachment
Thanks,
Robert
Hi @rkleinert, these should be fixed in latest version of Static HTML Output, you can try: https://github.com/WP2Static/static-html-output-plugin/files/4789479/static-html-output-plugin-6.6.20.zip
If that still doesn’t fix those meta tags, please let me know your WP Site URL format, ie is it http://localhost, https://localhost or with a custom port number?
Cheers,
Leon
Hi @leonstafford ah okay. So you recommend version 6 for now? I am already at version 7. Is it already recommended for production usage? Is an upgrade from 6 to 7 easily possible later?
Also can you give me an example please for removing unneeded files with this filter?
Thanks,
Robert
Hi @rkleinert,
Sorry for the confusion, at a junction point with the plugin evolution and will continue to be a bit of pain during the transition.
What was version 6.6.7 is being updated and renamed to Static HTML Output.
The version 7 that you’ve been trying is going to continue on as WP2Static.
They’ll both continue on as different products, with strengths and weaknesses.
I’d recommend for now, trying this one https://github.com/WP2Static/static-html-output-plugin/releases/tag/6.6.20 (Download link: https://github.com/WP2Static/static-html-output-plugin/files/4789479/static-html-output-plugin-6.6.20.zip), as it has the most fixes for detection/rewriting of URLs today, you should be able to keep both plugins installed alongside each other without conflict.
That will negate the need for any custom filtering of the crawl list.
Please let me know how you get on and thanks for your patience throughout this!
Cheers,
Leon
Hi @leonstafford,
thank you
Is there a global function for version 6 to trigger generation of static pages from PHP file, similar to version 7?
Thanks.
Robert
Hi @rkleinert,
Besides the WP-CLI commands, I don’t think there’s a programmatic way to run the whole crawl and deploy in this version 6.x. No, just checked, there was a reference to an old hook that was used for this purpose/running via WP-Crontrol or such.
I’ll try to get that wired up again for upcoming release. It will require that the server’s PHP settings allow for long running processes (max_execution
setting) - the UI works around this usually.
Cheers,
Leon
Ok thank you,
but it should work with https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-runcommand/ right? does this work around php limitation as well?
The thing is: I want to have a button in the backend where our editors can click to manually run the tasks.
Another thing? Is the ‘wp2static_post_process_complete’ action also available in v6?
Thanks,
Robert
WP-CLI won’t work around any max_execution_time
PHP ini limit, but it may use a different ini than your website’s. It’s easy enough to adjust, unless you’re on some very restrictive hosting. Basically, open the relevant .ini
file and increase that limit.
So, for V6, editors can just hit the main button to do whole deployment. I’ll be adding in a hook to allow you limiting that to just editor roles or such: https://github.com/WP2Static/static-html-output-plugin/issues/113
V6 (latest in GitHub) currently has statichtmloutput_post_deploy_trigger
. It doesn’t have hooks/filters at each stage like V7 does.
It’s a bit of a mess/confusing until the next major releases go out, sorry.
Cheers,
Leon
I’d recommend for now, trying this one https://github.com/WP2Static/static-html-output-plugin/releases/tag/6.6.20
Thank you for clarifying what is best to use now, I am getting back into using the plugins and was a a bit confused with the different options
All the best, Paul