How can I convert a Kirby website into static pages?

#1

Hi everyone,

In an effort to reduce my work’s environmental footprint I have recently been trying to incorporate low tech design principles. After reading @bastianallgeier’s recent topic asking for recommendations about carbon neutral hosting providers, I’m happy to see Kirby’s team trying to do what they can to fight climate change.

As my good friend and design researcher Gauthier Roussilhe recently wrote in his article Digital guide to low tech, inspired by Low Tech Magazine’s approach on building low tech websites, “A static page is generated once for 1000 requests, a dynamic page is generated 1000 times for 1000 requests. So a low tech website is necessarily a static site.” I would therefore like to be able to convert a dynamic Kirby website into static pages.

I was sent this starting base point for a static converter written by @bastianallgeier, however I am new to this and having difficulty implementing it.

Could anyone help me by sharing some instructions on where this file should be located, which parts should be edited, etc.?

Thanks,
Fivos

#2

Have you tried creating that static.php file in the root, along side index.php, and call it in the browser?

If that doesn’t work, replacing the contents of index.php with that file should work. I’ve used tha file myself and it’s not quite plain sailing. Im using the metatags plugin in my projects and i ended up with multiple meta tags inside each html file, so your mileage may vary.

Don’t forget though that Kirby speaks json, so you could easily feed the data from it into something like Gatsby, Jigsaw or Metalsmith to generate your HTML.

1 Like
#3

Or use HTTrack to download your website in html format.

1 Like
#4

If you cache the rendered result in the page cache long enough, the result should actually be quite similar to a static site?

1 Like
#5

That looks similar to Site Sucker for mac users.

Infact, i think if you get clever with the wget terminal command you could clone a site as HTML.

1 Like
#6

Thanks guys so much for all your recommendations.

I have a Mac so decided to go with SiteSucker which seems to be the simplest solution for now and works like a charm.

#7

:100:

#8

I’m using AWS S3 to host my personal website because I’ve found it to be the cheapest. Unfortunately, it only works with static files. Your recommendation would be ideal for any other hosting provider, I guess.

#9

Or use a download software like linked above to download a html version from your development system and upload this to your live server using a FTP-software.

Or change your hoster or use another server version.

#10

I decided to use SiteSucker as I mentioned above. Thanks @HeinerEF.

1 Like