Skip to content

Commit

Permalink
Allow overriding HTML lang on a per-page basis (mmistakes#4862)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
suhlig authored and minyoongi96 committed Aug 26, 2024
1 parent 2a74e3e commit 463fd47
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _includes/archive-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -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="">
Expand Down
2 changes: 1 addition & 1 deletion _includes/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion _layouts/archive-taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<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 %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<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>
Expand Down
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<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 }}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<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 %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/splash.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% 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 %}
Expand Down

0 comments on commit 463fd47

Please sign in to comment.