Allow overriding HTML lang on a per-page basis (#4862)

The W3C [recommends](https://www.w3.org/International/questions/qa-html-language-declarations) to specify language using identifiers as per [RFC 5646](https://tools.ietf.org/html/rfc5646) which uses dashes.
This commit is contained in:
Steffen Uhlig 2024-06-15 11:51:28 +02:00 committed by GitHub
parent 7b6b45055c
commit b82680b103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@
{% endif %}
<div class="{{ include.type | default: 'list' }}__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork"{% if post.locale %} lang="{{ post.locale }}"{% endif %}>
{% if include.type == "grid" and teaser %}
<div class="archive__item-teaser">
<img src="{{ teaser | relative_url }}" alt="">

View File

@ -26,7 +26,7 @@
<span class="sep">{{ site.data.ui-text[site.locale].breadcrumb_separator | default: "/" }}</span>
{% endif %}
{% if forloop.last %}
<li class="current">{{ page.title }}</li>
<li class="current"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</li>
{% else %}
{% assign i = i | plus: 1 %}
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">

View File

@ -20,7 +20,7 @@ author_profile: false
<div class="archive">
{% unless page.header.overlay_color or page.header.overlay_image %}
<h1 id="page-title" class="page__title">{{ page.title }}</h1>
<h1 id="page-title" class="page__title"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</h1>
{% endunless %}
{% for post in page.posts %}
{% include archive-single.html %}

View File

@ -19,7 +19,7 @@ layout: default
<div class="archive">
{% unless page.header.overlay_color or page.header.overlay_image %}
<h1 id="page-title" class="page__title">{{ page.title }}</h1>
<h1 id="page-title" class="page__title"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</h1>
{% endunless %}
{{ content }}
</div>

View File

@ -3,7 +3,7 @@
<!doctype html>
{% include copyright.html %}
<html lang="{{ site.locale | slice: 0,2 | default: "en" }}" class="no-js">
<html lang="{{ site.locale | replace: "_", "-" | default: "en" }}" class="no-js">
<head>
{% include head.html %}
{% include head/custom.html %}

View File

@ -17,7 +17,7 @@ layout: default
<div class="archive">
{% unless page.header.overlay_color or page.header.overlay_image %}
<h1 id="page-title" class="page__title">{{ page.title }}</h1>
<h1 id="page-title" class="page__title"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</h1>
{% endunless %}
{{ content }}

View File

@ -21,7 +21,7 @@ layout: default
<div id="main" role="main">
{% include sidebar.html %}
<article class="page" itemscope itemtype="https://schema.org/CreativeWork">
<article class="page" itemscope itemtype="https://schema.org/CreativeWork"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>
{% if page.title %}<meta itemprop="headline" content="{{ page.title | replace: '|', '&#124;' | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date_to_xmlschema }}">{% endif %}

View File

@ -9,7 +9,7 @@ layout: default
{% endif %}
<div id="main" role="main">
<article class="splash" itemscope itemtype="https://schema.org/CreativeWork">
<article class="splash" itemscope itemtype="https://schema.org/CreativeWork"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>
{% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date_to_xmlschema }}">{% endif %}