Export a static version of your website.
Download and copy this repository to /site/plugins/k3-export-area
.
git submodule add https://github.com/rasteiner/k3-export-area.git site/plugins/k3-export-area
Currently not available on composer. Will be available as soon as it is released in a stable version.
There 3 fundamental options to configure.
-
rasteiner.export.base
: The base path selection on which the export will be based.
Default:/
Types:string
,array
,callable:string|array
Examples:// the website will be deployable in any webroot 'rasteiner.export.base' => '/', // the website will be deployable on https://example.com 'rasteiner.export.base' => 'https://example.com', // the user can choose between these two 'rasteiner.export.base' => [ 'https://example.com', 'https://wip.example.com', ], // the user can choose between the two, change the displayed text 'rasteiner.export.base' => [ 'https://example.com' => 'Production', 'https://wip.example.com' => 'Staging', ],
-
rasteiner.export.pages
: The pages that will be rendered.
Default:fn($kirby) => $kirby->site()->index()
Type:callable:Pages
Example:'rasteiner.export.pages' => fn($kirby) => $kirby->site()->index()->template(['default', 'contact']),
-
rasteiner.export.assets
: Other assets that will be copied.
Default:fn($kirby) => []
Type:callable:array
(The returned array should be associative: [destination => source])
Example:'rasteiner.export.assets' => function($kirby) { //copy all files in the `/assets` folder except *.js and *.css files $assetsRoot = $kirby->root('assets'); $index = Dir::index($assetsRoot, true, []); $files = []; foreach ($index as $path) { $root = "$assetsRoot/$path"; if(!is_dir($root)) { $extension = F::extension($path); if($extension !== 'css' && $extension !== 'js') { $files["assets/$path"] = $root; } } } return $files; },
ℹ
Files that in your templates are referenced with a call to->url()
will be exported automatically.
Thumbnails will be exported automatically.
CSS and javascript files will be exported and fingerprinted automatically when referenced via thejs()
andcss()
helpers.