Skip to content

Commit

Permalink
🐛 fix: allow live reload when zola is in serve mode
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo committed Sep 9, 2023
1 parent 772ca29 commit 82e372e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions templates/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,28 @@
{%- set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk -%}
{%- set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso -%}
{#- Initialise a base connect-src directive -#}
{%- set connect_src = "connect-src 'self'" -%}

{%- if hyvortalk_enabled -%}
connect-src talk.hyvor.com;
{%- set connect_src = connect_src ~ " talk.hyvor.com" -%}
{%- elif isso_enabled -%}
connect-src {{ config.extra.isso.endpoint_url }};
{%- set connect_src = connect_src ~ " " ~ config.extra.isso.endpoint_url -%}
{%- endif -%}

{#- Append WebSocket for Zola serve mode -#}
{%- if config.mode == "serve" -%}
{%- set connect_src = connect_src ~ " ws:" -%}
{%- endif -%}

{%- for domain in config.extra.allowed_domains -%}
{%- if domain.directive == "connect-src" -%}
{%- set configured_connect_src = domain.domains | join(sep=' ') -%}
{%- set_global connect_src = connect_src ~ " " ~ configured_connect_src -%}
{%- continue -%}
{%- endif -%}

{#- Handle directives that are not connect-src -#}
{{ domain.directive }} {{ domain.domains | join(sep=' ') -}}

{% if utterances_enabled or hyvortalk_enabled -%}
Expand All @@ -134,6 +149,10 @@
;
{%- endif -%}
{%- endfor -%}

{#- Insert the generated connect-src -#}
{{ ";" ~ connect_src }}

{%- endif -%}">

{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
Expand Down

0 comments on commit 82e372e

Please sign in to comment.