jekyll-wren 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +9 -0
- data/README.md +177 -0
- data/_includes/custom-foot.html +4 -0
- data/_includes/custom-head.html +13 -0
- data/_includes/custom-meta.html +5 -0
- data/_includes/footer.html +23 -0
- data/_includes/head.html +21 -0
- data/_includes/meta.html +82 -0
- data/_includes/navigation.html +70 -0
- data/_includes/reading-time.html +41 -0
- data/_includes/social-list.html +46 -0
- data/_includes/video-player.html +66 -0
- data/_layouts/author-list.html +73 -0
- data/_layouts/default.html +16 -0
- data/_layouts/error.html +9 -0
- data/_layouts/page.html +14 -0
- data/_layouts/post-list.html +67 -0
- data/_layouts/post.html +16 -0
- data/_layouts/tag-list.html +54 -0
- data/_sass/wren/content.scss +345 -0
- data/_sass/wren/initialize.scss +118 -0
- data/_sass/wren/layout.scss +295 -0
- data/assets/apple-touch-icon.png +0 -0
- data/assets/flav.svg +4 -0
- data/assets/nav-icons/about.svg +3 -0
- data/assets/nav-icons/blog.svg +3 -0
- data/assets/nav-icons/comments.svg +3 -0
- data/assets/nav-icons/default.svg +3 -0
- data/assets/nav-icons/home.svg +4 -0
- data/assets/nav-icons/rss.svg +3 -0
- data/assets/nav-icons/top.svg +3 -0
- data/assets/nav-icons/work.svg +5 -0
- data/assets/social-icons/Blogger.svg +3 -0
- data/assets/social-icons/DEV.svg +3 -0
- data/assets/social-icons/Default.svg +3 -0
- data/assets/social-icons/Dribbble.svg +3 -0
- data/assets/social-icons/Facebook.svg +3 -0
- data/assets/social-icons/Flickr.svg +3 -0
- data/assets/social-icons/Ghost.svg +3 -0
- data/assets/social-icons/GitHub.svg +3 -0
- data/assets/social-icons/GitLab.svg +3 -0
- data/assets/social-icons/Instagram.svg +5 -0
- data/assets/social-icons/Keybase.svg +6 -0
- data/assets/social-icons/LinkedIn.svg +3 -0
- data/assets/social-icons/Mastodon.svg +3 -0
- data/assets/social-icons/Medium.svg +5 -0
- data/assets/social-icons/Micro.blog.svg +3 -0
- data/assets/social-icons/Pinterest.svg +3 -0
- data/assets/social-icons/Reddit.svg +3 -0
- data/assets/social-icons/StackOverflow.svg +3 -0
- data/assets/social-icons/Telegram.svg +3 -0
- data/assets/social-icons/Tumblr.svg +3 -0
- data/assets/social-icons/Twitter.svg +3 -0
- data/assets/social-icons/Wordpress.svg +4 -0
- data/assets/social-icons/YouTube.svg +3 -0
- data/assets/style.scss +14 -0
- data/errors/400.md +9 -0
- data/errors/403.md +9 -0
- data/errors/404.md +9 -0
- data/errors/418.md +12 -0
- data/errors/500.md +9 -0
- data/images/profile-hq.jpg +0 -0
- data/images/profile.jpg +0 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 880063b3f3f71125016ffc145ad9c1928d83a3b101de7ce4b8331f1a37080d71
|
4
|
+
data.tar.gz: 79f38b62a4c74603e458b7a5c385a084c91b8add5aa9ec1fa13f8f96c6229791
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 555cfb22eea2cde9883d0fea0fdf78da7a435771b37623d3d229f858f238e130d7db845ad44b2e8293200acbdcf40bbdbe76d3ac7a22c12e828f87f3a44a9af0
|
7
|
+
data.tar.gz: 61aabed58c5665fe218f7397de35d00e89c914b4a34404b9b33fecbe02e46b27181c83770753e0ff1667a1ea8eea6e5e012f2dc76469b82ac5b125b1476fd04e
|
data/LICENSE.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Josh Fogg
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# Wren
|
2
|
+
|
3
|
+
[![Jekyll CI Status]][jekyll-ci-link]
|
4
|
+
[![CodeFactor Rating]][codefactor-link]
|
5
|
+
[![MIT Licensed]][license-link]
|
6
|
+
|
7
|
+
[Jekyll CI Status]: https://img.shields.io/github/workflow/status/Foggalong/Wren/Jekyll%20CI?label=Jekyll%20CI
|
8
|
+
[jekyll-ci-link]: https://github.com/Foggalong/Wren/actions/workflows/codeql-analysis.yml
|
9
|
+
[CodeFactor Rating]: https://img.shields.io/codefactor/grade/github/foggalong/wren/main?color&label=CodeFactor
|
10
|
+
[codefactor-link]: https://www.codefactor.io/repository/github/foggalong/wren
|
11
|
+
[MIT Licensed]: https://img.shields.io/badge/License-MIT-brightgreen.svg
|
12
|
+
[license-link]: #licenses
|
13
|
+
|
14
|
+
A paper-style theme for [Jekyll]. Check out the GitHub pages [deployment] to see what the default looks like and read on for information on usage and customisation. Be aware that this **beta** software so will contain bugs; use it at your own risk.
|
15
|
+
|
16
|
+
[Jekyll]: https://jekyllrb.com
|
17
|
+
[deployment]: https://foggalong.github.io/Wren
|
18
|
+
[wiki]: https://github.com/Foggalong/Wren/wiki
|
19
|
+
|
20
|
+
## Features
|
21
|
+
|
22
|
+
- 🎨 Responsive, [customisable] design
|
23
|
+
- 🕔 See post reading time
|
24
|
+
- 🗄️ 'First published on' icons
|
25
|
+
- 🏷️ Browse posts by tags
|
26
|
+
- 🧑 Browse posts by author
|
27
|
+
- 📺 Embedded [YouTube, Twitch, etc][videos]
|
28
|
+
- 🦶🏼 [Extendable] head, foot, and post meta
|
29
|
+
- 📃 Optional [pagination]
|
30
|
+
- 📰 Atom/RSS feed of posts
|
31
|
+
- 📈 In-built search engine optimization
|
32
|
+
|
33
|
+
[customisable]: #custom-styling
|
34
|
+
[videos]: https://foggalong.github.io/Wren/video-embed-demo
|
35
|
+
[extendable]: #custom-templates
|
36
|
+
[pagination]: #pagination
|
37
|
+
|
38
|
+
## Installing
|
39
|
+
|
40
|
+
Whether you fork this repo or start from scratch there are two supported options for using Wren as your theme. Which works better for you will depend on your personal priorities.
|
41
|
+
|
42
|
+
### Theme Gem
|
43
|
+
|
44
|
+
Use the `jekyll-wren` gem, fetched automatically from [RubyGems] or downloaded from the [releases page] and installed locally. Either way you'll need to add
|
45
|
+
|
46
|
+
```yaml
|
47
|
+
theme: jekyll-wren
|
48
|
+
```
|
49
|
+
|
50
|
+
to your [config] and
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
gem "jekyll-wren", "~> 0.4"
|
54
|
+
```
|
55
|
+
|
56
|
+
to your [Gemfile] plugins list.
|
57
|
+
|
58
|
+
The upsides are that builds will be quicker and you'll have more control over the version through the Gemfile. The downside is that it will prevent building with GitHub Pages' builder since Wren isn't on the [whitelist] (though you'll still be able to build locally and push to a GitHub pages branch/repo).
|
59
|
+
|
60
|
+
[RubyGems]: https://rubygems.org
|
61
|
+
[releases page]: https://github.com/Foggalong/Wren/releases/latest
|
62
|
+
[config]: https://github.com/Foggalong/Wren/blob/main/_config.yml#L22-L23
|
63
|
+
[Gemfile]: https://github.com/Foggalong/Wren/blob/main/Gemfile#L22-L28
|
64
|
+
|
65
|
+
### Remote Theme
|
66
|
+
|
67
|
+
It's possible to use the theme directly from this repo. You'll need to add
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
plugins:
|
71
|
+
- jekyll-remote-theme
|
72
|
+
|
73
|
+
remote_theme: foggalong/wren@0.4
|
74
|
+
```
|
75
|
+
|
76
|
+
to your [config] and then
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
gem "jekyll-remote-theme", "~> 0.4"
|
80
|
+
```
|
81
|
+
|
82
|
+
to your [Gemfile] plugins list.
|
83
|
+
|
84
|
+
The upside is that this will work with GitHub Pages' builder ([Jekyll Remote Theme] is on the [whitelist]). The downsides are that builds will be slower and your [version control] is slightly weaker; you're tied to `HEAD` or a specific version.
|
85
|
+
|
86
|
+
[Jekyll Remote Theme]: https://github.com/benbalter/jekyll-remote-theme
|
87
|
+
[version control]: https://github.com/benbalter/jekyll-remote-theme#declaring-your-theme
|
88
|
+
|
89
|
+
## Config Options
|
90
|
+
|
91
|
+
The [config.yml] in this repo can be used as a template for your own Wren instance. The file is thoroughly commented so it's worth having a read to know all the options available.
|
92
|
+
|
93
|
+
[config.yml]: https://github.com/Foggalong/Wren/blob/main/_config.yml
|
94
|
+
|
95
|
+
## Custom Templates
|
96
|
+
|
97
|
+
[Minima] has a feature which allows users to create a [_includes/custom-head.html] file which is then [included] with the rest of the head. This is a useful feature if, for example, you want your website to cover favicons for more browsers than the default setup does.
|
98
|
+
|
99
|
+
[_includes/custom-head.html]: https://github.com/jekyll/minima/blob/master/_includes/custom-head.html
|
100
|
+
[included]: https://github.com/jekyll/minima/blob/master/_includes/head.html#L12
|
101
|
+
|
102
|
+
Wren keeps this feature and extends it so that `custom-foot.html` (displayed above the copyright notice) and `custom-meta.html` (displayed at the end of a post's meta line) can also be specified.
|
103
|
+
|
104
|
+
## Custom Styling
|
105
|
+
|
106
|
+
Like [Minima] (on which Wren's [SASS] is built) there are a whole bunch of variables which you can change to personalise the theme. To do this you just add lines such as
|
107
|
+
|
108
|
+
```scss
|
109
|
+
$background-color: #3d9da3;
|
110
|
+
```
|
111
|
+
|
112
|
+
to [`assets/style.scss`] and you're good to go. The list of what's customisable is slightly different (and longer!) than Minima so have a look at the full list of [style variables].
|
113
|
+
|
114
|
+
[Minima]: https://github.com/jekyll/minima
|
115
|
+
[`assets/style.scss`]: https://github.com/Foggalong/Wren/blob/main/assets/style.scss
|
116
|
+
[style variables]: https://github.com/Foggalong/Wren/blob/main/_sass/wren/initialize.scss#L10-L87
|
117
|
+
|
118
|
+
## Pagination
|
119
|
+
|
120
|
+
If the following two [config.yml] lines aren't commented, Wren will use [Jekyll Paginate][Paginate] to split the posts page into multiple pages of `paginate` many posts with url `paginate_path`.
|
121
|
+
|
122
|
+
```yaml
|
123
|
+
paginate: 5
|
124
|
+
paginate_path: "/blog/:num"
|
125
|
+
```
|
126
|
+
|
127
|
+
Note that due to [Paginate]'s technical limitations this will only happen on the main posts page, not other post lists such as the tags page. It's generally quite limited in how it works compared to [Paginate v2], but the latter isn't on the [whitelist].
|
128
|
+
|
129
|
+
Another caveat is that, if you're using Paginate, the main post list page **must** have filename `index.html`; that's why in this repo it's `blog/index.html`. If you're not using Paginate though, Wren allows you to put that file anywhere and called whatever you like without problems.
|
130
|
+
|
131
|
+
[Paginate v2]: https://github.com/sverrirs/jekyll-paginate-v2
|
132
|
+
|
133
|
+
## Error Pages
|
134
|
+
|
135
|
+
Wren includes [`error.html`], a layout for formatting error pages; they're centered, have different spacing, and slightly different `<h1>` formatting. In [`errors/`] there are some examples; those aren't in the theme-gem (see [#25]) but to use them just copy to your website's repo. See this [tutorial] for configuring error pages on GitHub pages, Apache, and Nginx.
|
136
|
+
|
137
|
+
[`error.html`]: https://github.com/Foggalong/Wren/blob/main/_layouts/error.html
|
138
|
+
[`errors/`]: https://github.com/Foggalong/Wren/tree/main/errors
|
139
|
+
[#25]: https://github.com/Foggalong/Wren/issues/25
|
140
|
+
[tutorial]: https://jekyllrb.com/tutorials/custom-404-page
|
141
|
+
|
142
|
+
## Philosophy
|
143
|
+
|
144
|
+
I ❤️ [Wrens]. They're smol, quick, and rotund. When I was little we had a family of them come nest in our garden and they sang the most brilliant songs. Oh wait? You're saying this was supposed to be the project's philosophy? Let's just just say it's to be small, fast, and round.
|
145
|
+
|
146
|
+
[Wrens]: https://en.wikipedia.org/wiki/Wren
|
147
|
+
|
148
|
+
## Licenses
|
149
|
+
|
150
|
+
Wren is released under the [MIT License] and is built with [Jekyll] and a whole host of other MIT licensed projects.
|
151
|
+
|
152
|
+
[MIT License]: https://choosealicense.com/licenses/mit
|
153
|
+
|
154
|
+
In order to remain compatible with GitHub Pages Wren only uses plugins from the [whitelist]. Massive props to [Remote Theme], [Feed], [Paginate], and [SEO] for doing their thing in the background without me needing to worry about it. Further features are achieved through [Liquid] templates, some of which are based on existing Ruby plugins. These include [Reading Time], [Embed Video], [Tag Cloud].
|
155
|
+
|
156
|
+
[whitelist]: https://pages.github.com/versions
|
157
|
+
[Remote Theme]: https://github.com/benbalter/jekyll-remote-theme
|
158
|
+
[Feed]: https://github.com/jekyll/jekyll-feed
|
159
|
+
[Paginate]: https://github.com/jekyll/jekyll-paginate
|
160
|
+
[SEO]: https://github.com/jekyll/jekyll-seo-tag
|
161
|
+
[Liquid]: https://github.com/Shopify/liquid
|
162
|
+
[Reading Time]: https://github.com/risan/jekyll-reading-time
|
163
|
+
[Embed Video]: https://github.com/nathancy/jekyll-embed-video
|
164
|
+
[Tag Cloud]: https://superdevresources.com/tag-cloud-jekyll
|
165
|
+
|
166
|
+
Style wise, Wren's [SASS] is forked from [Minima] which proved crucial in knowing what did and didn't need to be covered by Jekyll themes. The icons (apart from are based on designs from [Font Awesome], redrawn for the smaller form factor. Credit also to Antoine Boulanger's guide on [SVG Favicons].
|
167
|
+
|
168
|
+
[SASS]: https://sass-lang.com
|
169
|
+
[Font Awesome]: https://github.com/Rush/Font-Awesome-SVG-PNG
|
170
|
+
[SVG Favicons]: https://link.medium.com/oDf4MMhiqjb
|
171
|
+
|
172
|
+
The only part of Wren _not_ MIT licensed is the [default profile image], a [CC-BY-NC] licensed [photo] of a Bewick Wren taken by [Minette Layne].
|
173
|
+
|
174
|
+
[default profile image]: images/profile-hq.jpg
|
175
|
+
[photo]: https://flic.kr/p/4E9FY2
|
176
|
+
[Minette Layne]: https://www.flickr.com/people/minette_layne
|
177
|
+
[CC-BY-NC]: https://creativecommons.org/licenses/by-nc/2.0
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{% comment %}
|
2
|
+
Placeholder to allow defining custom head. In principle, you can add
|
3
|
+
anything here, e.g. favicons.
|
4
|
+
|
5
|
+
If you have a website that you anticipate people using as a webapp on
|
6
|
+
iOS, Android, or Windows 8 or Windows 10 then it would be worth head
|
7
|
+
over to https://realfavicongenerator.net/ to add your own favicons and
|
8
|
+
insetting the code snippets they give into _includes/custom-head.html
|
9
|
+
in your source directory.
|
10
|
+
|
11
|
+
The favicons Wren provides are the absolute minimum to cover modern
|
12
|
+
browsers. See here for more info: https://link.medium.com/oDf4MMhiqjb
|
13
|
+
{% endcomment %}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<footer class="site-footer h-card">
|
2
|
+
<data class="u-url" href="{{ "/" | relative_url }}"></data>
|
3
|
+
{%comment%} add user's custom footer; anything can go here! {%endcomment%}
|
4
|
+
{%- include custom-foot.html -%}
|
5
|
+
{%comment%} keeps copyright notice to current year {%endcomment%}
|
6
|
+
Copyright © {{ site.time | date: '%Y' }}
|
7
|
+
{%- if site.author %}
|
8
|
+
{% if site.author.name -%}
|
9
|
+
{% if site.author.email -%}
|
10
|
+
<a href="mailto:{{ site.author.email }}">{{ site.author.name }}</a>
|
11
|
+
{% else -%}
|
12
|
+
{{ site.author.name }}
|
13
|
+
{%- endif %}
|
14
|
+
{%- endif %}
|
15
|
+
{%- endif -%}
|
16
|
+
{%comment%} remove line below if you don't want to attribute Jekyll/Wren {%endcomment%}
|
17
|
+
· Made using <a href="https://jekyllrb.com">Jekyll</a> with <a href="https://github.com/Foggalong/Wren">Wren</a>
|
18
|
+
|
19
|
+
{%comment%} social-list.html quite big so in a separate file {%endcomment%}
|
20
|
+
<div class="social-list">
|
21
|
+
{%- include social-list.html -%}
|
22
|
+
</div>
|
23
|
+
</footer>
|
data/_includes/head.html
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
<head>
|
2
|
+
<meta charset="utf-8">
|
3
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
{%comment%} jekyll-seo-tag doing its thing {%endcomment%}
|
6
|
+
{%- seo -%}
|
7
|
+
{%comment%}
|
8
|
+
using SVG favicons, see link below for documentation. In theory the flav.svg will
|
9
|
+
cover all modern browsers except iOS Safari which the apple-touch-icon.png covers
|
10
|
+
https://medium.com/swlh/are-you-using-svg-favicons-yet-a-guide-for-modern-browsers
|
11
|
+
{%endcomment%}
|
12
|
+
<link rel="icon" href="{{ '/assets/flav.svg' | relative_url }}">
|
13
|
+
<link rel="shortcut icon" href="{{ '/assets/flav.svg' | relative_url }}">
|
14
|
+
<link rel="apple-touch-icon" href="{{ '/assets/apple-touch-icon.png' | relative_url }}">
|
15
|
+
{%comment%} assets/style.css isn't a typo, is where SASS will compile to {%endcomment%}
|
16
|
+
<link rel="stylesheet" href="{{ '/assets/style.css' | relative_url }}">
|
17
|
+
{%comment%} jekyll-feed doing its thing {%endcomment%}
|
18
|
+
{%- feed_meta -%}
|
19
|
+
{%comment%} add user's custom header; anything can go here! {%endcomment%}
|
20
|
+
{%- include custom-head.html -%}
|
21
|
+
</head>
|
data/_includes/meta.html
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
{%comment%} ensures this file works with posts and pages {%endcomment%}
|
2
|
+
{%- if page.date -%}
|
3
|
+
{%- assign p = page -%}
|
4
|
+
{%- assign align = 'center' -%}
|
5
|
+
{%- else -%}
|
6
|
+
{%- assign p = post -%}
|
7
|
+
{%- assign align = 'left' -%}
|
8
|
+
{% endif %}
|
9
|
+
|
10
|
+
{%comment%} Sets the default date format as ISO 8601 {%endcomment%}
|
11
|
+
{% assign date_format = site.wren.date_format | default: "%Y-%m-%d" %}
|
12
|
+
|
13
|
+
<p class="post-meta" {{ align | prepend: 'style= "text-align: ' | append: ';"'}}>
|
14
|
+
{%comment%} assign variables prevents overflow between entries {%endcomment%}
|
15
|
+
{%- assign original_date = p.date | date: date_format -%}
|
16
|
+
{%- assign modified_date = p.modified_date -%}
|
17
|
+
{%comment%} if post was modified, add * and add that date as hover text {%endcomment%}
|
18
|
+
{%- if modified_date -%}
|
19
|
+
{%- assign modified_date = modified_date | date: date_format | prepend: 'Updated on ' -%}
|
20
|
+
{%- assign original_date = original_date | append: '*' -%}
|
21
|
+
{%- endif -%}
|
22
|
+
<time title="{{ modified_date }}" class="dt-published" datetime="{{ original_date | date_to_xmlschema }}" itemprop="datePublished">
|
23
|
+
{{ original_date }}
|
24
|
+
</time>
|
25
|
+
|
26
|
+
{%comment%} passing content to be analysed by reading-time explicitly {%endcomment%}
|
27
|
+
• {%- include reading-time.html text=p.content -%}
|
28
|
+
|
29
|
+
{%comment%} if tag given, give as comma-separated list with links to tag page {%endcomment%}
|
30
|
+
{%- if p.tags -%}
|
31
|
+
{%- for tag in p.tags -%}
|
32
|
+
{%- if forloop.first == true %}• {% endif %}
|
33
|
+
<a href={{ 'blog/tags#' | append: tag | relative_url }}>{{ tag }}</a>
|
34
|
+
{%- if forloop.last == false %}, {% endif %}
|
35
|
+
{%- endfor -%}
|
36
|
+
{%- endif %}
|
37
|
+
|
38
|
+
{%comment%} if authors given, give as comma-separated list {%endcomment%}
|
39
|
+
{%- if p.author -%}
|
40
|
+
{%- for author in p.author -%}
|
41
|
+
{%- if forloop.first == true -%}• {% endif -%}
|
42
|
+
{%- assign author_id = author | replace: ' ', '_' -%}
|
43
|
+
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
|
44
|
+
<span class="p-author h-card" itemprop="name">
|
45
|
+
<a href={{ 'blog/authors#' | append: author_id | relative_url }}>{{author}}</a>
|
46
|
+
{%- if forloop.last == false -%}, {%- endif -%}
|
47
|
+
</span>
|
48
|
+
</span>
|
49
|
+
{% endfor %}
|
50
|
+
{%- endif -%}
|
51
|
+
|
52
|
+
{%comment%} indicate if the post was first published elsewhere first {%endcomment%}
|
53
|
+
{%- if p.first_published_on -%}
|
54
|
+
{%comment%} allow specifying a specific URL at which it was published {%endcomment%}
|
55
|
+
{%- if p.first_published_url -%}
|
56
|
+
{%- assign fpo_string = "First published on " | append: p.first_published_url -%}
|
57
|
+
{%- else -%}
|
58
|
+
{%- assign fpo_string = "First published on " | append: p.first_published_on -%}
|
59
|
+
{%- endif -%}
|
60
|
+
{%comment%} construct expected icon path, then check if exists {%endcomment%}
|
61
|
+
{%- assign icon_path = p.first_published_on | prepend: 'assets/social-icons/' | append: '.svg' -%}
|
62
|
+
{%- assign found = false -%}
|
63
|
+
{%- for static_file in site.static_files -%}
|
64
|
+
{%- if static_file.path contains icon_path -%}
|
65
|
+
{%- assign found = true -%}
|
66
|
+
{%- endif -%}
|
67
|
+
{%- endfor -%}
|
68
|
+
{%comment%} if it doesn't, use the default source icon {%endcomment%}
|
69
|
+
{%- if found == false -%}
|
70
|
+
{%- assign icon_path = 'assets/social-icons/Default.svg' -%}
|
71
|
+
{%- endif -%}
|
72
|
+
{%comment%} put that all together with a.svg.use for the button {%endcomment%}
|
73
|
+
•
|
74
|
+
<a title="{{ fpo_string }}" alt="{{ fpo_string }}">
|
75
|
+
<svg style="vertical-align: sub; width: 16px; height: 16px;" =>
|
76
|
+
<use xlink:href="{{ icon_path | append: '#soc' | relative_url }}"/>
|
77
|
+
</svg>
|
78
|
+
</a>
|
79
|
+
{%- endif -%}
|
80
|
+
{%comment%} add user's custom meta; anything can go here! {%endcomment%}
|
81
|
+
{%- include custom-meta.html -%}
|
82
|
+
</p>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
{%comment%}
|
2
|
+
In principle other content could be displayed in the <header> element (as in
|
3
|
+
Minima) but stock Wren only uses it for navigation links. Also shouldn't be
|
4
|
+
confused with head.html which provides HTML <head> meta information.
|
5
|
+
{%endcomment%}
|
6
|
+
|
7
|
+
<header class="site-header">
|
8
|
+
{%comment%} <nav> notifies browser there are navigation links {%endcomment%}
|
9
|
+
<nav class="site-nav">
|
10
|
+
{%comment%} always include link to home in navbar {%endcomment%}
|
11
|
+
<a class="page-link" href="{{ site.baseurl }}/" title="Home" alt="Home">
|
12
|
+
<svg>
|
13
|
+
{%comment%} #nav acts as an anchor for the import {%endcomment%}
|
14
|
+
<use xlink:href="{{ 'assets/nav-icons/home.svg#nav' | relative_url }}"/>
|
15
|
+
</svg>
|
16
|
+
</a>
|
17
|
+
|
18
|
+
{%comment%} display any pages listed in _config.yml in order {%endcomment%}
|
19
|
+
{%- for path in site.wren.header_pages -%}
|
20
|
+
{%comment%} shortcuts for basic page info {%endcomment%}
|
21
|
+
{%- assign my_page = site.pages | where: "path", path | first -%}
|
22
|
+
{%- assign title = my_page.title | escape -%}
|
23
|
+
|
24
|
+
{%comment%} prepend '/' so split works even if file in root {%endcomment%}
|
25
|
+
{%- assign clean_path = path | prepend: '/' | split: '/' -%}
|
26
|
+
{%comment%} need an ID by which to look for navigation icons {%endcomment%}
|
27
|
+
{%- if clean_path[-1] == 'index.html' -%}
|
28
|
+
{%comment%} ID is containing directory if link an index file {%endcomment%}
|
29
|
+
{%- assign id = clean_path[-2] -%}
|
30
|
+
{%- else -%}
|
31
|
+
{%comment%} ID is filename if not an index file {%endcomment%}
|
32
|
+
{%- assign id = clean_path[-1] | remove: '.md' | remove: '.html' -%}
|
33
|
+
{%- endif -%}
|
34
|
+
|
35
|
+
{%comment%} construct expected icon path, then check if exists {%endcomment%}
|
36
|
+
{%- assign icon_path = id | prepend: 'assets/nav-icons/' | append: '.svg' -%}
|
37
|
+
{%- assign found = false -%}
|
38
|
+
{%- for static_file in site.static_files -%}
|
39
|
+
{%- if static_file.path contains icon_path -%}
|
40
|
+
{%- assign found = true -%}
|
41
|
+
{%- endif -%}
|
42
|
+
{%- endfor -%}
|
43
|
+
{%comment%} if it doesn't, use the default navigation icon {%endcomment%}
|
44
|
+
{%- if found == false -%}
|
45
|
+
{%- assign icon_path = 'assets/nav-icons/default.svg' -%}
|
46
|
+
{%- endif -%}
|
47
|
+
|
48
|
+
{%comment%} put that all together with a.svg.use for the button {%endcomment%}
|
49
|
+
<a class="page-link" href="{{ my_page.url | relative_url }}" title="{{ title }}" alt="{{ title }}">
|
50
|
+
<svg>
|
51
|
+
<use xlink:href="{{ icon_path | append: '#nav' | relative_url }}"/>
|
52
|
+
</svg>
|
53
|
+
</a>
|
54
|
+
{%- endfor -%}
|
55
|
+
|
56
|
+
{%comment%} always include link to RSS in navbar {%endcomment%}
|
57
|
+
<a class="page-link" href="{{ 'feed.xml' | relative_url }}" title="Feed">
|
58
|
+
<svg>
|
59
|
+
<use xlink:href="{{ 'assets/nav-icons/rss.svg#nav' | relative_url }}"/>
|
60
|
+
</svg>
|
61
|
+
</a>
|
62
|
+
|
63
|
+
{%comment%} always include shortcut to top of page in navbar {%endcomment%}
|
64
|
+
<a class="page-link" href="#" title="Top" alt="Top">
|
65
|
+
<svg>
|
66
|
+
<use xlink:href="{{ 'assets/nav-icons/top.svg#nav' | relative_url }}"/>
|
67
|
+
</svg>
|
68
|
+
</a>
|
69
|
+
</nav>
|
70
|
+
</header>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{% comment %}
|
2
|
+
This is an amazing example of how Liquid templates can behave exactly
|
3
|
+
like functions. Used as {% include reading-time.html text=content %},
|
4
|
+
this template takes an optional variable `text` as input and returns
|
5
|
+
how long it takes to read the content of that variable as output. If
|
6
|
+
no text given it just analyses the page its included in instead.
|
7
|
+
{% endcomment %}
|
8
|
+
|
9
|
+
{%comment%} check which provides fallback for `text` {%endcomment%}
|
10
|
+
{%- if include.text -%}
|
11
|
+
{%- assign text = include.text -%}
|
12
|
+
{%- else -%}
|
13
|
+
{%- assign text = content -%}
|
14
|
+
{%- endif -%}
|
15
|
+
|
16
|
+
{%comment%} set the default reading speed {%endcomment%}
|
17
|
+
{%- assign wpm = site.wren.wpm | default: 180 -%}
|
18
|
+
|
19
|
+
{%comment%}
|
20
|
+
Liquid can't do arithmetic within conditional expressions. We'll
|
21
|
+
need wpm/2 to check if the post is less than 30 seconds so have
|
22
|
+
to assign it a variable before the check happens.
|
23
|
+
{%endcomment%}
|
24
|
+
{%- assign wp30s = wpm | divided_by: 2 -%}
|
25
|
+
|
26
|
+
{%comment%}
|
27
|
+
This is a simple reading time calculation is based entirely on the
|
28
|
+
number of words; Medium is more complex and counts images as well.
|
29
|
+
{%endcomment%}
|
30
|
+
{%- assign words = text | number_of_words -%}
|
31
|
+
|
32
|
+
{%- if words > 0 and words < wp30s -%}
|
33
|
+
{%comment%} if takes less than 30 secs, just say 30 secs {%endcomment%}
|
34
|
+
{%- assign time = '30 sec' -%}
|
35
|
+
{%- else -%}
|
36
|
+
{%comment%} otherwise, give reading time to nearest minute {%endcomment%}
|
37
|
+
{%- assign time = words | plus: wp30s | divided_by: wpm | append: ' min' -%}
|
38
|
+
{%- endif -%}
|
39
|
+
|
40
|
+
{%comment%} give Medium-style output {%endcomment%}
|
41
|
+
{{ time | append: ' read' }}
|