Joseph Hale's Technical Blog
0

Configure Feed

Select the types of activity you want to include in your feed.

Set default values for site variables

good for gem-based first run

Cotes Chung (Jan 26, 2021, 8:24 PM +0800) cbb3bd4b 7ed3bef1

+45 -43
+1
_data/date_format.yml
··· 6 6 7 7 8 8 tooltip: "%a, %b %e, %Y, %l:%M %p %z" 9 + 9 10 post: 10 11 long: "%b %e, %Y" 11 12 short: "%b %e"
+4 -1
_data/label.yml
··· 11 11 12 12 post: 13 13 relate_posts: Further Reading 14 + share: Share 14 15 button: 15 16 next: Newer 16 17 previous: Older 17 18 18 19 search_hint: Search # text show on search bar 19 20 20 - pin_prompt: Pinned # pinned prompt 21 + pin_prompt: Pinned # pinned prompt 22 + 23 + read_time_unit: min # see posts' time to read
-7
_data/read_time.yml
··· 1 - # words per minute 2 - wpm: 180 3 - 4 - # minimum value 5 - min_time: 1 6 - 7 - prompt: min
-2
_data/share.yml
··· 6 6 # © 2020 Cotes Chung 7 7 # MIT Licensed 8 8 9 - label: "Share" 10 - 11 9 platforms: 12 10 - 13 11 type: Twitter
+3 -3
_includes/panel.html
··· 15 15 {% if update_list.size > 0 %} 16 16 17 17 <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> 19 19 <ul class="post-content pl-0 pb-1 ml-1 mt-2"> 20 20 21 21 {% for item in update_list %} ··· 34 34 35 35 {% if trending_tags.size > 0 %} 36 36 <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> 38 38 <div class="d-flex flex-wrap mt-3 mb-1 mr-3"> 39 39 40 40 {% for tag_name in trending_tags %} ··· 52 52 <script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script> 53 53 <div id="toc-wrapper" class="pl-0 pr-4 mb-5"> 54 54 <span class="pl-3 pt-2 mb-2"> 55 - {{- site.data.label.panel.toc -}} 55 + {{- site.data.label.panel.toc | default: 'Contents' -}} 56 56 </span> 57 57 <nav id="toc" data-toggle="toc"></nav> 58 58 </div>
+5 -3
_includes/post-nav.html
··· 9 9 10 10 <div class="post-navigation d-flex justify-content-between"> 11 11 {% 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' }}"> 13 14 <p>{{ page.previous.title }}</p> 14 15 </a> 15 16 {% else %} ··· 19 20 {% endif %} 20 21 21 22 {% 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' }}"> 23 25 <p>{{ page.next.title }}</p> 24 26 </a> 25 27 {% else %} ··· 28 30 </span> 29 31 {% endif %} 30 32 31 - </div> 33 + </div>
+1 -1
_includes/post-sharing.html
··· 8 8 --> 9 9 10 10 <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> 12 12 <span class="share-icons"> 13 13 {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} 14 14 {% assign url = page.url | absolute_url %}
+7 -3
_includes/read-time.html
··· 3 3 --> 4 4 {% assign words = include.content | strip_html | number_of_words: "auto" %} 5 5 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 %} 7 11 8 12 {% unless read_time > 0 %} 9 - {% assign read_time = site.data.read_time.min_time %} 13 + {% assign read_time = min_time %} 10 14 {% endunless %} 11 15 12 16 <!-- return element --> 13 17 <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" -}} 15 19 </span>
+2 -1
_includes/related-posts.html
··· 85 85 86 86 {% if index_list.size > 0 %} 87 87 <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> 89 90 <div class="card-deck mb-4"> 90 91 {% for entry in index_list %} 91 92 {% assign index = entry | plus: 0 %}
+1 -1
_includes/search-results.html
··· 8 8 <div id="search-result-wrapper" class="d-flex justify-content-center unloaded"> 9 9 <div class="col-12 col-xl-11 post-content"> 10 10 <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> 12 12 13 13 {% include trending-tags.html %} 14 14
+9 -4
_includes/timeago.html
··· 6 6 © 2020 Cotes Chung 7 7 MIT License 8 8 --> 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 + 9 14 <span class="timeago {% if include.class %}{{ include.class }}{% endif %}" 10 15 {% if include.tooltip %} 11 16 data-toggle="tooltip" 12 17 data-placement="bottom" 13 - title="{{ include.date | date: site.data.date_format.tooltip }}" 18 + title="{{ include.date | date: tooltip_df }}" 14 19 {% endif %}> 15 20 16 21 {% assign this_year = site.time | date: "%Y" %} 17 22 {% assign post_year = include.date | date: "%Y" %} 18 23 19 24 {% if post_year == this_year %} 20 - {{ include.date | date: site.data.date_format.post.short }} 25 + {{ include.date | date: post_short_df }} 21 26 {% else %} 22 - {{ include.date | date: site.data.date_format.post.long }} 27 + {{ include.date | date: post_long_df }} 23 28 {% endif %} 24 29 25 30 <i class="unloaded">{{ include.date | date_to_xmlschema }}</i> 26 31 27 - </span> 32 + </span>
+1 -1
_includes/topbar.html
··· 42 42 <span id="search-wrapper" class="align-items-center"> 43 43 <i class="fas fa-search fa-fw"></i> 44 44 <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' }}..."> 46 46 <i class="fa fa-times-circle fa-fw" id="search-cleaner"></i> 47 47 </span> 48 48 <span id="search-cancel" >Cancel</span>
+3 -1
_layouts/category.html
··· 14 14 </h1> 15 15 16 16 <ul class="post-content pl-0"> 17 + {% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %} 18 + 17 19 {% for post in page.posts %} 18 20 <li class="d-flex justify-content-between pl-md-3 pr-md-3"> 19 21 <a href="{{ post.url | relative_url }}">{{ post.title }}</a> 20 22 <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> 22 24 </li> 23 25 {% endfor %} 24 26 </ul>
+1 -1
_layouts/home.html
··· 83 83 {% if post.pin %} 84 84 <div class="pin"> 85 85 <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> 87 87 </div> 88 88 {% endif %} 89 89
+4 -1
_layouts/tag.html
··· 7 7 # MIT Licensed 8 8 --- 9 9 10 + 10 11 <div id="page-tag"> 11 12 <h1 class="pl-lg-2"> 12 13 <i class="fa fa-tag fa-fw text-muted"></i> ··· 14 15 <span class="lead text-muted pl-2">{{ page.posts | size }}</span> 15 16 </h1> 16 17 <ul class="post-content pl-0"> 18 + {% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %} 19 + 17 20 {% for post in page.posts %} 18 21 <li class="d-flex justify-content-between pl-md-3 pr-md-3"> 19 22 <a href="{{ post.url | relative_url }}">{{ post.title }}</a> 20 23 <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> 22 25 </li> 23 26 {% endfor %} 24 27 </ul>
+2 -10
_sass/layout/post.scss
··· 2 2 Post-specific style 3 3 */ 4 4 5 - $prompt-older: 'older'!default; // "{{ site.data.label.post.button.previous }}"; 6 - $prompt-newer: 'newer'!default; // "{{ site.data.label.post.button.next }}"; 7 - 8 5 @mixin btn-sharing-color($light-color, $important: false) { 9 6 @if $important { 10 7 color: var(--btn-share-color, $light-color)!important; ··· 94 91 white-space: normal; 95 92 } 96 93 97 - a, span { 94 + a { 98 95 &::before { 99 96 color: var(--text-muted-color); 100 97 font-size: 0.65rem; 101 98 text-transform: uppercase; 99 + content: attr(prompt); 102 100 } 103 101 &:first-child { 104 102 border-top-right-radius: 0; 105 103 border-bottom-right-radius: 0; 106 104 left: 0.5px; 107 - &::before { 108 - content: $prompt-older 109 - } 110 105 } 111 106 &:last-child { 112 107 border-top-left-radius: 0; 113 108 border-bottom-left-radius: 0; 114 109 right: 0.5px; 115 - &::before { 116 - content: $prompt-newer 117 - } 118 110 } 119 111 } 120 112 } // .post-navigation
+1 -3
assets/css/style.scss
··· 1 1 --- 2 2 --- 3 3 4 + // see: /_sass/addon/commons.scss 4 5 $tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab 5 - 6 - $prompt-older: "{{ site.data.label.post.button.previous }}"; 7 - $prompt-newer: "{{ site.data.label.post.button.next }}"; 8 6 9 7 @import "jekyll-theme-chirpy";