The Framework Code

twigs/framework/util/page.twig

File List

<!doctype html>
<html{% if lang is defined %} lang="{{lang}}"{% endif %}{%if schema is defined %} {{schema|raw}}{% endif %}>
<head>
    <meta charset="utf-8"/>

    <title>
        {% block title %}{% if title is defined %}{{title|raw}}{% else %}{{fwurls.sitename.value|upper}}{% if action != 'home' %} &mdash; {{action}}{% endif %}{% endif %}{% endblock title %}
    </title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

    {% if keywords is defined %}
        <meta name="keywords" content="{{keywords}}"/>
    {% endif %}

    {% if description is defined %}
        <meta name="description" content="{{description}}"/>
    {% endif %}

    {% import '@util/attrmacro.twig' as h %}

    {% block favicons %}
        {% include '@content/favicons.twig' %}
    {% endblock favicons %}

    {% if usebootstrapcss %}
        <link rel="stylesheet" {{h.urlattr(fwurls.bootcss)}} media="screen,print"/>
    {% endif %}
    {% if usevue %}
        <link rel="stylesheet" {{h.urlattr(fwurls.bootvuecss)}}/>
    {% endif %}
    {% if fwurls.facss.type == 'css' %}
        <link rel="stylesheet" {{h.urlattr(fwurls.facss)}}/>
    {% endif %}
    {% if editable %}
        <link rel="stylesheet" {{h.urlattr(fwurls.editablecss)}}/>
    {% endif %}
    <link rel="stylesheet" href="{{assets}}/css/layout.min.css{{context.local.develMode ? '?debug' : ''}}" media="screen"/>

    {% block head %}
    {% endblock head %}
    {% if block('style') is defined %}
        {% set nonce = security.makeNonce() %}
        {% do context.web.addcsp('style-src', "'nonce-"~nonce~"'") %}
        <style nonce="{{nonce}}">{{block('style')}}</style>
    {% endif %}
    {% if block('criticalCSS') is defined %}
        {% set nonce = security.makeNonce() %}
        {% do context.web.addcsp('style-src', "'nonce-"~nonce~"'") %}
        <style nonce="{{nonce}}">{{block('criticalCSS')}}</style>
    {% endif %}

</head>
<body lang="{{deflang is defined ? deflang : 'en-GB'}}">
    {% block body %}
    {% endblock body %}

    {% if usevue %}
        <script {{h.urlattr(fwurls.vuejs)}}></script>
        <script {{h.urlattr(fwurls.bootvuejs)}}></script>
    {% else %}
        {% if usejquery or parsley or validate %}
            {% if ajax %}
                <script {{h.urlattr(fwurls.jquery)}}></script> {# we need everything #}
            {% else %}
                <script {{h.urlattr(fwurls.jqueryslim)}}></script>
            {% endif %}
        {% endif %}
        {% if usebootstrapjs or usebootbox or fwutils or editable %}  {# editable and bootbox use Bootstrap JS #}
            {#<script {{h.urlattr(fwurls.popperjs)}}></script>#}
            <script {{h.urlattr(fwurls.bootjs)}}></script>
        {% endif %}
        {% if usebootbox %}
            <script {{h.urlattr(fwurls.bootbox)}}></script>
        {% endif %}
        {% if fwutils or ajax or fwdom or editable %}
            <script {{h.urlattr(fwurls.utiljs)}}></script>
            <script src="{{assets}}/js/fwdom-min.js"></script>
        {% endif %}
        {% if parsley or validate %}
            <script {{h.urlattr(fwurls.parsley)}}></script>
        {% endif %}
        {% if editable %}
            <script {{h.urlattr(fwurls.editable)}}></script>
        {% endif %}
        {% if recaptcha %}
            {% if constant('Config\\Config::RECAPTCHA') == 2 %}
                <script src="https://www.google.com/recaptcha/api.js" async defer></script>
            {% elseif constant('Config\\Config::RECAPTCHA') == 3 %}
                <script src="https://www.google.com/recaptcha/api.js?render={{constant('Config\\Config::RECAPTCHAKEY')}}"</script>
            {% endif %}
        {% endif %}

    {% endif %}

    {% if fwurls.facss.type == 'js' %}
        <script {{h.urlattr(fwurls.facss)}}></script> {# if you are using a font awesome kit #}
    {% endif %}

    {% block userscripts %}
    {% endblock userscripts %}

    {% set sjs, ojs = '', context.getons %}
    {% if block('setup') is defined %}{% set sjs = sjs ~ block('setup')|trim %}{% endif %}
    {% if block('onload') is defined %}
        {% set ojs = ojs ~ block('onload')|trim %}
        {% if ojs|length > 0 %}{% set ojs = "document.addEventListener('DOMContentLoaded', function(){#{ojs}});" %}{% endif %}
    {% endif %}
    {% set js = sjs~ojs %}
    {% if js|length > 0 %}
        {% set nonce = security.makeNonce() %}
        {% do context.web.addcsp('script-src', "'nonce-#{nonce}'") %}
        <script nonce="{{nonce}}">const base = '{{base}}', putorpatch = '{{constant('Config\\Config::PUTORPATCH')}}';
            {% if fwutils -%}
                framework.base = '{{base}}'; framework.putorpatch = '{{constant('Config\\Config::PUTORPATCH')}}';
            {%- else -%}
                var framework = { base: '{{base}}', putorpatch: '{{constant('Config\\Config::PUTORPATCH')}}' };
            {%- endif %}
            {{sjs|raw}}
            {{ojs|raw}}
        </script>
    {% endif %}
</body>
</html>