Skip to content

Commit cbb3bd4

Browse files
committed
Set default values for site variables
good for gem-based first run
1 parent 7ed3bef commit cbb3bd4

17 files changed

+45
-43
lines changed

_data/date_format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
9+
910
post:
1011
long: "%b %e, %Y"
1112
short: "%b %e"

_data/label.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ panel:
1111

1212
post:
1313
relate_posts: Further Reading
14+
share: Share
1415
button:
1516
next: Newer
1617
previous: Older
1718

1819
search_hint: Search # text show on search bar
1920

20-
pin_prompt: Pinned # pinned prompt
21+
pin_prompt: Pinned # pinned prompt
22+
23+
read_time_unit: min # see posts' time to read

_data/read_time.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

_data/share.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# © 2020 Cotes Chung
77
# MIT Licensed
88

9-
label: "Share"
10-
119
platforms:
1210
-
1311
type: Twitter

_includes/panel.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{% if update_list.size > 0 %}
1616

1717
<div id="access-lastmod" class="post">
18-
<span>{{- site.data.label.panel.lastmod -}}</span>
18+
<span>{{- site.data.label.panel.lastmod | default: 'Recent Update' -}}</span>
1919
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
2020

2121
{% for item in update_list %}
@@ -34,7 +34,7 @@
3434

3535
{% if trending_tags.size > 0 %}
3636
<div id="access-tags">
37-
<span>{{- site.data.label.panel.trending_tags -}}</span>
37+
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span>
3838
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
3939

4040
{% for tag_name in trending_tags %}
@@ -52,7 +52,7 @@
5252
<script src="https://cdn.jsdelivr.net/gh/afeld/[email protected]/dist/bootstrap-toc.min.js"></script>
5353
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
5454
<span class="pl-3 pt-2 mb-2">
55-
{{- site.data.label.panel.toc -}}
55+
{{- site.data.label.panel.toc | default: 'Contents' -}}
5656
</span>
5757
<nav id="toc" data-toggle="toc"></nav>
5858
</div>

_includes/post-nav.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
<div class="post-navigation d-flex justify-content-between">
1111
{% if page.previous.url %}
12-
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary">
12+
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
13+
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
1314
<p>{{ page.previous.title }}</p>
1415
</a>
1516
{% else %}
@@ -19,7 +20,8 @@
1920
{% endif %}
2021

2122
{% if page.next.url %}
22-
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary">
23+
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
24+
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
2325
<p>{{ page.next.title }}</p>
2426
</a>
2527
{% else %}
@@ -28,4 +30,4 @@
2830
</span>
2931
{% endif %}
3032

31-
</div>
33+
</div>

_includes/post-sharing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-->
99

1010
<div class="share-wrapper">
11-
<span class="share-label text-muted mr-1">{{ site.data.share.label }}</span>
11+
<span class="share-label text-muted mr-1">{{ site.data.label.post.share | default: 'Share' }}</span>
1212
<span class="share-icons">
1313
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
1414
{% assign url = page.url | absolute_url %}

_includes/read-time.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
-->
44
{% assign words = include.content | strip_html | number_of_words: "auto" %}
55

6-
{% assign read_time = words | divided_by: site.data.read_time.wpm %}
6+
<!-- words per minute -->
7+
{% assign wpm = 180 %}
8+
{% assign min_time = 1 %}
9+
10+
{% assign read_time = words | divided_by: wpm %}
711

812
{% unless read_time > 0 %}
9-
{% assign read_time = site.data.read_time.min_time %}
13+
{% assign read_time = min_time %}
1014
{% endunless %}
1115

1216
<!-- return element -->
1317
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
14-
{{- read_time -}}{{" "}}{{- site.data.read_time.prompt -}}
18+
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}}
1519
</span>

_includes/related-posts.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585

8686
{% if index_list.size > 0 %}
8787
<div id="related-posts" class="mt-5 mb-2 mb-sm-4">
88-
<h3 class="pt-2 mt-1 mb-4 ml-1" data-toc-skip>{{ site.data.label.post.relate_posts }}</h3>
88+
<h3 class="pt-2 mt-1 mb-4 ml-1"
89+
data-toc-skip>{{ site.data.label.post.relate_posts | default: 'Further Reading' }}</h3>
8990
<div class="card-deck mb-4">
9091
{% for entry in index_list %}
9192
{% assign index = entry | plus: 0 %}

