Set default values for site variables

good for gem-based first run
This commit is contained in:
Cotes Chung 2021-01-24 03:02:19 +08:00
parent 7ed3bef1b1
commit cbb3bd4be5
17 changed files with 45 additions and 43 deletions

View file

@ -6,6 +6,7 @@
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
post:
long: "%b %e, %Y"
short: "%b %e"

View file

@ -11,10 +11,13 @@ panel:
post:
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
search_hint: Search # text show on search bar
pin_prompt: Pinned # pinned prompt
pin_prompt: Pinned # pinned prompt
read_time_unit: min # see posts' time to read

View file

@ -1,7 +0,0 @@
# words per minute
wpm: 180
# minimum value
min_time: 1
prompt: min

View file

@ -6,8 +6,6 @@
# © 2020 Cotes Chung
# MIT Licensed
label: "Share"
platforms:
-
type: Twitter

View file

@ -15,7 +15,7 @@
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<span>{{- site.data.label.panel.lastmod -}}</span>
<span>{{- site.data.label.panel.lastmod | default: 'Recent Update' -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
@ -34,7 +34,7 @@
{% if trending_tags.size > 0 %}
<div id="access-tags">
<span>{{- site.data.label.panel.trending_tags -}}</span>
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %}
@ -52,7 +52,7 @@
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc -}}
{{- site.data.label.panel.toc | default: 'Contents' -}}
</span>
<nav id="toc" data-toggle="toc"></nav>
</div>

View file

@ -9,7 +9,8 @@
<div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %}
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary">
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
<p>{{ page.previous.title }}</p>
</a>
{% else %}
@ -19,7 +20,8 @@
{% endif %}
{% if page.next.url %}
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary">
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
<p>{{ page.next.title }}</p>
</a>
{% else %}
@ -28,4 +30,4 @@
</span>
{% endif %}
</div>
</div>

View file

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

View file

@ -3,13 +3,17 @@
-->
{% assign words = include.content | strip_html | number_of_words: "auto" %}
{% assign read_time = words | divided_by: site.data.read_time.wpm %}
<!-- words per minute -->
{% assign wpm = 180 %}
{% assign min_time = 1 %}
{% assign read_time = words | divided_by: wpm %}
{% unless read_time > 0 %}
{% assign read_time = site.data.read_time.min_time %}
{% assign read_time = min_time %}
{% endunless %}
<!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
{{- read_time -}}{{" "}}{{- site.data.read_time.prompt -}}
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}}
</span>

View file

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

View file

@ -8,7 +8,7 @@
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-xl-11 post-content">
<div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
{% include trending-tags.html %}

View file

@ -6,22 +6,27 @@
© 2020 Cotes Chung
MIT License
-->
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %}
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: site.data.date_format.tooltip }}"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %}
{{ include.date | date: site.data.date_format.post.short }}
{{ include.date | date: post_short_df }}
{% else %}
{{ include.date | date: site.data.date_format.post.long }}
{{ include.date | date: post_long_df }}
{% endif %}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span>
</span>

View file

@ -42,7 +42,7 @@
<span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search"
aria-label="search" placeholder="{{ site.data.label.search_hint }}...">
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span>
<span id="search-cancel" >Cancel</span>

View file

@ -14,11 +14,13 @@ layout: page
</h1>
<ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
</li>
{% endfor %}
</ul>

View file

@ -83,7 +83,7 @@ layout: page
{% if post.pin %}
<div class="pin">
<i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.label.pin_prompt }}</span>
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
</div>
{% endif %}

View file

@ -7,6 +7,7 @@ layout: page
# MIT Licensed
---
<div id="page-tag">
<h1 class="pl-lg-2">
<i class="fa fa-tag fa-fw text-muted"></i>
@ -14,11 +15,13 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1>
<ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
</li>
{% endfor %}
</ul>

View file

@ -2,9 +2,6 @@
Post-specific style
*/
$prompt-older: 'older'!default; // "{{ site.data.label.post.button.previous }}";
$prompt-newer: 'newer'!default; // "{{ site.data.label.post.button.next }}";
@mixin btn-sharing-color($light-color, $important: false) {
@if $important {
color: var(--btn-share-color, $light-color)!important;
@ -94,27 +91,22 @@ $prompt-newer: 'newer'!default; // "{{ site.data.label.post.button.next }}";
white-space: normal;
}
a, span {
a {
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
left: 0.5px;
&::before {
content: $prompt-older
}
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0.5px;
&::before {
content: $prompt-newer
}
}
}
} // .post-navigation

View file

@ -1,9 +1,7 @@
---
---
// see: /_sass/addon/commons.scss
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
$prompt-older: "{{ site.data.label.post.button.previous }}";
$prompt-newer: "{{ site.data.label.post.button.next }}";
@import "jekyll-theme-chirpy";