Move theme configurations for skin and text into `_data` file

This commit is contained in:
Michael Rose 2017-03-10 11:48:55 -05:00
parent 9be9905da8
commit 844a96dbbb
11 changed files with 72 additions and 16 deletions

View File

@ -36,10 +36,31 @@ Configuration of site-wide elements (`title`, `description`, `author`, etc.) hap
### Skin ### Skin
This theme comes in six different skins (color variations). To change skins edit your project's `_config.yml` to one of the following: This theme comes in six different skins (color variations). To change skins add one of the following to your [`/_data/theme.yml`](_data/theme.yml) file:
| `theme_skin: default` | `theme_skin: night` | `theme_skin: plum` | | `skin: default` | `skin: night` | `skin: plum` |
| `theme_skin: sea` | `theme_skin: soft` | `theme_skin: steel` | | `skin: sea` | `skin: soft` | `skin: steel` |
### Text
To change text found throughout the theme add the following to your [`/_data/theme.yml`](_data/theme.yml) file and customize as necessary.
```yaml
t:
skip_links: "Skip links"
skip_primary_nav: "Skip to primary navigation"
skip_content: "Skip to content"
skip_footer: "Skip to footer"
home: "Home"
newer: "Newer"
older: "Older"
email: "Email"
subscribe: "Subscribe"
read_more: "Read More"
posts: "Posts"
page: "Page"
of: "of"
```
### Navigation ### Navigation

18
_data/theme.yml Normal file
View File

@ -0,0 +1,18 @@
# Theme Skin
skin: default # default, night, plum, sea, soft, steel
# Theme Text
t:
skip_links: "Skip links"
skip_primary_nav: "Skip to primary navigation"
skip_content: "Skip to content"
skip_footer: "Skip to footer"
home: "Home"
newer: "Newer"
older: "Older"
email: "Email"
subscribe: "Subscribe"
read_more: "Read More"
posts: "Posts"
page: "Page"
of: "of"

View File

@ -3,7 +3,7 @@
<li> <li>
<a href="mailto:{{ site.email }}"> <a href="mailto:{{ site.email }}">
<span class="icon icon--email">{% include icon-email.svg %}</span> <span class="icon icon--email">{% include icon-email.svg %}</span>
<span class="label">Email</span> <span class="label">{{ site.data.theme.t.email | default: 'Email' }}</span>
</a> </a>
</li> </li>
{% endif %} {% endif %}
@ -20,7 +20,7 @@
{% if site.gems contains 'jekyll-feed' %} {% if site.gems contains 'jekyll-feed' %}
<a href="{{ site.feed.path | default: 'feed.xml' | relative_url }}" title="Atom Feed"> <a href="{{ site.feed.path | default: 'feed.xml' | relative_url }}" title="Atom Feed">
<span class="icon icon--rss">{% include icon-rss.svg %}</span> <span class="icon icon--rss">{% include icon-rss.svg %}</span>
<span class="label">Subscribe</span> <span class="label">{{ site.data.theme.t.subscribe | default: 'Subscribe' }}</span>
</a> </a>
{% endif %} {% endif %}
</li> </li>

View File

@ -18,7 +18,7 @@
<div class="entry-excerpt"> <div class="entry-excerpt">
{% if post.excerpt %} {% if post.excerpt %}
{{ post.excerpt | markdownify }} {{ post.excerpt | markdownify }}
<p><a href="{{ post.url | relative_url }}" class="more-link">Read More <span class="icon icon--arrow-right">{% include icon-arrow-right.svg %}</span></a></p> <p><a href="{{ post.url | relative_url }}" class="more-link">{{ site.data.theme.t.read_more | default: 'Read More' }} <span class="icon icon--arrow-right">{% include icon-arrow-right.svg %}</span></a></p>
{% endif %} {% endif %}
</div> </div>
</article> </article>

View File

@ -3,7 +3,7 @@
<!-- Home link --> <!-- Home link -->
<li class="menu-item"> <li class="menu-item">
<a href="{{ '/' | relative_url }}" itemprop="url"> <a href="{{ '/' | relative_url }}" itemprop="url">
<span itemprop="name">Home</span> <span itemprop="name">{{ site.data.theme.t.home | default: 'Home' }}</span>
</a> </a>
</li> </li>

View File

@ -7,10 +7,10 @@
<ul> <ul>
<!-- Page: {{ paginator.page }} of {{ paginator.total_pages }} --> <!-- Page: {{ paginator.page }} of {{ paginator.total_pages }} -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous"><span class="icon icon--arrow-right">{% include icon-arrow-left.svg %}</span> Newer</a></li> <li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous"><span class="icon icon--arrow-right">{% include icon-arrow-left.svg %}</span> {{ site.data.theme.t.newer | default: 'Newer' }}</a></li>
{% endif %} {% endif %}
{% if paginator.next_page %} {% if paginator.next_page %}
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next">Older <span class="icon icon--arrow-right">{% include icon-arrow-right.svg %}</span></a></li> <li><a href="{{ paginator.next_page_path | relative_url }}" class="next">{{ site.data.theme.t.older | default: 'Older' }} <span class="icon icon--arrow-right">{% include icon-arrow-right.svg %}</span></a></li>
{% endif %} {% endif %}
</ul> </ul>
</nav> </nav>

View File

@ -1,8 +1,8 @@
<section> <section>
<h2 class="screen-reader-text">Skip links</h2> <h2 class="screen-reader-text">{{ site.data.theme.t.skip_links | default: 'Skip links' }}</h2>
<ul class="skip-links"> <ul class="skip-links">
<li><a href="#primary-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li> <li><a href="#primary-nav" class="screen-reader-shortcut">{{ site.data.theme.t.skip_primary_nav | default: 'Skip to primary navigation' }}</a></li>
<li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li> <li><a href="#main" class="screen-reader-shortcut">{{ site.data.theme.t.skip_content | default: 'Skip to content' }}</a></li>
<li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li> <li><a href="#footer" class="screen-reader-shortcut">{{ site.data.theme.t.skip_footer | default: 'Skip to footer' }}</a></li>
</ul> </ul>
</section> </section>

View File

@ -10,7 +10,7 @@ layout: default
<div> <div>
<header class="section-title"> <header class="section-title">
<h2>Posts{% if paginator.page > 1 %}{{ paginator.page | prepend: ' - Page '}}{{ paginator.total_pages | prepend: ' of ' }}{% endif %}</h2> <h2>{{ site.data.theme.t.posts | default: 'Posts' }}{% if paginator.page > 1 %}{{ site.data.theme.t.page | default: 'Page' | prepend: ' - ' | append: ' ' }}{{ paginator.page }} {{ site.data.theme.t.of | default: 'of' }} {{ paginator.total_pages }}{% endif %}</h2>
</header> </header>
<div class="entries"> <div class="entries">
{% if site.gems contains 'jekyll-paginate' and page.paginate %} {% if site.gems contains 'jekyll-paginate' and page.paginate %}

View File

@ -5,6 +5,6 @@
@charset "utf-8"; @charset "utf-8";
// Theme skin // Theme skin
@import "basically-basic/themes/{{ site.theme_skin | default: 'default' }}"; @import "basically-basic/themes/{{ site.data.theme.skin | default: 'default' }}";
@import "basically-basic"; @import "basically-basic";

View File

@ -31,7 +31,6 @@ github_username: notareal_github
# Build settings # Build settings
markdown: kramdown markdown: kramdown
theme: jekyll-theme-basically-basic theme: jekyll-theme-basically-basic
theme_skin: default # default, night, plum, sea, soft, steel
gems: gems:
- jekyll-feed - jekyll-feed
- jekyll-seo-tag - jekyll-seo-tag

18
example/_data/theme.yml Normal file
View File

@ -0,0 +1,18 @@
# Theme Skin
skin: default # default, night, plum, sea, soft, steel
# Theme Text
t:
skip_links: "Skip links"
skip_primary_nav: "Skip to primary navigation"
skip_content: "Skip to content"
skip_footer: "Skip to footer"
home: "Home"
newer: "Newer"
older: "Older"
email: "Email"
subscribe: "Subscribe"
read_more: "Read More"
posts: "Posts"
page: "Page"
of: "of"