_includes/search-results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
99
<div class="col-12 col-xl-11 post-content">
1010
<div id="search-hints">
11-
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
11+
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
1212

1313
{% include trending-tags.html %}
1414

_includes/timeago.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@
66
© 2020 Cotes Chung
77
MIT License
88
-->
9+
10+
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
11+
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
12+
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %}
13+
914
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
1015
{% if include.tooltip %}
1116
data-toggle="tooltip"
1217
data-placement="bottom"
13-
title="{{ include.date | date: site.data.date_format.tooltip }}"
18+
title="{{ include.date | date: tooltip_df }}"
1419
{% endif %}>
1520

1621
{% assign this_year = site.time | date: "%Y" %}
1722
{% assign post_year = include.date | date: "%Y" %}
1823

1924
{% if post_year == this_year %}
20-
{{ include.date | date: site.data.date_format.post.short }}
25+
{{ include.date | date: post_short_df }}
2126
{% else %}
22-
{{ include.date | date: site.data.date_format.post.long }}
27+
{{ include.date | date: post_long_df }}
2328
{% endif %}
2429

2530
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
2631

27-
</span>
32+
</span>

_includes/topbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<span id="search-wrapper" class="align-items-center">
4343
<i class="fas fa-search fa-fw"></i>
4444
<input class="form-control" id="search-input" type="search"
45-
aria-label="search" placeholder="{{ site.data.label.search_hint }}...">
45+
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
4646
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
4747
</span>
4848
<span id="search-cancel" >Cancel</span>

_layouts/category.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ <h1 class="pl-lg-2">
1414
</h1>
1515

1616
<ul class="post-content pl-0">
17+
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
18+
1719
{% for post in page.posts %}
1820
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
1921
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
2022
<span class="dash flex-grow-1"></span>
21-
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
23+
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
2224
</li>
2325
{% endfor %}
2426
</ul>

_layouts/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ <h1>
8383
{% if post.pin %}
8484
<div class="pin">
8585
<i class="fas fa-thumbtack fa-fw"></i>
86-
<span>{{ site.data.label.pin_prompt }}</span>
86+
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
8787
</div>
8888
{% endif %}
8989

_layouts/tag.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
# MIT Licensed
88
---
99

10+
1011
<div id="page-tag">
1112
<h1 class="pl-lg-2">
1213
<i class="fa fa-tag fa-fw text-muted"></i>
1314
{{ page.title }}
1415
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
1516
</h1>
1617
<ul class="post-content pl-0">
18+
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
19+
1720
{% for post in page.posts %}
1821
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
1922
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
2023
<span class="dash flex-grow-1"></span>
21-
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
24+
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
2225
</li>
2326
{% endfor %}
2427
</ul>

_sass/layout/post.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Post-specific style
33
*/
44

5-
$prompt-older: 'older'!default; // "{{ site.data.label.post.button.previous }}";
6-
$prompt-newer: 'newer'!default; // "{{ site.data.label.post.button.next }}";
7-
85
@mixin btn-sharing-color($light-color, $important: false) {
96
@if $important {
107
color: var(--btn-share-color, $light-color)!important;
@@ -94,27 +91,22 @@ $prompt-newer: 'newer'!default; // "{{ site.data.label.post.button.next }}";
9491
white-space: normal;
9592
}
9693

97-
a, span {
94+
a {
9895
&::before {
9996
color: var(--text-muted-color);
10097
font-size: 0.65rem;
10198
text-transform: uppercase;
99+
content: attr(prompt);
102100
}
103101
&:first-child {
104102
border-top-right-radius: 0;
105103
border-bottom-right-radius: 0;
106104
left: 0.5px;
107-
&::before {
108-
content: $prompt-older
109-
}
110105
}
111106
&:last-child {
112107
border-top-left-radius: 0;
113108
border-bottom-left-radius: 0;
114109
right: 0.5px;
115-
&::before {
116-
content: $prompt-newer
117-
}
118110
}
119111
}
120112
} // .post-navigation

assets/css/style.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
22
---
33

4+
// see: /_sass/addon/commons.scss
45
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
56

6-
$prompt-older: "{{ site.data.label.post.button.previous }}";
7-
$prompt-newer: "{{ site.data.label.post.button.next }}";
8-
97
@import "jekyll-theme-chirpy";

0 commit comments

Comments
 (0)