{% import "_includes/forms" as forms %}
{% macro configWarning(setting) -%}
{{ "This is being overridden by the {setting} config setting."|t('app', {setting: '' ~ setting ~ '' })|raw }}
{%- endmacro %}
{% from _self import configWarning %}
{% do view.registerAssetBundle("putyourlightson\\blitz\\assets\\BlitzAsset") %}
{{ forms.lightswitchField({
label: "Caching Enabled"|t('blitz'),
instructions: "Whether static file caching should be enabled."|t('blitz'),
warning: (config.cachingEnabled is defined ? configWarning('cachingEnabled')),
name: 'cachingEnabled',
on: settings.cachingEnabled,
first: true,
}) }}
{{ forms.lightswitchField({
label: "Warm Cache Automatically"|t('blitz'),
instructions: "Whether the cache should automatically be warmed after clearing."|t('blitz'),
warning: (config.warmCacheAutomatically is defined ? configWarning('warmCacheAutomatically')),
name: 'warmCacheAutomatically',
on: settings.warmCacheAutomatically,
}) }}
{{ forms.lightswitchField({
label: "Query String Caching"|t('blitz'),
instructions: "Whether URLs with query strings should cached. Disabling this will not cache any URLs that contain query strings."|t('blitz'),
warning: (config.queryStringCachingEnabled is defined ? configWarning('queryStringCachingEnabled')),
name: 'queryStringCachingEnabled',
on: settings.queryStringCachingEnabled,
}) }}
{{ forms.textField({
label: "Cache Folder Path"|t('blitz'),
instructions: "The relative path to your cache folder from your public webroot."|t('blitz'),
warning: (config.cachingEnabled is defined ? configWarning('cacheFolderPath')),
name: 'cacheFolderPath',
value: settings.cacheFolderPath,
placeholder: 'cache/blitz',
}) }}
{% set info %}
{{ 'Regular expressions can be used for pattern matching. Find more examples {here}.'|t('blitz', {'here': 'here'})|raw }}
- `.` Matches any character
- `.*` Matches any character 0 or more times
- `.+` Matches any character 1 or more times
- `\d` Matches any four digits
- `\w` Matches any word character
- `entries` Matches anything containing "entries"
- `^entries` Matches anything beginning with "entries"
- `^entries/entry$` Matches exact URI
{% endset %}
{{ forms.editableTableField({
label: "Included URI Patterns"|t('blitz'),
instructions: "The URI patterns to include in static file caching."|t('blitz'),
warning: (config.cachingEnabled is defined ? configWarning('includedUriPatterns')),
name: 'includedUriPatterns',
id: 'includedUriPatterns',
cols: [
{
type: 'text',
heading: 'URI Pattern'|t('blitz'),
info: info,
},
],
rows: settings.includedUriPatterns,
addRowLabel: "Add a URI pattern"|t('blitz'),
}) }}
{{ forms.editableTableField({
label: "Excluded URI Patterns"|t('blitz'),
instructions: "The URI patterns to exclude from static file caching. This will override any matching patterns to include."|t('blitz'),
warning: (config.cachingEnabled is defined ? configWarning('excludedUriPatterns')),
name: 'excludedUriPatterns',
id: 'excludedUriPatterns',
cols: [
{
type: 'text',
heading: 'URI Pattern'|t('blitz'),
info: info,
},
],
rows: settings.excludedUriPatterns,
addRowLabel: "Add a URI pattern"|t('blitz'),
}) }}