Generate Static HTML Pages For a WordPress Site With This Ubot Bot 

 July 20, 2020

By  Reed

Static Generator was made out frustration for caching plugins in WordPress. They are cumbersome, a security threat, and eat up server resources. It shouldn’t be a security risk to optimize your site for speed, but in many cases it is. It also shouldn’t be complicated to optimize a site using a WordPress plugin, but is. It can also get pretty expensive if you have a lot sites.

There are simpler ways to speed up a WordPress site than using server-side resources to do so. Why not give the server a break and utilize off-site software instead? This is entirely possible with Ubot, and it’s exactly what we have here -a simple static generator for WordPress sites.

The beauty of using software like Ubot Studio is you can replace costly plugins and software with a single DIY tool. Granted, it takes considerable time to develop fully functional bots that can replace the paid plugins you own. It’s much more realistic to build a bot that replaces a feature of a plugin, and then go from there.

The reality was, this bot was too big to be one bot, so it’s been split up into multiple pieces: Rest Explorer and Static Generator. I like building bots this way because it keeps projects smaller and more agile, allowing them to be more easily integrated into other bots down the road. You break a larger bot project into smaller ones, that come together to make up the larger bot. Large projects that seemed dauntingly impossible, suddenly becomes small and tangible, one bot at a time.

What you will see, is that Static Generator uses Rest Explorer to find all published content on a WordPress site through the REST API. The static generating part is a small section that takes the list of published content to generate static html files from. One of the things you will learn when botting, is that simple ideas are usually not so simple and can usually be broken up into smaller pieces. This project is an excellent example of this.

wordpress static html generator bot
Select pages to create static html documents for

What it Does so Far

There are so many more features to add to it, but right now it accomplishes the bare-minimum needed to call it a static generator for wordpress.

  • Crawl a WordPress site’s REST API to find all posts, pages, types published.
  • Crawl the actual site to find pages not included in the REST API
  • Displays results in a table
  • Writes HTML for each result into a database
  • Generates HTML files for each selected result

What to Use it For

  • Find junk pages discoverable in the REST API before search engines do (no-index them, hide them from search, block from REST API). Helpful for SEO.
  • Create a quick static HTML copy of your site to use as a backup. Helpful for backing up a site or even migrating it. Can switch to the HTML version while editing or migrating the actual WordPress site.
  • Serve HTML copy of your WordPress pages to save server resources and speed up site load. Very helpful if you need to speed up a simple WordPress site without using more resources.

Future Development

There are so many more features to add to it, but right now it accomplishes the bare-minimum needed to call it a static generator for wordpress.

The most important feature to add next is the ability to discover and download all included resources in a page; like pictures, stylesheets, scripts, etc. Having the resources would make it a true Static generator, and allow the user to upload the downloaded files to a host to create a static standalone copy of their site that doesn’t require WordPress.

This bot works great for WordPress sites that have few forms and are not dynamic. I’m personally using it on pages that I expect to update very little. There’s no sense in using a plugin to generate cache for pages that don’t change often, which is why this tool is so handy.

Example Use Case

Here’s a really neat use-case for a bot like this. Say you turn one WordPress site into a site building tool, using a theme builder plugin like Thrive Theme Builder and page builder such as Architect. These tools are excellent for WordPress sites, but require a paid license for each site you use them on. Rather than buy more licenses, why not build your site and pages using that single wordpress install, and then use Static Generator to create a static html copy of the pages you just built! You just built a great looking site without having to buy more licenses.

Paid Plugins Used

  • Advanced Data Text File.dllused for data and file related things
  • EliteUbot.dllused for many things
  • ExBrowser.dllused to parse JSON
  • HTTP post.dllused for header request, which reveals important information about the REST API
  • UltimateUI.dllused to create a graphical XAML interface with metro design scheme, with buttons and datagrid

Free Plugins Used

  • File Management.dllhas helpful file functions
  • FileFolderCommands.dllalso has helpful file functions
  • HeopasCustom.dllused for http get for headless crawling
  • SQLlite.dllto store discovered pages HTML source code in a sql database, and query it when static is to be generated


Warning: Invalid argument supplied for foreach() in /home/actionreed/public_html/su/wp-content/themes/thrive-theme/inc/classes/class-thrive-theme-comments.php on line 463

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

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Subscribe to our newsletter now!

Follow by Email

Forgot Password?

Join Us