Config template: Add more Twig config options

This commit is contained in:
Daniel Rudolf 2019-03-28 20:11:46 +01:00
parent 008ca6f41b
commit edf849725d
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
2 changed files with 16 additions and 7 deletions

View File

@ -2,7 +2,7 @@
# Basic # Basic
# #
site_title: Pico # The title of your website site_title: Pico # The title of your website
base_url: ~ # Pico will try to guess its base URL, if this fails, override it here base_url: ~ # Pico will try to guess its base URL, if this fails, override it here;
# Example: http://example.com/pico/ # Example: http://example.com/pico/
rewrite_url: ~ # A boolean (true or false) indicating whether URL rewriting is forced rewrite_url: ~ # A boolean (true or false) indicating whether URL rewriting is forced
timezone: UTC # Your PHP installation might require you to manually specify a timezone timezone: UTC # Your PHP installation might require you to manually specify a timezone
@ -11,19 +11,21 @@ timezone: UTC # Your PHP installation might require you to
# Theme # Theme
# #
theme: default # The name of your custom theme theme: default # The name of your custom theme
theme_url: ~ # Pico will try to guess the URL to the themes dir of your installation theme_url: ~ # Pico will try to guess the URL to the themes dir of your installation;
# If this fails, override it here. Example: http://example.com/pico/themes/ # If this fails, override it here. Example: http://example.com/pico/themes/
theme_config: theme_config:
widescreen: false # Default theme: Use more horicontal space (i.e. make the site container wider) widescreen: false # Default theme: Use more horicontal space (i.e. make the site container wider)
twig_config: twig_config:
cache: false # Enable Twig template caching by specifying a path to a writable directory
autoescape: false # Let Twig escape variables by default autoescape: false # Let Twig escape variables by default
debug: false # Enable Twig's debugging mode strict_variables: false # If set to true, Twig will bail out when unset variables are being used
debug: false # Enable Twig's debug mode
cache: false # Enable Twig template caching by specifying a path to a writable directory
auto_reload: ~ # Recompile Twig templates whenever the source code changes
## ##
# Content # Content
# #
date_format: %D %T # Pico's default date format date_format: %D %T # Pico's default date format;
# See http://php.net/manual/en/function.strftime.php for more info # See http://php.net/manual/en/function.strftime.php for more info
pages_order_by_meta: author # Sort pages by meta value "author" (set "pages_order_by" to "meta") pages_order_by_meta: author # Sort pages by meta value "author" (set "pages_order_by" to "meta")
pages_order_by: alpha # Change how Pico sorts pages ("alpha" for alphabetical order, "date", or "meta") pages_order_by: alpha # Change how Pico sorts pages ("alpha" for alphabetical order, "date", or "meta")
@ -31,7 +33,7 @@ pages_order: asc # Sort pages in ascending ("asc") or descend
content_dir: content/ # The path to Pico's content directory content_dir: content/ # The path to Pico's content directory
content_ext: .md # The file extension of your Markdown files content_ext: .md # The file extension of your Markdown files
content_config: content_config:
extra: true # Use the Parsedown Extra parser to support extended markup extra: true # Use the Parsedown Extra parser to support extended markup;
# See https://michelf.ca/projects/php-markdown/extra/ for more info # See https://michelf.ca/projects/php-markdown/extra/ for more info
breaks: false # A boolean indicating whether breaks in the markup should be reflected in the breaks: false # A boolean indicating whether breaks in the markup should be reflected in the
# parsed contents of the page # parsed contents of the page

View File

@ -943,7 +943,14 @@ class Pico
$this->config['theme_url'] = $this->getBaseUrl() . rtrim($this->config['theme_url'], '/') . '/'; $this->config['theme_url'] = $this->getBaseUrl() . rtrim($this->config['theme_url'], '/') . '/';
} }
$defaultTwigConfig = array('cache' => false, 'autoescape' => false, 'debug' => false); $defaultTwigConfig = array(
'autoescape' => false,
'strict_variables' => false,
'debug' => null,
'cache' => false,
'auto_reload' => null
);
if (!is_array($this->config['twig_config'])) { if (!is_array($this->config['twig_config'])) {
$this->config['twig_config'] = $defaultTwigConfig; $this->config['twig_config'] = $defaultTwigConfig;
} else { } else {