jekyll-wren 0.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -9
- data/README.md +180 -177
- data/_includes/custom-foot.html +4 -4
- data/_includes/custom-head.html +13 -13
- data/_includes/custom-meta.html +5 -5
- data/_includes/footer.html +23 -23
- data/_includes/head.html +21 -21
- data/_includes/meta.html +82 -82
- data/_includes/navigation.html +70 -70
- data/_includes/reading-time.html +41 -41
- data/_includes/social-list.html +46 -46
- data/_includes/video-player.html +66 -66
- data/_layouts/author-list.html +73 -73
- data/_layouts/default.html +16 -16
- data/_layouts/error.html +9 -9
- data/_layouts/page.html +14 -14
- data/_layouts/post-list.html +67 -67
- data/_layouts/post.html +16 -16
- data/_layouts/tag-list.html +54 -54
- data/_sass/wren/content.scss +345 -345
- data/_sass/wren/initialize.scss +118 -118
- data/_sass/wren/layout.scss +295 -295
- data/assets/flav.svg +4 -4
- data/assets/nav-icons/about.svg +2 -2
- data/assets/nav-icons/blog.svg +2 -2
- data/assets/nav-icons/comments.svg +3 -3
- data/assets/nav-icons/default.svg +2 -2
- data/assets/nav-icons/home.svg +4 -4
- data/assets/nav-icons/rss.svg +2 -2
- data/assets/nav-icons/top.svg +2 -2
- data/assets/nav-icons/work.svg +4 -4
- data/assets/social-icons/Blogger.svg +3 -3
- data/assets/social-icons/Blogspot.svg +3 -0
- data/assets/social-icons/DEV.svg +3 -3
- data/assets/social-icons/Default.svg +3 -3
- data/assets/social-icons/Dribbble.svg +3 -3
- data/assets/social-icons/Facebook.svg +3 -3
- data/assets/social-icons/Flickr.svg +3 -3
- data/assets/social-icons/Ghost.svg +3 -3
- data/assets/social-icons/GitHub.svg +3 -3
- data/assets/social-icons/GitLab.svg +3 -3
- data/assets/social-icons/HowLongToBeat.svg +3 -0
- data/assets/social-icons/Instagram.svg +5 -5
- data/assets/social-icons/Keybase.svg +6 -6
- data/assets/social-icons/LinkedIn.svg +3 -3
- data/assets/social-icons/Mastodon.svg +3 -3
- data/assets/social-icons/Medium.svg +5 -5
- data/assets/social-icons/Micro.blog.svg +3 -3
- data/assets/social-icons/Pinterest.svg +3 -3
- data/assets/social-icons/Reddit.svg +3 -3
- data/assets/social-icons/StackOverflow.svg +3 -3
- data/assets/social-icons/StoryGraph.svg +6 -0
- data/assets/social-icons/Strava.svg +4 -0
- data/assets/social-icons/Telegram.svg +3 -3
- data/assets/social-icons/Tumblr.svg +3 -3
- data/assets/social-icons/Twitter.svg +3 -3
- data/assets/social-icons/Wordpress.svg +4 -4
- data/assets/social-icons/Wren.svg +3 -0
- data/assets/social-icons/YouTube.svg +3 -3
- data/assets/style.scss +14 -14
- data/errors/400.md +9 -9
- data/errors/403.md +9 -9
- data/errors/404.md +9 -9
- data/errors/418.md +12 -12
- data/errors/500.md +9 -9
- metadata +9 -8
data/_includes/meta.html
CHANGED
@@ -1,82 +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>
|
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>
|
data/_includes/navigation.html
CHANGED
@@ -1,70 +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>
|
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>
|
data/_includes/reading-time.html
CHANGED
@@ -1,41 +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' }}
|
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' }}
|
data/_includes/social-list.html
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
{%comment%} values come from mix of config and data file {%endcomment%}
|
2
|
-
{%- assign config = site.wren.social_links -%}
|
3
|
-
{%- assign data = site.wren_social_data -%}
|
4
|
-
|
5
|
-
{%comment%} double loop allows multiple from same service {%endcomment%}
|
6
|
-
{%- for service in config -%}
|
7
|
-
{%- for entry in service[1] -%}
|
8
|
-
{%comment%} can give username as object or value {%endcomment%}
|
9
|
-
{%- assign handle = entry.username | default: entry -%}
|
10
|
-
|
11
|
-
{%comment%}
|
12
|
-
Key by which config identifies the service. Note that this key doesn't have to
|
13
|
-
be known to the data file also; this template's logic will muddle through what
|
14
|
-
information it has and piece together a button as best it can.
|
15
|
-
{%endcomment%}
|
16
|
-
{%-assign key = service[0] -%}
|
17
|
-
|
18
|
-
{%comment%} checks if Wren covers service, if not switch to fallbacks {%endcomment%}
|
19
|
-
{%- assign name = data[key]["name"] | default: entry.name -%}
|
20
|
-
{%- assign icon = data[key]["name"] | default: "Default" -%}
|
21
|
-
|
22
|
-
{%comment%} url can come from config or datafile {%endcomment%}
|
23
|
-
{%- assign url = entry.instance | default: data[key]["url"] -%}
|
24
|
-
|
25
|
-
{%comment%} handle service specific url delimiters {%endcomment%}
|
26
|
-
{%- if key == "mastodon" or key == "medium" -%}
|
27
|
-
{%- assign delimiter = "/@" -%}
|
28
|
-
{%- else -%}
|
29
|
-
{%- assign delimiter = "/" -%}
|
30
|
-
{%- endif -%}
|
31
|
-
|
32
|
-
{%comment%} id allows URLs to differ from usernames {%endcomment%}
|
33
|
-
{%- assign url_handle = entry.id | default: handle -%}
|
34
|
-
|
35
|
-
{%comment%} generate the full profile url {%endcomment%}
|
36
|
-
{%- assign profile_link = url | prepend: 'https://' | append: delimiter | append: url_handle -%}
|
37
|
-
|
38
|
-
{%comment%} actual HTML which forms the social button {%endcomment%}
|
39
|
-
<a rel="author" alt="{{ name }}" title="{{ handle }}" href="{{ profile_link }}">
|
40
|
-
<svg>
|
41
|
-
{%comment%} #soc acts as an anchor for the import {%endcomment%}
|
42
|
-
<use xlink:href="{{ icon | prepend: '/assets/social-icons/' | append: '.svg#soc' | relative_url }}"/>
|
43
|
-
</svg>
|
44
|
-
</a>
|
45
|
-
{%endfor%}
|
46
|
-
{% endfor %}
|
1
|
+
{%comment%} values come from mix of config and data file {%endcomment%}
|
2
|
+
{%- assign config = site.wren.social_links -%}
|
3
|
+
{%- assign data = site.wren_social_data -%}
|
4
|
+
|
5
|
+
{%comment%} double loop allows multiple from same service {%endcomment%}
|
6
|
+
{%- for service in config -%}
|
7
|
+
{%- for entry in service[1] -%}
|
8
|
+
{%comment%} can give username as object or value {%endcomment%}
|
9
|
+
{%- assign handle = entry.username | default: entry -%}
|
10
|
+
|
11
|
+
{%comment%}
|
12
|
+
Key by which config identifies the service. Note that this key doesn't have to
|
13
|
+
be known to the data file also; this template's logic will muddle through what
|
14
|
+
information it has and piece together a button as best it can.
|
15
|
+
{%endcomment%}
|
16
|
+
{%-assign key = service[0] -%}
|
17
|
+
|
18
|
+
{%comment%} checks if Wren covers service, if not switch to fallbacks {%endcomment%}
|
19
|
+
{%- assign name = data[key]["name"] | default: entry.name -%}
|
20
|
+
{%- assign icon = data[key]["name"] | default: "Default" -%}
|
21
|
+
|
22
|
+
{%comment%} url can come from config or datafile {%endcomment%}
|
23
|
+
{%- assign url = entry.instance | default: data[key]["url"] -%}
|
24
|
+
|
25
|
+
{%comment%} handle service specific url delimiters {%endcomment%}
|
26
|
+
{%- if key == "mastodon" or key == "medium" -%}
|
27
|
+
{%- assign delimiter = "/@" -%}
|
28
|
+
{%- else -%}
|
29
|
+
{%- assign delimiter = "/" -%}
|
30
|
+
{%- endif -%}
|
31
|
+
|
32
|
+
{%comment%} id allows URLs to differ from usernames {%endcomment%}
|
33
|
+
{%- assign url_handle = entry.id | default: handle -%}
|
34
|
+
|
35
|
+
{%comment%} generate the full profile url {%endcomment%}
|
36
|
+
{%- assign profile_link = url | prepend: 'https://' | append: delimiter | append: url_handle -%}
|
37
|
+
|
38
|
+
{%comment%} actual HTML which forms the social button {%endcomment%}
|
39
|
+
<a rel="author" alt="{{ name }}" title="{{ handle }}" href="{{ profile_link }}">
|
40
|
+
<svg>
|
41
|
+
{%comment%} #soc acts as an anchor for the import {%endcomment%}
|
42
|
+
<use xlink:href="{{ icon | prepend: '/assets/social-icons/' | append: '.svg#soc' | relative_url }}"/>
|
43
|
+
</svg>
|
44
|
+
</a>
|
45
|
+
{%endfor%}
|
46
|
+
{% endfor %}
|
data/_includes/video-player.html
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
{% comment %}
|
2
|
-
Embedded video player for a bunch of different host websites.
|
3
|
-
Takes the parameters `site` for video host, `alt` for the title,
|
4
|
-
and `id` for the video ID (usually in the URL) and then returns
|
5
|
-
the iframe needed to embed that video in a page. It's based on
|
6
|
-
the templates from https://github.com/nathancy/jekyll-embed-video
|
7
|
-
but combined into a one player, rather than players for each host.
|
8
|
-
{% endcomment %}
|
9
|
-
|
10
|
-
{% comment %} default player variables {% endcomment %}
|
11
|
-
{%- assign width = "500px" -%}
|
12
|
-
{%- assign height = "281px" -%}
|
13
|
-
{%- assign allow_autoplay = false -%}
|
14
|
-
{%- assign allow_fullscreen = true -%}
|
15
|
-
|
16
|
-
{% comment %}
|
17
|
-
Some sites also ask for the site doing the embedding for
|
18
|
-
security purposes, so this quick check makes sure things
|
19
|
-
keep working seamlessly between local and prod builds.
|
20
|
-
{% endcomment %}
|
21
|
-
{%- if jekyll.environment == "production" -%}
|
22
|
-
{%- assign host = site.url -%}
|
23
|
-
{%- else -%}
|
24
|
-
{%- assign host = "127.0.0.1" -%}
|
25
|
-
{% endif -%}
|
26
|
-
|
27
|
-
{% comment %} shortcut variables {% endcomment %}
|
28
|
-
{%- assign id = include.id -%}
|
29
|
-
{%- assign source = include.site -%}
|
30
|
-
|
31
|
-
{%- if source == "Dailymotion" -%}
|
32
|
-
{%- assign url = "dailymotion.com/embed/video/" -%}
|
33
|
-
{%- elsif source == "Google Drive" -%}
|
34
|
-
{%- assign url = "drive.google.com/file/d/" -%}
|
35
|
-
{%- elsif source == "Streamable" -%}
|
36
|
-
{%- assign url = "streamable.com/s/" -%}
|
37
|
-
{%- elsif source == "Twitch" -%}
|
38
|
-
{%- assign url = "clips.twitch.tv/embed?clip=" -%}
|
39
|
-
{%- assign id = id | append: "&parent=" | append: host -%}
|
40
|
-
{%- elsif source == "Vimeo" -%}
|
41
|
-
{%- assign url = "player.vimeo.com/video/" -%}
|
42
|
-
{%- elsif source == "YouTube" -%}
|
43
|
-
{%- assign url = "youtube.com/embed/" -%}
|
44
|
-
{%- endif -%}
|
45
|
-
|
46
|
-
<iframe
|
47
|
-
class = "video-embed"
|
48
|
-
alt = "{{ include.alt }}"
|
49
|
-
title = "{{ include.alt }}"
|
50
|
-
src = "{{ url | append: id | prepend: 'https://' }}"
|
51
|
-
width = {{ width }}
|
52
|
-
height = {{ height }}
|
53
|
-
frameborder = "0"
|
54
|
-
scrolling = "no"
|
55
|
-
{% if allow_autoplay == true -%}
|
56
|
-
allow = "autoplay"
|
57
|
-
autoplay = true
|
58
|
-
{% else -%}
|
59
|
-
autoplay = false
|
60
|
-
{%- endif -%}
|
61
|
-
{% if allow_fullscreen == true -%}
|
62
|
-
webkitallowfullscreen
|
63
|
-
mozallowfullscreen
|
64
|
-
allowfullscreen
|
65
|
-
{%- endif -%}>
|
66
|
-
</iframe>
|
1
|
+
{% comment %}
|
2
|
+
Embedded video player for a bunch of different host websites.
|
3
|
+
Takes the parameters `site` for video host, `alt` for the title,
|
4
|
+
and `id` for the video ID (usually in the URL) and then returns
|
5
|
+
the iframe needed to embed that video in a page. It's based on
|
6
|
+
the templates from https://github.com/nathancy/jekyll-embed-video
|
7
|
+
but combined into a one player, rather than players for each host.
|
8
|
+
{% endcomment %}
|
9
|
+
|
10
|
+
{% comment %} default player variables {% endcomment %}
|
11
|
+
{%- assign width = "500px" -%}
|
12
|
+
{%- assign height = "281px" -%}
|
13
|
+
{%- assign allow_autoplay = false -%}
|
14
|
+
{%- assign allow_fullscreen = true -%}
|
15
|
+
|
16
|
+
{% comment %}
|
17
|
+
Some sites also ask for the site doing the embedding for
|
18
|
+
security purposes, so this quick check makes sure things
|
19
|
+
keep working seamlessly between local and prod builds.
|
20
|
+
{% endcomment %}
|
21
|
+
{%- if jekyll.environment == "production" -%}
|
22
|
+
{%- assign host = site.url -%}
|
23
|
+
{%- else -%}
|
24
|
+
{%- assign host = "127.0.0.1" -%}
|
25
|
+
{% endif -%}
|
26
|
+
|
27
|
+
{% comment %} shortcut variables {% endcomment %}
|
28
|
+
{%- assign id = include.id -%}
|
29
|
+
{%- assign source = include.site -%}
|
30
|
+
|
31
|
+
{%- if source == "Dailymotion" -%}
|
32
|
+
{%- assign url = "dailymotion.com/embed/video/" -%}
|
33
|
+
{%- elsif source == "Google Drive" -%}
|
34
|
+
{%- assign url = "drive.google.com/file/d/" -%}
|
35
|
+
{%- elsif source == "Streamable" -%}
|
36
|
+
{%- assign url = "streamable.com/s/" -%}
|
37
|
+
{%- elsif source == "Twitch" -%}
|
38
|
+
{%- assign url = "clips.twitch.tv/embed?clip=" -%}
|
39
|
+
{%- assign id = id | append: "&parent=" | append: host -%}
|
40
|
+
{%- elsif source == "Vimeo" -%}
|
41
|
+
{%- assign url = "player.vimeo.com/video/" -%}
|
42
|
+
{%- elsif source == "YouTube" -%}
|
43
|
+
{%- assign url = "youtube.com/embed/" -%}
|
44
|
+
{%- endif -%}
|
45
|
+
|
46
|
+
<iframe
|
47
|
+
class = "video-embed"
|
48
|
+
alt = "{{ include.alt }}"
|
49
|
+
title = "{{ include.alt }}"
|
50
|
+
src = "{{ url | append: id | prepend: 'https://' }}"
|
51
|
+
width = {{ width }}
|
52
|
+
height = {{ height }}
|
53
|
+
frameborder = "0"
|
54
|
+
scrolling = "no"
|
55
|
+
{% if allow_autoplay == true -%}
|
56
|
+
allow = "autoplay"
|
57
|
+
autoplay = true
|
58
|
+
{% else -%}
|
59
|
+
autoplay = false
|
60
|
+
{%- endif -%}
|
61
|
+
{% if allow_fullscreen == true -%}
|
62
|
+
webkitallowfullscreen
|
63
|
+
mozallowfullscreen
|
64
|
+
allowfullscreen
|
65
|
+
{%- endif -%}>
|
66
|
+
</iframe>
|