Skip to content

Instantly share code, notes, and snippets.

@scottboms
Last active May 21, 2020 07:14
Show Gist options
  • Save scottboms/98eefa57073521074aa3a7325ebe825f to your computer and use it in GitHub Desktop.
Save scottboms/98eefa57073521074aa3a7325ebe825f to your computer and use it in GitHub Desktop.
Core Kirby config file. See also related files
<?php
/**
* Allows you to use blueprints to tell
* Kirby whether to cache a page or not
*
* eg.
* In a page blueprint
* options:
* cache: false
*/
return [
'pages' => [
'active' => false,
'ignore' => function ($page) {
$options = $page->blueprint()->options();
return isset($options['cache']) ? !$options['cache'] : false;
}
]
];
<?php
return [
// set environment variable
'environment' => 'development',
// activate debug mode
'debug' => true,
// disable the fingerprint plugin
'bvdputte.fingerprint.disabled' => true,
];
<?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
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
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');
}
],
];
<?php
return [
// thumb generation presets with names
'presets' => [
'normal' => ['width' => 800, 'quality' => 75],
'large' => ['width' => 1200, 'quality' => 75],
'xlarge' => ['width' => 1800, 'quality' => 75]
],
// srcset defaults - two sets: default, albums
'srcsets' => [
'default' => [
'800w' => ['width' => 800, 'quality' => 75],
'1200w' => ['width' => 1200, 'quality' => 75],
'1800w' => ['width' => 1800, 'quality' => 75],
],
'albums' => [
'400w' => ['width' => 400, 'quality' => 75],
'600w' => ['width' => 600, 'quality' => 75],
],
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment