From 844a96dbbb5f97ebd93b4091e570aac3f48ccc0e Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Fri, 10 Mar 2017 11:48:55 -0500 Subject: [PATCH] Move theme configurations for skin and text into `_data` file --- README.md | 27 ++++++++++++++++++++++++--- _data/theme.yml | 18 ++++++++++++++++++ _includes/contact-list.html | 4 ++-- _includes/entry.html | 2 +- _includes/navigation.html | 2 +- _includes/posts-paginated.html | 4 ++-- _includes/skip-links.html | 8 ++++---- _layouts/home.html | 2 +- assets/stylesheets/main.scss | 2 +- example/_config.yml | 1 - example/_data/theme.yml | 18 ++++++++++++++++++ 11 files changed, 72 insertions(+), 16 deletions(-) create mode 100644 _data/theme.yml create mode 100644 example/_data/theme.yml diff --git a/README.md b/README.md index 799f81f..e3d75fc 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,31 @@ Configuration of site-wide elements (`title`, `description`, `author`, etc.) hap ### 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` | -| `theme_skin: sea` | `theme_skin: soft` | `theme_skin: steel` | +| `skin: default` | `skin: night` | `skin: plum` | +| `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 diff --git a/_data/theme.yml b/_data/theme.yml new file mode 100644 index 0000000..c1712f7 --- /dev/null +++ b/_data/theme.yml @@ -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" \ No newline at end of file diff --git a/_includes/contact-list.html b/_includes/contact-list.html index 9d7ca2e..b5697e3 100644 --- a/_includes/contact-list.html +++ b/_includes/contact-list.html @@ -3,7 +3,7 @@
  • - Email + {{ site.data.theme.t.email | default: 'Email' }}
  • {% endif %} @@ -20,7 +20,7 @@ {% if site.gems contains 'jekyll-feed' %} {% include icon-rss.svg %} - Subscribe + {{ site.data.theme.t.subscribe | default: 'Subscribe' }} {% endif %} diff --git a/_includes/entry.html b/_includes/entry.html index 0325bdd..9f5ee82 100644 --- a/_includes/entry.html +++ b/_includes/entry.html @@ -18,7 +18,7 @@
    {% if post.excerpt %} {{ post.excerpt | markdownify }} -

    Read More {% include icon-arrow-right.svg %}

    +

    {{ site.data.theme.t.read_more | default: 'Read More' }} {% include icon-arrow-right.svg %}

    {% endif %}
    \ No newline at end of file diff --git a/_includes/navigation.html b/_includes/navigation.html index 87e7ba6..ea7f0a7 100644 --- a/_includes/navigation.html +++ b/_includes/navigation.html @@ -3,7 +3,7 @@ diff --git a/_includes/posts-paginated.html b/_includes/posts-paginated.html index ca018b6..142db39 100644 --- a/_includes/posts-paginated.html +++ b/_includes/posts-paginated.html @@ -7,10 +7,10 @@ \ No newline at end of file diff --git a/_includes/skip-links.html b/_includes/skip-links.html index 833d25d..12893ea 100644 --- a/_includes/skip-links.html +++ b/_includes/skip-links.html @@ -1,8 +1,8 @@
    -

    Skip links

    +

    {{ site.data.theme.t.skip_links | default: 'Skip links' }}

    \ No newline at end of file diff --git a/_layouts/home.html b/_layouts/home.html index 7ed50a3..6ec9050 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -10,7 +10,7 @@ layout: default
    -

    Posts{% if paginator.page > 1 %}{{ paginator.page | prepend: ' - Page '}}{{ paginator.total_pages | prepend: ' of ' }}{% endif %}

    +

    {{ 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 %}

    {% if site.gems contains 'jekyll-paginate' and page.paginate %} diff --git a/assets/stylesheets/main.scss b/assets/stylesheets/main.scss index 223db79..0d1db51 100644 --- a/assets/stylesheets/main.scss +++ b/assets/stylesheets/main.scss @@ -5,6 +5,6 @@ @charset "utf-8"; // Theme skin -@import "basically-basic/themes/{{ site.theme_skin | default: 'default' }}"; +@import "basically-basic/themes/{{ site.data.theme.skin | default: 'default' }}"; @import "basically-basic"; \ No newline at end of file diff --git a/example/_config.yml b/example/_config.yml index dde96ab..23a3049 100644 --- a/example/_config.yml +++ b/example/_config.yml @@ -31,7 +31,6 @@ github_username: notareal_github # Build settings markdown: kramdown theme: jekyll-theme-basically-basic -theme_skin: default # default, night, plum, sea, soft, steel gems: - jekyll-feed - jekyll-seo-tag diff --git a/example/_data/theme.yml b/example/_data/theme.yml new file mode 100644 index 0000000..c1712f7 --- /dev/null +++ b/example/_data/theme.yml @@ -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" \ No newline at end of file