Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

add more locale support #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions _includes/navigation-sliding.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
{% if page.locale %}
{% assign locale = page.locale %}
{% else %}
{% assign locale = site.locale %}
{% endif %}

{% capture navigation_name %}navigation_{{ locale }}{% endcapture %}
{% if site.data[navigation_name] %}
{% assign navigation = site.data[navigation_name] %}
{% else %}
{% assign navigation = site.data.navigation %}
{% endif %}

<nav role="navigation" id="js-menu" class="sliding-menu-content">
<h5>{{ site.title }} <span>{{ site.data.messages.locales[site.locale].toc }}</span></h5>
<h5>{{ site.title }} <span>{{ site.data.messages.locales[locale].toc }}</span></h5>
<ul class="menu-item">
{% for link in site.data.navigation %}<li>
{% for link in navigation %}<li>
<a href="{{ site.url }}{{ link.url }}">
{% if link.image %}<img src="{{ site.url }}/images/{{ link.image }}" alt="teaser" class="teaser">{% endif %}
<div class="title">{{ link.title }}</div>
{% if link.excerpt %}<p class="excerpt">{{ link.excerpt }}</p>{% endif %}
</a>
</li>{% endfor %}
{% for link in page.navigation %}<li>
<a href="{{ site.url }}{{ link.url }}">
{% if link.image %}<img src="{{ site.url }}/images/{{ link.image }}" alt="teaser" class="teaser">{% endif %}
<div class="title">{{ link.title }}</div>
Expand Down
24 changes: 23 additions & 1 deletion _includes/navigation.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
{% if page.locale %}
{% assign locale = page.locale %}
{% else %}
{% assign locale = site.locale %}
{% endif %}

{% capture navigation_name %}navigation_{{ locale }}{% endcapture %}
{% if site.data[navigation_name] %}
{% assign navigation = site.data[navigation_name] %}
{% else %}
{% assign navigation = site.data.navigation %}
{% endif %}

<ul class="menu-item">
<li class="home"><a href="/">{{ site.title }}</a></li>
{% for link in site.data.navigation %}
{% for link in navigation %}
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url %}
{% endif %}
<li><a href="{{ domain }}{{ link.url }}" {% if link.url contains 'http' %}target="_blank"{% endif %}>{{ link.title }}</a></li>
{% endfor %}

{% for link in page.navigation %}
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
Expand Down
5 changes: 4 additions & 1 deletion _includes/open-graph.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% if page.locale %}
{% assign locale = page.locale %}{% else %}{% assign locale = site.locale %}
{% endif %}
<!-- Twitter Cards -->
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
{% if page.excerpt %}<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">{% endif %}
Expand All @@ -11,7 +14,7 @@
<meta name="twitter:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/{{ site.logo }}{% endif %}">
{% endif %}
<!-- Open Graph -->
<meta property="og:locale" content="{{ site.locale }}">
<meta property="og:locale" content="{{ locale }}">
<meta property="og:type" content="article">
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
{% if page.excerpt %}<meta property="og:description" content="{{ page.excerpt | strip_html }}">{% endif %}
Expand Down
5 changes: 4 additions & 1 deletion _includes/page-author.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{% if page.author %}
{% assign author = site.data.authors[page.author] %}{% else %}{% assign author = site.owner %}
{% endif %}
{% if page.locale %}
{% assign locale = page.locale %}{% else %}{% assign locale = site.locale %}
{% endif %}

<div class="author-image">
<img src="{{ site.url }}/images/{{ author.avatar }}" alt="{{ author.name }}">
</div><!-- ./author-image -->
<div class="author-content">
<h3 class="author-name" >{{ site.data.messages.locales[site.locale].written_by }} {% if author.web %}<a href="{{ author.web }}" itemprop="author">{{ author.name }}</a>{% else %}<span itemprop="author">{{ author.name }}</span>{% endif %}</h3>
<h3 class="author-name" >{{ site.data.messages.locales[locale].written_by }} {% if author.web %}<a href="{{ author.web }}" itemprop="author">{{ author.name }}</a>{% else %}<span itemprop="author">{{ author.name }}</span>{% endif %}</h3>
<p class="author-bio">{{ author.bio }}</p>
</div><!-- ./author-content -->
6 changes: 5 additions & 1 deletion _includes/page-meta.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{% if page.locale %}
{% assign locale = page.locale %}{% else %}{% assign locale = site.locale %}
{% endif %}

{% if page.date %}<div class="page-meta">
<p>{{ site.data.messages.locales[site.locale].updated }} {% if page.modified %}<time datetime="{{ page.modified | date: "%Y-%m-%dT%H:%M:%SZ" }}" itemprop="dateModified">{{ page.modified | date: "%B %d, %Y" }}</time>{% else %}<time datetime="{{ page.date | date: "%Y-%m-%dT%H:%M:%SZ" }}" itemprop="datePublished">{{ page.date | date: "%B %d, %Y" }}</time></p>{% endif %}
<p>{{ site.data.messages.locales[locale].updated }} {% if page.modified %}<time datetime="{{ page.modified | date: "%Y-%m-%dT%H:%M:%SZ" }}" itemprop="dateModified">{{ page.modified | date: "%B %d, %Y" }}</time>{% else %}<time datetime="{{ page.date | date: "%Y-%m-%dT%H:%M:%SZ" }}" itemprop="datePublished">{{ page.date | date: "%B %d, %Y" }}</time></p>{% endif %}
</div><!-- /.page-meta -->{% endif %}
9 changes: 6 additions & 3 deletions _includes/share-this.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% if page.locale %}
{% assign locale = page.locale %}{% else %}{% assign locale = site.locale %}
{% endif %}
<div class="inline-btn">
<a class="btn-social twitter" href="https://twitter.com/intent/tweet?text={{ page.title | escape | replace:' ','%20' }}&amp;url={{ page.url | replace:'index.html','' | prepend: site.url }}&amp;via={{ site.owner.twitter }}" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i> {{ site.data.messages.locales[site.locale].share }} Twitter</a>
<a class="btn-social facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | replace:'index.html','' | prepend: site.url }}" target="_blank"><i class="fa fa-facebook" aria-hidden="true"></i> {{ site.data.messages.locales[site.locale].share }} Facebook</a>
<a class="btn-social google-plus" href="https://plus.google.com/share?url={{ page.url | replace:'index.html','' | prepend: site.url }}" target="_blank"><i class="fa fa-google-plus" aria-hidden="true"></i> {{ site.data.messages.locales[site.locale].share }} Google+</a>
<a class="btn-social twitter" href="https://twitter.com/intent/tweet?text={{ page.title | escape | replace:' ','%20' }}&amp;url={{ page.url | replace:'index.html','' | prepend: site.url }}&amp;via={{ site.owner.twitter }}" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i> {{ site.data.messages.locales[locale].share }} Twitter</a>
<a class="btn-social facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | replace:'index.html','' | prepend: site.url }}" target="_blank"><i class="fa fa-facebook" aria-hidden="true"></i> {{ site.data.messages.locales[locale].share }} Facebook</a>
<a class="btn-social google-plus" href="https://plus.google.com/share?url={{ page.url | replace:'index.html','' | prepend: site.url }}" target="_blank"><i class="fa fa-google-plus" aria-hidden="true"></i> {{ site.data.messages.locales[locale].share }} Google+</a>
</div><!-- /.share-this -->