{# add page content #}
{{ page.content }}
{# add global contents on the root page, unless told not to #}
{% if page.meta.contents == "global" or ( page.is_homepage and page.meta.contents not in ("local", "none") ) %}
{% include "partials/global_contents.html" %}
{# add local contents on section homepages, unless told not to #}
{% elif page.meta.contents == "local" or ( page.parent and page == page.parent.children[0] and page.meta.contents not in ("global", "none") ) %}
{% include "partials/local_contents.html" %}
{% endif %}
{# add a back arrow if there's a parent to go back to #}
{% if page.parent %}
{% include "partials/backlink.html" %}
{% endif %}
{%- for script in config.extra_javascript %}
{{ script | script_tag }}
{%- endfor %}