News for hackers. Stuff that matters.
Re: I Built My Own Shitty Static Site Generator by bamboleo on Sunday November 29, 2020 @09:35PM (#25250211)
Sometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off. Nobody wants to deal with slow and insecure always-on WordPress sites.

I know that there are some websites that take care of this… for money. Unfortunately $20/month is not in the budget for one-off sites.

Re: I Built My Own Shitty Static Site Generator by john-shaffer on Sunday November 29, 2020 @10:15PM (#25250403)
You can use WP2Static and either run a container locally with something like https://lokl.dev, or spin up a VM that's firewalled off and access it through an SSH tunnel. The auto-on/-off part really does little for security, it's the firewalling that does the trick. Turning it off is good to save costs though.

I'm actually working on basically exactly what you described (using WP2Static), and we're planning for a competitive $10-15/mo price, but we're not quite ready for launch yet.

Re: I Built My Own Shitty Static Site Generator by ngcc_hk on Sunday November 29, 2020 @10:26PM (#25250445)
Still searching a easy way to use digital ocean, Docker to pushing a simple web site so I can do my mumble jumbo there daily.
Re: I Built My Own Shitty Static Site Generator by throwaway201103 on Sunday November 29, 2020 @09:57PM (#25250332)
It should be possible. You can use wget to crawl your Wordpress site and save it all to html files, which you can then copy/ftp to your static site. I've done this with Drupal. Drupal 6 was at EOL and not getting security fixes. The site was fairly large and had been built over a period of years, but was no longer being updated. We wanted to keep it online, but did not want to take on a project to migrate it to the next major release of Drupal and then get on that update treadmill.

I forget the exact set of wget options but you can find blog posts about how to do this.

Re: I Built My Own Shitty Static Site Generator by bamboleo on Monday November 30, 2020 @01:59AM (#25251345)
I’ve done it too, but wget is pretty “dumb” and will try to save files as main.js?v=1.2.3. Also wget doesn’t support everything so you have to carry over some files manually.
Re: I Built My Own Shitty Static Site Generator by neurostimulant on Sunday November 29, 2020 @09:54PM (#25250315)
> Sometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off.

But you can do exactly that right now. For example:

- use wordpress as your data backend in next.js

- not exactly a static site generator, but you can use w3tc plugin to perform full page caching with very long expiry time, which essentially turns your wordpress site into a static site. You can also do this using cloudflare "cache everything" page rule, but it must be paired with another page rule to skip caching if wp cookie found. Similarly, you can add web app firewall rules on cloudflare to disallow login access except for you.

Re: I Built My Own Shitty Static Site Generator by bamboleo on Monday November 30, 2020 @02:02AM (#25251361)
Neither case is really static and you still need the server running.

Also for whatever reason even with the right headers I could never force CloudFlare to actually cache everything. I think it will just keep a copy of a visited page in some servers, but not in all, and definitely it won’t cache the whole site at once.

Re: I Built My Own Shitty Static Site Generator by neurostimulant on Monday November 30, 2020 @02:14AM (#25251416)
The next.js method is completely static. You can run your wordpress instance locally in your laptop/pc, run next.js static site generator, then upload the resulting static site to aws or github pages. No need to run the wordpress instance 24/7 as it's only required as a data source during static site generation and can be turned off when you're done with it.

There is also an option in cloudflare to pre-cache everything on their edge servers so visitors will never hit the origin server, but it's not available in free plan (I think it's enterprise only plan).

Re: I Built My Own Shitty Static Site Generator by jokethrowaway on Sunday November 29, 2020 @10:42PM (#25250511)
I did exactly this several times.

Hand off WordPress / Django CMS to untechy people (either hosted or installed on their pc locally), setup a daily scraping job that updates a static website. By using free static hosts (eg netlify) and free scheduled processes somewhere (eg heroku) you can do it for free.

Re: I Built My Own Shitty Static Site Generator by bamboleo on Monday November 30, 2020 @02:04AM (#25251372)
How can you scrape it if it’s on their computer?
Re: I Built My Own Shitty Static Site Generator by ethanpil on Monday November 30, 2020 @09:11AM (#25253852)
What scraping tool did you use? How do you handle forms?