🐛 fix(header): check if translations exist while building tags (#159)
This commit is contained in:
parent
ecaf0f1221
commit
271f54ca79
@ -16,10 +16,16 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- set translated_filename = translated_filename ~ ".md" -%}
|
{%- set translated_filename = translated_filename ~ ".md" -%}
|
||||||
|
|
||||||
{%- if page.relative_path -%}
|
{# Check if the translated page or section exists #}
|
||||||
{%- set translated_page = get_page(path=translated_filename) -%}
|
{%- set translation_exists = load_data(path=translated_filename, required=false) -%}
|
||||||
{%- else -%}
|
|
||||||
{%- set translated_page = get_section(path=translated_filename) -%}
|
{# Get the page #}
|
||||||
|
{%- if translation_exists -%}
|
||||||
|
{%- if page.relative_path -%}
|
||||||
|
{%- set translated_page = get_page(path=translated_filename, metadata_only=true) -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set translated_page = get_section(path=translated_filename, metadata_only=true) -%}
|
||||||
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{# Create the og:locale and hreflang tags if the translated page exists #}
|
{# Create the og:locale and hreflang tags if the translated page exists #}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user