Add configurable Google Fonts from `_data/theme.yml` file

This commit is contained in:
Michael Rose 2017-03-10 12:35:33 -05:00
parent e6a20b8a28
commit 43654c1a70
4 changed files with 43 additions and 4 deletions

View File

@ -41,6 +41,17 @@ This theme comes in six different skins (color variations). To change skins add
| `skin: default` | `skin: night` | `skin: plum` |
| `skin: sea` | `skin: soft` | `skin: steel` |
### Google Fonts
This theme allows you to easily use [Google Fonts](https://fonts.google.com/) throughout the theme. Simply add the following to your [`/_data/theme.yml`](_data/theme.yml), replacing the font `name` and `weights` accordingly.
```yaml
google_fonts:
- name: "Fira Sans"
weights: "400,400i,600,600i"
- name: "Fira Sans Condensed"
```
### Text
To change text found throughout the theme add the following to your [`/_data/theme.yml`](_data/theme.yml) file and customize as necessary.
@ -66,7 +77,7 @@ t:
By default all internal pages with a `title` will be added to the "off-canvas" menu. For more granular control and sorting of these menu links:
1. Create a custom list to override the default setting by adding a `navigation_pages` array to your `_config.yml` file.
1. Create a custom list to override the default setting by adding a `navigation_pages` array to your [`/_data/themes.yml`](_data/themes.yml) file.
2. Add raw page paths in the order you'd like:

View File

@ -15,4 +15,17 @@ t:
read_more: "Read More"
posts: "Posts"
page: "Page"
of: "of"
of: "of"
# Google Fonts
google_fonts:
- name: "Fira Sans"
weights: "400,400i,600,600i"
# Link to specific internal pages in the navigation.
# Create a custom list to override the default setting of including links to all
# pages that have a `title`. Add raw page paths in the order you'd like.
navigation_pages:
- about.md
- cv.md

View File

@ -22,7 +22,9 @@
</script>
<link rel="stylesheet" href="{{ '/assets/stylesheets/main.css' | relative_url }}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,600,600i">
{% if site.data.theme.google_fonts %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={% for font in site.data.theme.google_fonts %}{{ font.name | replace: ' ', '+' }}{% if font.weights %}:{% endif %}{{ font.weights | remove: ' ' }}{% if forloop.last != true %}|{% endif %}{% endfor %}">
{% endif %}
{% if site.gems contains 'jekyll-feed' %}
{% comment %}

View File

@ -15,4 +15,17 @@ t:
read_more: "Read More"
posts: "Posts"
page: "Page"
of: "of"
of: "of"
# Google Fonts
google_fonts:
- name: "Fira Sans"
weights: "400,400i,600,600i"
# Link to specific internal pages in the navigation.
# Create a custom list to override the default setting of including links to all
# pages that have a `title`. Add raw page paths in the order you'd like.
navigation_pages:
- about.md
- cv.md