header - Liquid Tag Reference - 0.11.4
Tag Name | header |
Version | 0.11.4 |
Description
The header
tag can be used to set HTTP Response headers for a given page. You can set any header you like, though you should only do so if you know what you are doing. Some headers are core to the platform and will be overwritten by the platform if you set them.
This tag only has an effect when used in layout or page templates.
Examples
You want to set the Content-Security-Policy header for just the home page. You can do this by using the header
tag in your theme layout:
{%- if current_page.identifier == "home" %}
{%- header name: "Content-Security-Policy", value: "frame-ancestors 'self' example.com;" %}
{%- endif %}
...
Content-Security-Policy: frame-ancestors 'self' example.org;
...
Back to Liquid Reference for 0.11.4
Back to Documentation