Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created January 18, 2019 14:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastianallgeier/d61ab782cd5c2cc02b6f6fec54fd1985 to your computer and use it in GitHub Desktop.
Save bastianallgeier/d61ab782cd5c2cc02b6f6fec54fd1985 to your computer and use it in GitHub Desktop.
<?php
require __DIR__ . '/kirby/bootstrap.php';
$kirby = new Kirby([
'roots' => [
'static' => __DIR__ . '/static'
],
'urls' => [
'index' => '/'
]
]);
foreach ($kirby->site()->index() as $page) {
$html = $page->render();
if ($page->isHomePage()) {
$file = $kirby->root('static') . '/index.html';
} else {
$file = $kirby->root('static') . '/' . $page->id() . '/index.html';
}
F::write($file, $html);
}
echo 'Your static site has been generated in ' . $kirby->root('static');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment