Variable not importing
I have been trying to run four templates using the same code file in the include. Everything works properly except for one of the template. Templates are loaded from three different domains.
However, when I add hsDebug=true, it works on all.
I have spent several hours trying different things, but nothing has worked so far. Anyone has a clue ?? Thank you !
This is the part of the code in the template file :
<!--
templateType: page
isAvailableForNewContent: true
label: Specific
screenshotPath: ../images/template-previews/specific.png
-->
<!doctype html>
<html lang="{{ html_lang }}" {{ html_lang_dir }}>
<head>
<meta charset="utf-8">
{% if page_meta.html_title || pageTitle %}<title>{{ page_meta.html_title || pageTitle }}</title>{% endif %}
{% if site_settings.favicon_src %}<link rel="shortcut icon" href="{{ site_settings.favicon_src }}" />{% endif %}
{% if page_meta.meta_description %}<meta name="description" content="{{ page_meta.meta_description }}">{% endif %}
{{ require_css(get_asset_url("../css/theme.css")) }}
{{ require_css(get_public_template_url("../child.css"), {async:true}) }}
{% if template_css %}
{{ require_css(get_asset_url(template_css), {async:true}) }}
{% endif %}
{{ standard_header_includes }}
{%- import "../macros/shared-meta.html" as shared -%}
{{ shared.load_settings() }}
<script>
var debug_shared_4 = {{ shared | pprint }};
var debug_settings_4 = {{ shared.settings | tojson }};
var debug_data_4 = {{ shared.data | tojson }}
</script>
And this is the included file containing the macro :
<!--
templateType: page
isAvailableForNewContent: false
label: Storefront shared settings.
-->
<!-- Begin partial -->
{% set props = {
"domains": ["domain-a.com", "domain-b.com", "domain-c.com", "domain-d.com"],
"locales": ["en_CA", "en_US", "fr_CA"]
}
%}
{% set course = {} %}
{% set settings = {} %}
{% set data = {} %}
{#
Load storefront settings from the database table settings.
#}
{% macro load_settings() -%}
{% set dom = request.query_dict.domain is defined ? request.query_dict.domain : request.domain %}
{% set loc = request.query_dict.locale is defined ? request.query_dict.locale : locale %}
{% if dom in props.domains %}
{% do props.update({"domain": dom}) %}
{% do data.update({"domain": dom}) %}
{% endif %}
{% if loc in props.locales %}
{% do props.update({"locale": loc}) %}
{% do data.update({"locale": loc}) %}
{% endif %}
{% if data.domain is defined and data.locale is defined %}
{% set settings_filter = "domain=" ~ data.domain ~ "&locale=" ~ data.locale %}
{% set items = hubdb_table_rows("settings", settings_filter) %}
{% for item in items %}
{% do settings.put(item.name,item.value) %}
{% endfor %}
{% endif %}
<script id="shared-meta-debug">
var debug_dom_sh = "{{ dom }}";
var debug_loc_sh = "{{ loc }}";
var debug_settings_sh = {{ settings|tojson }};
</script>
{% endmacro %}





