From 3cb8c39e2ded1aa7c3d68c4020b9d16951a2064d Mon Sep 17 00:00:00 2001 From: Esteban Castro <2717274+estebancastro@users.noreply.github.com> Date: Tue, 19 Sep 2023 18:53:24 -0600 Subject: [PATCH 1/2] Update global-variables.twig Update the order, `spaceles` above the top comment etc. Based on: https://nystudio107.com/blog/an-effective-twig-base-templating-setup#project-global-variables-twig --- cms/templates/_layouts/global-variables.twig | 29 +++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cms/templates/_layouts/global-variables.twig b/cms/templates/_layouts/global-variables.twig index e1eb315..af96c24 100644 --- a/cms/templates/_layouts/global-variables.twig +++ b/cms/templates/_layouts/global-variables.twig @@ -1,23 +1,26 @@ -{% spaceless %}{# -- Root global variables that all templates inherit from -- #} - {# -- This allows for defining site-wide Twig variables as needed -- #} - {# - ┌─────────────────────────────────────────────────────────────────────────────┐ - │ │ - │ │ - │ │ - │ htmlPage │ - └─────────────────────────────────────────────────────────────────────────────┘ - #} - +{# -- Root global variables that all templates inherit from -- #} +{# -- This allows for defining site-wide Twig variables as needed -- #} +{# +┌─────────────────────────────────────────────────────────────────────────────┐ +│ │ +│ │ +│ │ +│ htmlPage │ +└─────────────────────────────────────────────────────────────────────────────┘ +#} +{% spaceless %} {# -- Prefetch & preconnect headers and links -- #} {% set prefetchUrls = [ alias("@assetsUrl"), ] %} + {# -- General global variables -- #} {% set baseUrl = alias('@assetsUrl') ~ '/' %} {% set gaTrackingId = getenv('GA_TRACKING_ID') %} {# -- Twig output from the render; this must be in a block -- #} -{% endspaceless %}{% block htmlPage %} -{% endblock %} + {% block htmlPage %} + {% endblock %} + +{% endspaceless %} From 0a2c5907eee8322d6afb47734a638c624bebf6f4 Mon Sep 17 00:00:00 2001 From: Esteban Castro <2717274+estebancastro@users.noreply.github.com> Date: Tue, 19 Sep 2023 22:06:59 -0600 Subject: [PATCH 2/2] Update global-variables.twig `apply spaceless` instead of `spaceless` https://twig.symfony.com/doc/3.x/filters/spaceless.html#spaceless --- cms/templates/_layouts/global-variables.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/templates/_layouts/global-variables.twig b/cms/templates/_layouts/global-variables.twig index af96c24..938fcb0 100644 --- a/cms/templates/_layouts/global-variables.twig +++ b/cms/templates/_layouts/global-variables.twig @@ -8,7 +8,7 @@ │ htmlPage │ └─────────────────────────────────────────────────────────────────────────────┘ #} -{% spaceless %} +{% apply spaceless %} {# -- Prefetch & preconnect headers and links -- #} {% set prefetchUrls = [ @@ -23,4 +23,4 @@ {% block htmlPage %} {% endblock %} -{% endspaceless %} +{% endapply %}