Skip to content

Commit

Permalink
Use page locale if present
Browse files Browse the repository at this point in the history
Allows a page to override the site locale for this one page.
  • Loading branch information
suhlig committed May 30, 2024
1 parent 9fbb867 commit 570f8d8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 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" lang="{{ post.locale | default: site.locale | replace: "_", "-" | default: "en" }}">
{% 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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">{{ 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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">{{ 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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">{{ page.title }}</h1>
{% endunless %}
{{ content }}
</div>
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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">{{ 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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">
{% 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" lang="{{ page.locale | default: site.locale | replace: "_", "-" | default: "en" }}">
{% 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 570f8d8

Please sign in to comment.