Twig template outputting blank page on non-"dev" environment I've created a base twig template which contains some basic &quot;maintenance mode&quot; logic. This works perfectly as long as the main ENVIRONMENT in the .env file is set as dev, but fails for staging or production.
{% if site.maintenanceMode is defined and site.maintenanceMode %}
    {% if site.maintenanceIpAddress is defined %}
        {% set currentIpAddress = craft.app.request.userIP %}
        {% if currentIpAddress != site.maintenanceIpAddress %}
            {% include('/maintenance') %}
            {% exit %}
        {% endif %}
    {% else %}
        {% include('/maintenance') %}
        {% exit %}
    {% endif %}
{% endif %}
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;…

Being fairly new to CraftCMS, I'm somewhat at a loss as to why this might be occurring and there's nothing in either the …/storage/logs/web.log file or the main nginx error log file. (In short no errors appear to be being thrown.)
I've tried flushing all of the available caches (including the template cache, etc.) and rebuilding the config, etc. to no avail.
It looks like you're reinventing the wheel here: in Settings → General, you can toggle the site live/offline. When the site is offline, Craft serve the templates/503.twig templates, no matter which URL you hit.
You can even configure users to have access to the site, when it's offline. To do so, go to the user edit page in the control panel and then to the Preferences tab.

Regarding your specific blank page issue, it's caused by a mixup between the Twig include function &amp; the Twig include tag.
Function
As per the documentation:

The include function returns the rendered content of a template.

You then have to do something with the returned value or it is pointless.
Tag
The documentation of this tag is misleading. It states that :

The include statement includes a template and returns the rendered content of that file

but what it really does is output the rendered content of that file.
In your case, you use the function but forget to output its value. To fix you're issue, you can either use output delimiters ({{ include('/maintenance') }}) or use the tag instead of the function ({% include'/maintenance' %}).
The documentation of the include tag encourages us to prefer the former:
As of Twig 1.12, it is recommended to use the include function instead as it provides the same features with a bit more flexibility
Solution
TL;DR
Use {{ include('/maintenance') }}.