WordPress generates HTML static website

More than ten years ago, I wrote a “static method for wordpress”, which was implemented by a plugin called cos-html-cache.

This plug-in is very simple and small, and directly generates the html files of the homepage and article pages on the original website. However, this plug-in only supports static articles, and does not support static pages, tags, and categories, and has not been updated since then.

Later, I thought of using a WordPress plugin to export a fully static website. This method is convenient for a small number of articles, but once the number of articles increases, errors often occur.

Later, I saw that someone developed a plug-in called Super Static Cache based on the cos-html-cache plug-in. I used it and found that it has many bugs. Only the Rewrite mode can be used normally. In this In this mode, you can generate static files for the home page, article page, single page, category page, and tag page, and save them in a directory named super-static-cache. Copy this directory directly to get a static website .

The method to fix the BUG is very simple, you must select “Direct Mode” and comment out the following line of code. Its “Direct Mode” function is actually the same as cos-html-cache, but realizes static pages, tags and categories.

$rules = __(‘Your server type is not detected, Please visit https://www.hitoy.org/super-static-cache-for-wordperss.html for help.’,’super-static-cache’);

Therefore, a simpler way to generate a static website is here. First, install Super Static Cache on the website, and then run a tool for crawling the website. There are many such tools, such as wget, sitemaps generator, etc., to save the entire website Grab it once, and you can get the static Html file of the website in the super-static-cache directory.

Leave a Reply

Your email address will not be published. Required fields are marked *