Skip to content

Commit f23a1fe

Browse files
Merge pull request #176 from shulard/feature/meta-alternate
Add html meta to declare that languages are now alive!
2 parents 6eaa62f + 8adb786 commit f23a1fe

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

_config.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ navigation:
3030
url: /restful/
3131
languages:
3232
- label: English
33+
iso-alpha2: en
3334
path: /
3435
- label: Japanese
36+
iso-alpha2: ja
3537
path: /ja/
3638
- label: Français
39+
iso-alpha2: fr
3740
path: /fr/
3841
- label: Português (Brasil)
42+
iso-alpha2: br
3943
path: /br/
4044
- label: Türkçe
41-
path: /tr/
45+
iso-alpha2: tr
46+
path: /tr/

_includes/header.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<!DOCTYPE html>
2-
<html>
1+
<!DOCTYPE html>{% assign hreflang = 'en' %}{% for lang in site.languages %}{% if lang.path == page.url %}{% assign hreflang = lang.iso-alpha2 %}{% endif %}{% endfor %}
2+
<html hreflang="{{hreflang}}">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -14,14 +14,16 @@
1414

1515
<title>{{ page.title }} | WP-CLI</title>
1616
<meta name="description" content="{{ page.description }}">
17+
18+
{% for lang in site.languages %}<link rel="alternate" hreflang="{{lang.iso-alpha2}}" href="{{site.url}}{{lang.path}}" />
19+
{% endfor %}
1720
</head>
1821

1922
{% if page.display_global_parameters %}
2023
<body class="display-global-parameters">
2124
{% else %}
2225
<body>
2326
{% endif %}
24-
2527
<header class="cf">
2628
<div class="container">
2729
<h1><a href="/">WP-CLI</a></h1>
@@ -33,7 +35,7 @@ <h2>A command line interface for WordPress</h2>
3335
{% endif %}
3436

3537
{% include navigation.html %}
36-
{% include languages.html %}
38+
{% include languages.html %}
3739
</div>
3840
</header>
3941

0 commit comments

Comments
 (0)