Converting a WordPress website to a static site eliminates the need for dynamic processing on the server; this improves loading times and reduces common security vulnerabilities.
In this article, we’ll explore the advantages of using a static website and the methods and tools you can use to convert your WordPress installation to a static site.
Advantages of Converting WordPress to a Static Website
Before diving into the conversion methods, let’s explore why you might want to convert your WordPress site to a static site:
- Performance: Static websites load faster because they don’t require server-side processing to generate pages on the fly.
- Security: With no database or server-side scripting, static sites are less vulnerable to common attacks like SQL injection or malware.
- Cost savings: Static sites are less resource-intensive and can be hosted on a budget-friendly hosting plan.
- Simplicity: Deploying a static website reduces server requirements and the need for regular updates or maintenance.
Create a Static Site With the Simply Static Plugin
Simply Static is currently the most popular plugin WordPress plugin for building static sites. It’s used by more than 40,000 users and offers all the essential functionalities for free.
In terms of features, the plugin includes multiple deployment methods. For example, you can download your entire WordPress site as a zip file containing all the static assets, export it to a local directory on the web server, or upload it directly to your hosting space via SFTP.
Get Started With Simply Static
First, download the plugin from the WordPress.org repository.
Once installed, visit the Simply Static -> Generate menu and click the Generate Static Files button.
Wait a few seconds (or minutes if you are generating the static files of a large website). Then, in the Activity Log available on the right side of the screen, click on the “Click here to download” link to download the zip file that includes the static version of your site.
The downloadable zip file contains the HTML and CSS files positioned in folders that match post names, media archives, and WordPress core locations.
Deployment Methods
In the previous section, we converted one WordPress site using the default deployment method named “ZIP Archive”. However, multiple deployment methods are available:
- ZIP – The plugin will create a zip file with the static files in a temporary folder of your web server. You can download this file by clicking the download link provided in the Activity Log section.
- Local directory – With this deployment method, you can generate static files in a specified directory that is writable by the web server. Before proceeding with this method, make sure to create the folder on the server.
- SFTP – The plugin will generate the static files on the specified SFTP folder. To set up this deployment method, enter the host information, the port, credentials, and the SFTP folder.
- GitHub – This method will send your static files to static site hosting providers like Netlify, Cloudflare Pages, or GitHub Pages.
- Amazon AWS S3 – As the name implies, this deployment method will send the static files to S3, the popular object storage services provided by AWS (Amazon Web Services). Note that you should add the AWS credential to the plugin before proceeding.
- Bunny CDN – This method will move your static files to Bunny CDN.
- Tiiny.host – With this option, you can quickly deploy your static site directly to Tiiny.host.
What I Like About Simply Static
- Simply Static is straightforward to use. You can export the site in one minute without reading the documentation.
- If you don’t understand a feature, they made a YouTube video for each feature. These videos are accessible by clicking a video icon beside the section title.
- The plugin has a modern look and behavior. Technically, the developers built the back-end UI with React.
- Advanced features are available, although most are included only in the Pro version, like image optimization, file minification, automatic renaming of the exported folders, and the ability to hide specific features and meta information from the exported content.
- The plugin also has integration to support popular WordPress plugins like Yoast, Elementor, Jetpack, WPML, and more.
- You can import and export the plugin settings to perform conversions on multiple sites without reconfiguring all the options each time.
- Advanced options to debug the plugin procedures are available.
My Impressions of the Simply Static Plugin
The plugin is well-made, and I had no issues with the static conversions I performed during my test.
In addition, it includes a lot of options to satisfy the needs of most users. For example, if Simply Static cannot automatically detect specific URLs of your site, you can manually add them along with files and directories in its general settings. You can also exclude URLs that you don’t want in your static export using the URLs to Exclude option.
To learn more about Simply Static check out the Simply Static official site or explore its documentation.
Migrate Your Site to a Static Site Generator
Another solution to convert your WordPress website to a static site is to export its content as Markdown files and then create the site using a static website generator like Jekyll or Hugo.
1. Export the Existing WordPress Posts to Markdown
You can use the Markdown utilities included in the Ultimate Markdown plugin to perform the WordPress to Markdown export process.
Specifically, to perform a bulk export operation, visit the plugin Tools menu. Then, in the Export section, select Posts as a source. To conclude, select the post types, categories, and tags of the posts used as a source and click the Export button.
The plugin generates a zip archive that includes all the Markdown files. Later, you will be able to use these Markdown files as a source for the static site generator.
Note that we have a complete guide for exporting Markdown files from a WordPress site. To learn more about this subject, check out this article.
2. Install the Static Site Generator
Static site generators are command line tools that create static sites from provided Markdown files.
For example, you can simply install Hugo in Fedora and Red Hat-Based distributions with this command.
dnf install hugo
3. Add the Exported Markdown Files as a Source for the Static Site Generator
Now, add your previously exported Markdown files to the posts folder of the static site generator. Then conclude the process by building your static site with this command:
hugo
If you want to use Markdown with a static site generator, check out our dedicated article on blogging with Markdown.
Headless WordPress With a Static Frontend Using Gatsby
Another approach is to keep WordPress as your backend and generate the public site using a static site generator. In this way, you can still use the familiar WordPress admin dashboard to create, edit, and manage content.
The Gatsby documentation explains how to connect WordPress with Gatsby. A guide on using WordPress with Gatsby is also available.
Crawling Tools (Manual Crawling of the WordPress Site)
Tools like HTTrack, SiteSucker, or Wget can also crawl and download your site as static HTML.
HTTrack
HTTrack is an application available for all OS which allows you to convert a specified site to HTML. The application runs in the browser and allows you to complete the process after a quick setup wizard.
Let’s see the steps to create static files from a public site. First, download the application using the methods described on the downloads page.
Then, start the application (which will open in your browser), and after selecting the language, click the Next button.
The second dialog will request that you enter a category and a name for the project.
Then select if you want to download an entire website or individual URLs and enter a list of the URLs in the provided textarea.
The last dialog window will only ask you for confirmation of your selection. Click Start to execute the process.
SiteSucker
SiteSucker is a macOS and iOS app to download all the contents of a website, including HTML files, images, PDFs, stylesheets, and other resources, creating a local copy that mirrors the site’s structure and appearance.
Wget
Wget is a command-line utility used to download files from the web. With the proper options, this application can be used to download entire websites.
A complete example to download an entire website.
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://example.com
Here is a breakdown of the options used in the command:
–mirror | This option enables “mirror” mode, which essentially tells wget to download the entire website recursively. It automatically includes options like -r (recursive download), -N (download only new or updated files), -l inf (infinite recursion depth), and -nr (no removal of files). |
–convert-links | Converts the links in downloaded files to point to the local files, making the site navigable offline. For example, it replaces all links to external resources with relative links to local files. |
–adjust-extension | Ensures that downloaded files have the appropriate file extensions, like .html for HTML files. |
–page-requisites | Downloads all the elements required to display the page properly, such as images, CSS, JavaScript, etc. |
–no-parent | Prevents wget from ascending to parent directories. It restricts the download to the specified directory and its subdirectories, avoiding higher-level folders. |
Learn more about wget and its options on the documentation page.