diff --git a/templates/partials/header.html b/templates/partials/header.html
index 26d1ffb..943e1fb 100644
--- a/templates/partials/header.html
+++ b/templates/partials/header.html
@@ -15,7 +15,7 @@
{% endif %}
{# Feed #}
-
{# CSS #}
@@ -79,19 +79,32 @@
{% endif %}
-
+
+ {# Add og:locale and hreflang tags for multilingual sites #}
+ {%- if config.languages | length > 0 %}
+ {%- include "partials/multilingual_tags.html" -%}
+ {%- else -%}
+
+ {%- endif %}
+
{# Image for social media sharing #}
{%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), section=section | default(value=""), default_global_value="") -%}
{% if social_media_card %}
+ {%- set meta = get_image_metadata(path=social_media_card, allow_missing=true) -%}
+ {%- if meta -%}
+
+
+ {%- endif -%}
{% endif %}
- {% set current_url = current_url | default(value="/") %}
-
+ {%- if current_url -%}
+
+ {%- endif -%}
diff --git a/templates/partials/multilingual_tags.html b/templates/partials/multilingual_tags.html
new file mode 100644
index 0000000..12357ef
--- /dev/null
+++ b/templates/partials/multilingual_tags.html
@@ -0,0 +1,37 @@
+{# Get the base filename by stripping out any language code and '.md' suffix #}
+{%- if page.relative_path -%}
+ {%- set base_filename = page.relative_path | replace(from=".md", to="") | replace(from="." ~ lang, to="") -%}
+
+ {# Loop through all available languages in config #}
+ {%- for lcode, ldetails in config.languages -%}
+ {%- set translated_filename = base_filename -%}
+
+ {# If the language is not the default language, append the language code to the base filename #}
+ {%- if lcode != config.default_language -%}
+ {%- set translated_filename = base_filename ~ "." ~ lcode -%}
+ {%- endif -%}
+
+ {%- set translated_filename = translated_filename ~ ".md" -%}
+ {%- set translated_page = get_page(path=translated_filename) -%}
+
+ {# Create the og:locale and hreflang tags if the translated page exists #}
+ {%- if translated_page -%}
+
+ {#- Dynamically load the language strings for each language -#}
+ {%- set other_language_strings = load_data(path="i18n/" ~ lcode ~ ".toml", required=false) -%}
+ {%- if not other_language_strings -%}
+ {%- set other_language_strings = load_data(path="themes/tabi/i18n/" ~ lcode ~ ".toml", required=false) -%}
+ {%- endif -%}
+
+
+ {# Construct href for hreflang #}
+ {%- set href = translated_page.permalink -%}
+ {%- if lcode == config.default_language -%}
+ {%- set href = href | replace(from='/' ~ lang ~ '/', to = '/') -%}
+ {%- else -%}
+ {%- set href = href | replace(from='/' ~ lang ~ '/', to='/' ~ lcode ~ '/') -%}
+ {%- endif -%}
+
+ {%- endif -%}
+ {%- endfor -%}
+{%- endif -%}