Skip to content

Instantly share code, notes, and snippets.

@luxuryluke
Forked from scottboms/cache.php
Last active May 21, 2020 07:18
Show Gist options
  • Save luxuryluke/03d77376e8b0b03e52de85bbdad243dd to your computer and use it in GitHub Desktop.
Save luxuryluke/03d77376e8b0b03e52de85bbdad243dd to your computer and use it in GitHub Desktop.
Core Kirby config file for local dev and remote production, rss
<?php
return [
// set environment variable
'environment' => 'development',
// activate debug mode
'debug' => true,
// disable the fingerprint plugin
//'bvdputte.fingerprint.disabled' => true,
];
<?php
return [
// set environment variable
'environment' => 'production',
// disable debug mode on live server
// for security reasons
'debug' => false,
// cache options
// load from external file using 'require_once'
'cache' => require_once 'cache.php',
//'bvdputte.fingerprint.disabled' => false,
];
<?php
/**
* The config file is optional. It accepts a return array with config options
* Note: Never include more than one return statement, all options go within this single return array
* All config options: https://getkirby.com/docs/reference/system/options
*/
return [
// thumbnail options
// load from external file by using 'require once'
//'thumbs' => require_once 'thumbs.php',
// turn on markdown extra
'markdown' => [
'extra' => true
],
// turn on smartypants globally
// set content file extensions to .md from .txt default
'smartypants' => true,
'content' => [
'extension' => 'md'
],
// routes & redirects
// load from external file using 'require_once'
'routes' => require_once 'routes.php',
];
<?php
// !TODO: redo to match content instead of Scott Boms' content ;)
return [
// virtual page for RSS feed
// using the kirby3-feed plugin to general RSS feed
[
'pattern' => 'feed',
'method' => 'GET',
'action' => function () {
$options = [
'url' => site()->url(),
'feedurl' => site()->url() . '/feed/',
'title' => 'Latest Dispatches',
'description' => 'The Latest Dispatches from Scott Boms',
'link' => site()->url() . '/documenting/',
'urlfield' => 'url',
'titlefield' => 'title',
'datefield' => 'date',
'textfield' => 'text', // Field used for feed content
'modified' => time(),
'mime' => null,
'sort' => true,
];
// build feed from 'documenting' page content, get last 10 entries with newest first
$feed = page('documenting')->children()->listed()->flip()->limit(10)->feed($options);
return $feed;
}
],
// filtering for projects routes
// filter by tag without querystring parameters
[
'pattern' => 'making/(:any)',
'action' => function ($filter) {
if ($page = page('making/' . $filter)) {
return $page;
} else {
return page('making')->render([
'filter' => $filter
]);
}
}
],
// additional custom routes would go here
// used on homepage for unique urls to pages
[
'pattern' => ['education', 'speaking'],
'action' => function() {
// do something
return page('thinking');
}
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment