Generating Static Sites for deployment on AWS S3, Netlify, etc

I like static sites because page loads are lightning fast and hosting is dirt cheap. I host Wordpress static sites with AWS S3 and Netlify.

To do this I use normal, dynamic WordPress sites for development which I turn into static sites using the Simply Static plugin.

I thought Local could be perfect as it would allow me to eliminate the dynamic wordpress sites (I don’t like having a second copy floating around the interwebz when all I really want are the static sites).

But when I try to generate the static site using Simply Static from my Local site, all the necessary files are not included (the resulting .zip is only 16kb).

Simply Static has an option to include additional files. I’ve specified my local directory - C:\Users\Tom\Local Sites\thomasjcoffeycom\app\public - but that doesn’t fix the issue. Still a 16kb .zip. Still missing lots of files.

I was able to kinda, sorta create a static site using Local’s Export feature, using one of my other static sites as a template, and selecting the matching files from Export (Export has many files not needed for a static site). I was able to deploy that but the styling is all messed up and picking and choosing files was is a slow, error-prone process.

I also checked out this post on Simply Static but if it has any clues I wasn’t able to interpret them properly.

Any advice on how to generate static sites from Local?

Look on Preferences > Exporting. The default File Exclusions are *.zip, *.tar.gz, *.bz2, *.tgz

Andy, thanks for the reply. Reading the description of that field (“add file extensions and names to exclude files from Local exports”) I think that means that those extensions (e.g. .zip) are not used as inputs when creating output using Local’s Export feature.

I don’t have any .zip files (i.e. inputs) in my site’s directory: ~\Local Sites\thomasjcoffeycom

And I’m not using Local’s Export feature. While the Export feature generates a .zip file, it’s a .zip of a dynamic site, not a static site.

So, while I was skeptical that was the solution I’m seeking, I’m often wrong and it’s easy to test so I gave it a shot.

I removed .zip from that field. And tried both the Local Export feature and the static site generator plugins.

Both experiments generated the same results. Local Export exported a .zip of a dynamic site. The static site plugins produced .zip files that were broken and produced errors.

Nonetheless, I appreciate the suggestion. Thank you and please keep the suggestions coming.

It was worth a shot.

Where do you have Simply Static writing out your files? Local 5.x should be able to write directly to the system file path without the need for the old Volumes Add-on.

Simply Static writes to a temporary directory: /home3/thomave0/public_html/tjc4/wp-content/plugins/simply-static/static-files/

There’s a “Delete temporary files at the end of the job” checkbox in the plugin. It’s checked. I don’t have any insight into the mechanics of the temp files.

All I know is that a download link is generated inside the plugin’s screen inside the WP Admin panel. I click the download link when the job is complete and it’s like downloading any other file from the internet - I just choose where to save it locally.

Are you wanting to create the static files locally and then upload them to the server? If so, I think you’ll need to change the location of where the static files are written. Of course you would then need to use SFTP to upload them to your server.

The temp directory you have above seems to be on your server.

Yes, the temp directory is on the local server. The plugin creates a link to download the .zip from the local server.

I then download the .zip, extract it, and upload to AWS S3 or push to GitHub for a Netlify deployment.

When I create static sites using traditional, remotely hosted wordpress sites it’s the same process except the .zip is created on and downloaded from the remote server (instead of the local server).

The plugins - I’ve tried WP2Static in addition to Simply Static - generate working .zip files with the remote server. But when working on the local server created by the Local app the .zips are faulty.

Have you tried creating the local site with different versions of PHP? I thought I remember some issue with one of the supplied versions of PHP and zip.

I’m running 7.2.26 on the remotely hosted version that works with the static plugins.

I’m running 7.3.5 on the local version that causes issues.

It sounds like the issue is with 7.4.1 so I’m probably safe?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.