fvsch / kirby-staticbuilder

Static HTML exporter for Kirby CMS (v2 only)
MIT License
112 stars 8 forks source link

Document the <base> relative link strategy #17

Closed fvsch closed 7 years ago

fvsch commented 8 years ago

Current doc: https://github.com/fvsch/kirby-staticbuilder/blob/master/doc/options.md#html-pages-outside-of-a-web-site

I’m not really happy with how poorly it explains how to prepare for a fully static site that may not be served with HTTP or hosted at the root of a domain.

Anyway, document the other option, which is:

// config.localhost.php
c::set([
    'plugin.staticbuilder.enabled'  => true,
    'plugin.staticbuilder.baseurl'  => '',
    'plugin.staticbuilder.uglyurls' => true
]);

// snippets/header.php
<head>
<?php
  $base = './';
  $max = $page->isHomePage() ? 0 : $page->depth();
  for($i=1; $i < $max; $i++) { $base .= '../'; }
  echo "<base url=\"$base\">";
?>
fvsch commented 7 years ago

I'm tempted to remove the relative URLs feature, only keeping the <base url="..."> strategy.

This means:

fvsch commented 7 years ago

Nope, I’ll keep the relative URLs feature and make it the default in 3.0. It seems to work well in simple settings, and if it's broken for some things it should be fixed.