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" tooltip: "%a, %b %e, %Y, %l:%M %p %z"
post: post:
long: "%b %e, %Y" long: "%b %e, %Y"
short: "%b %e" short: "%b %e"

View File

@ -11,10 +11,13 @@ panel:
post: post:
relate_posts: Further Reading relate_posts: Further Reading
share: Share
button: button:
next: Newer next: Newer
previous: Older previous: Older
search_hint: Search # text show on search bar 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 # © 2020 Cotes Chung
# MIT Licensed # MIT Licensed
label: "Share"
platforms: platforms:
- -
type: Twitter type: Twitter

View File

@ -15,7 +15,7 @@
{% if update_list.size > 0 %} {% if update_list.size > 0 %}
<div id="access-lastmod" class="post"> <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"> <ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %} {% for item in update_list %}
@ -34,7 +34,7 @@
{% if trending_tags.size > 0 %} {% if trending_tags.size > 0 %}
<div id="access-tags"> <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"> <div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %} {% 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> <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"> <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2"> <span class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc -}} {{- site.data.label.panel.toc | default: 'Contents' -}}
</span> </span>
<nav id="toc" data-toggle="toc"></nav> <nav id="toc" data-toggle="toc"></nav>
</div> </div>

View File

@ -9,7 +9,8 @@
<div class="post-navigation d-flex justify-content-between"> <div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %} {% 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> <p>{{ page.previous.title }}</p>
</a> </a>
{% else %} {% else %}
@ -19,7 +20,8 @@
{% endif %} {% endif %}
{% if page.next.url %} {% 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> <p>{{ page.next.title }}</p>
</a> </a>
{% else %} {% else %}
@ -28,4 +30,4 @@
</span> </span>
{% endif %} {% endif %}
</div> </div>

View File

@ -8,7 +8,7 @@
--> -->
<div class="share-wrapper"> <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"> <span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | absolute_url %} {% assign url = page.url | absolute_url %}

View File

@ -3,13 +3,17 @@
--> -->
{% assign words = include.content | strip_html | number_of_words: "auto" %} {% 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 %} {% unless read_time > 0 %}
{% assign read_time = site.data.read_time.min_time %} {% assign read_time = min_time %}
{% endunless %} {% endunless %}
<!-- return element --> <!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words"> <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> </span>

View File

@ -85,7 +85,8 @@
{% if index_list.size > 0 %} {% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4"> <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"> <div class="card-deck mb-4">
{% for entry in index_list %} {% for entry in index_list %}
{% assign index = entry | plus: 0 %} {% assign index = entry | plus: 0 %}

View File

@ -8,7 +8,7 @@
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded"> <div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-xl-11 post-content"> <div class="col-12 col-xl-11 post-content">
<div id="search-hints"> <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 %} {% include trending-tags.html %}

View File

@ -6,22 +6,27 @@
© 2020 Cotes Chung © 2020 Cotes Chung
MIT License 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 %}" <span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %} {% if include.tooltip %}
data-toggle="tooltip" data-toggle="tooltip"
data-placement="bottom" data-placement="bottom"
title="{{ include.date | date: site.data.date_format.tooltip }}" title="{{ include.date | date: tooltip_df }}"
{% endif %}> {% endif %}>
{% assign this_year = site.time | date: "%Y" %} {% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %} {% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %} {% if post_year == this_year %}
{{ include.date | date: site.data.date_format.post.short }} {{ include.date | date: post_short_df }}
{% else %} {% else %}
{{ include.date | date: site.data.date_format.post.long }} {{ include.date | date: post_long_df }}
{% endif %} {% endif %}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i> <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"> <span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i> <i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search" <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> <i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span> </span>
<span id="search-cancel" >Cancel</span> <span id="search-cancel" >Cancel</span>

View File

@ -14,11 +14,13 @@ layout: page
</h1> </h1>
<ul class="post-content pl-0"> <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 %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <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> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -83,7 +83,7 @@ layout: page
{% if post.pin %} {% if post.pin %}
<div class="pin"> <div class="pin">
<i class="fas fa-thumbtack fa-fw"></i> <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> </div>
{% endif %} {% endif %}

View File

@ -7,6 +7,7 @@ layout: page
# MIT Licensed # MIT Licensed
--- ---
<div id="page-tag"> <div id="page-tag">
<h1 class="pl-lg-2"> <h1 class="pl-lg-2">
<i class="fa fa-tag fa-fw text-muted"></i> <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> <span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1> </h1>
<ul class="post-content pl-0"> <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 %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <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> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -2,9 +2,6 @@
Post-specific style 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) { @mixin btn-sharing-color($light-color, $important: false) {
@if $important { @if $important {
color: var(--btn-share-color, $light-color)!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; white-space: normal;
} }
a, span { a {
&::before { &::before {
color: var(--text-muted-color); color: var(--text-muted-color);
font-size: 0.65rem; font-size: 0.65rem;
text-transform: uppercase; text-transform: uppercase;
content: attr(prompt);
} }
&:first-child { &:first-child {
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
left: 0.5px; left: 0.5px;
&::before {
content: $prompt-older
}
} }
&:last-child { &:last-child {
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
right: 0.5px; right: 0.5px;
&::before {
content: $prompt-newer
}
} }
} }
} // .post-navigation } // .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 $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"; @import "jekyll-theme-chirpy";