First commit of i18n base blog using Eleventy v2. This uses English-implied URLs.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ metadata.language }}">
|
||||
<html lang="{{ lang or metadata.language }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -14,6 +14,8 @@
|
||||
<link rel="stylesheet" href="{{ '/css/prism-diff.css' | url }}">
|
||||
<link rel="alternate" href="{{ metadata.feed.path | url }}" type="application/atom+xml" title="{{ metadata.title }}">
|
||||
<link rel="alternate" href="{{ metadata.jsonfeed.path | url }}" type="application/json" title="{{ metadata.title }}">
|
||||
|
||||
{# TODO add link rel="alternate" for langs #}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
@@ -12,14 +12,27 @@ templateClass: tmpl-post
|
||||
|
||||
{{ content | safe }}
|
||||
|
||||
{%- if collections.posts %}
|
||||
{%- set nextPost = collections.posts | getNextCollectionItem(page) %}
|
||||
{%- set previousPost = collections.posts | getPreviousCollectionItem(page) %}
|
||||
{%- if nextPost or previousPost %}
|
||||
<hr>
|
||||
|
||||
{% set i18nLinks = page.url | locale_links %}
|
||||
{% if i18nLinks.length %}
|
||||
<ul>
|
||||
{%- if nextPost %}<li>Next: <a href="{{ nextPost.url | url }}">{{ nextPost.data.title }}</a></li>{% endif %}
|
||||
{%- if previousPost %}<li>Previous: <a href="{{ previousPost.url | url }}">{{ previousPost.data.title }}</a></li>{% endif %}
|
||||
<li>
|
||||
This page is also available in: <!-- don’t forget to localize this text too -->
|
||||
{%- for link in i18nLinks %}
|
||||
{%- if not loop.first %},{% endif %}<a href="{{link.url}}" lang="{{link.lang}}" hreflang="{{link.lang}}">{{link.label}}</a>
|
||||
{%- endfor -%}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{%- if collections.posts %}
|
||||
{%- set previousPost = collections.posts | getPreviousCollectionItem() %}
|
||||
{%- set nextPost = collections.posts | getNextCollectionItem() %}
|
||||
{%- if nextPost or previousPost %}
|
||||
<ul>
|
||||
{%- if previousPost %}<li>Previous: <a href="{{ previousPost.url | locale_url | url }}">{{ previousPost.data.title }}</a></li>{% endif %}
|
||||
{%- if nextPost %}<li>Next: <a href="{{ nextPost.url | locale_url | url }}">{{ nextPost.data.title }}</a></li>{% endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
Reference in New Issue
Block a user