jekyll-theme-chirpy 4.0.2 → 4.1.0

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -33
  3. data/_config.yml +16 -4
  4. data/_data/locales/en.yml +87 -0
  5. data/_data/locales/zh-CN.yml +86 -0
  6. data/_includes/footer.html +17 -8
  7. data/_includes/head.html +8 -6
  8. data/_includes/js-selector.html +8 -3
  9. data/_includes/no-zero-date.html +13 -0
  10. data/_includes/panel.html +3 -3
  11. data/_includes/post-nav.html +4 -4
  12. data/_includes/post-paginator.html +9 -1
  13. data/_includes/post-sharing.html +5 -3
  14. data/_includes/read-time.html +12 -2
  15. data/_includes/refactor-content.html +75 -6
  16. data/_includes/related-posts.html +1 -1
  17. data/_includes/search-results.html +1 -1
  18. data/_includes/sidebar.html +8 -7
  19. data/_includes/timeago.html +12 -16
  20. data/_includes/topbar.html +27 -21
  21. data/_layouts/archives.html +4 -3
  22. data/_layouts/categories.html +15 -18
  23. data/_layouts/category.html +2 -2
  24. data/_layouts/default.html +3 -1
  25. data/_layouts/home.html +3 -4
  26. data/_layouts/page.html +8 -1
  27. data/_layouts/post.html +25 -11
  28. data/_layouts/tag.html +2 -3
  29. data/_sass/addon/commons.scss +34 -21
  30. data/_sass/addon/syntax.scss +24 -16
  31. data/_sass/addon/variables.scss +25 -13
  32. data/_sass/jekyll-theme-chirpy.scss +2 -1
  33. data/_sass/layout/home.scss +30 -15
  34. data/_sass/layout/post.scss +0 -12
  35. data/_sass/variables-hook.scss +3 -0
  36. data/assets/404.html +15 -5
  37. data/assets/css/style.scss +7 -2
  38. data/assets/feed.xml +1 -1
  39. data/assets/js/dist/categories.min.js +1 -1
  40. data/assets/js/dist/commons.min.js +1 -1
  41. data/assets/js/dist/home.min.js +2 -2
  42. data/assets/js/dist/page.min.js +2 -2
  43. data/assets/js/dist/post.min.js +2 -2
  44. data/assets/js/dist/pvreport.min.js +1 -1
  45. metadata +6 -5
  46. data/_data/date_format.yml +0 -7
  47. data/_data/label.yml +0 -19
  48. data/_data/rights.yml +0 -11
@@ -3,8 +3,8 @@ layout: page
3
3
  # The Archives of posts.
4
4
  ---
5
5
 
6
-
7
6
  <div id="archives" class="pl-xl-2">
7
+
8
8
  {% for post in site.posts %}
9
9
  {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
10
10
  {% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@@ -17,9 +17,10 @@ layout: page
17
17
  <li>
18
18
  <div>
19
19
  {% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
20
- {% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
20
+ {% capture _mth_df %}{{ site.data.locales[site.lang].date_format.post.archive_month | default: "%b" }}{% endcapture %}
21
+ {% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %}
21
22
  <span class="date day">{{ this_day }}</span>
22
- <span class="date month small text-muted">{{ this_month }}</span>
23
+ <span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span>
23
24
  <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
24
25
  </div>
25
26
  </li>
@@ -3,7 +3,6 @@ layout: page
3
3
  # All the Categories of posts
4
4
  ---
5
5
 
6
-
7
6
  {% assign HEAD_PREFIX = "h_" %}
8
7
  {% assign LIST_PREFIX = "l_" %}
9
8
 
@@ -33,28 +32,23 @@ layout: page
33
32
 
34
33
  <div class="card categories">
35
34
  <!-- top-category -->
36
- <div class="card-header d-flex justify-content-between hide-border-bottom"
37
- id="{{ HEAD_PREFIX }}{{ group_index }}">
35
+ <div id="{{ HEAD_PREFIX }}{{ group_index }}"
36
+ class="card-header d-flex justify-content-between hide-border-bottom">
38
37
  <span>
39
- {% if sub_categories_size > 0 %}
40
- <i class="far fa-folder-open fa-fw"></i>
41
- {% else %}
42
- <i class="far fa-folder fa-fw"></i>
43
- {% endif %}
44
- <a href="{{ site.baseurl }}/categories/{{ category_name | slugify | url_encode }}/"
45
- class="ml-1 mr-2">
46
- {{ category_name }}
47
- </a>
38
+ <i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>
39
+
40
+ {% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
41
+ <a href="{{ _category_url | relative_url }}" class="ml-1 mr-2">{{ category_name }}</a>
48
42
 
49
43
  <!-- content count -->
50
44
  {% assign top_posts_size = site.categories[category_name] | size %}
51
45
  <span class="text-muted small font-weight-light">
52
46
  {% if sub_categories_size > 0 %}
53
47
  {{ sub_categories_size }}
54
- {% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
48
+ {{ site.data.locales[site.lang].categories.category_measure | default: 'categories' }},
55
49
  {% endif %}
56
50
  {{ top_posts_size }}
57
- post{% if top_posts_size > 1 %}s{% endif %}
51
+ {{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
58
52
  </span>
59
53
  </span>
60
54
 
@@ -80,11 +74,14 @@ layout: page
80
74
  {% for sub_category in sub_categories %}
81
75
  <li class="list-group-item">
82
76
  <i class="far fa-folder fa-fw"></i>
83
- <a href="{{ site.baseurl }}/categories/{{ sub_category | slugify | url_encode }}/"
84
- class="ml-1 mr-2">{{ sub_category }}</a>
77
+
78
+ {% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
79
+ <a href="{{ _sub_ctg_url | relative_url }}" class="ml-1 mr-2">{{ sub_category }}</a>
80
+
85
81
  {% assign posts_size = site.categories[sub_category] | size %}
86
- <span class="text-muted small font-weight-light">{{ posts_size }}
87
- post{% if posts_size > 1 %}s{% endif %}
82
+ <span class="text-muted small font-weight-light">
83
+ {{ posts_size }}
84
+ {{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
88
85
  </span>
89
86
  </li>
90
87
  {% endfor %}
@@ -11,13 +11,13 @@ layout: page
11
11
  </h1>
12
12
 
13
13
  <ul class="post-content pl-0">
14
- {% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
14
+ {% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
15
15
 
16
16
  {% for post in page.posts %}
17
17
  <li class="d-flex justify-content-between pl-md-3 pr-md-3">
18
18
  <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
19
19
  <span class="dash flex-grow-1"></span>
20
- <span class="text-muted small">{{ post.date | date: post_long_df }}</span>
20
+ <span class="text-muted small">{{ post.date | date: post_df }}</span>
21
21
  </li>
22
22
  {% endfor %}
23
23
  </ul>
@@ -11,7 +11,7 @@ layout: compress
11
11
  {% endif %}
12
12
  {% endcapture %}
13
13
 
14
- <html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
14
+ <html lang="{{ site.content_lang | default: site.lang }}" {{ prefer_mode }}>
15
15
 
16
16
  {% include head.html %}
17
17
 
@@ -46,6 +46,8 @@ layout: compress
46
46
 
47
47
  {% include search-loader.html %}
48
48
 
49
+ {% include js-selector.html %}
50
+
49
51
  </body>
50
52
 
51
53
  </html>
data/_layouts/home.html CHANGED
@@ -3,9 +3,9 @@ layout: page
3
3
  # The Home page layout
4
4
  ---
5
5
 
6
+ {% assign pinned = site.posts | where: "pin", "true" %}
7
+ {% assign default = site.posts | where_exp: "item", "item.pin != true" %}
6
8
 
7
- {% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
8
- {% assign default = site.posts | where_exp: "item", "item.pin != true" %}
9
9
  {% assign posts = "" | split: "" %}
10
10
 
11
11
  <!-- Get pinned posts -->
@@ -39,7 +39,6 @@ layout: page
39
39
  {% endfor %}
40
40
  {% endif %}
41
41
 
42
-
43
42
  <div id="post-list">
44
43
 
45
44
  {% for post in posts %}
@@ -79,7 +78,7 @@ layout: page
79
78
  {% if post.pin %}
80
79
  <div class="pin">
81
80
  <i class="fas fa-thumbtack fa-fw"></i>
82
- <span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
81
+ <span>{{ site.data.locales[site.lang].post.pin_prompt | default: 'Pinned' }}</span>
83
82
  </div>
84
83
  {% endif %}
85
84
 
data/_layouts/page.html CHANGED
@@ -7,7 +7,14 @@ layout: default
7
7
  <div class="col-12 col-lg-11 col-xl-8">
8
8
  <div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4">
9
9
  {% if page.dynamic_title %}
10
- <h1 class="dynamic-title">{{ page.title }}</h1>
10
+ <h1 class="dynamic-title">
11
+ {% if page.collection == 'tabs' %}
12
+ {%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
13
+ {{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
14
+ {% else %}
15
+ {{- page.title -}}
16
+ {% endif %}
17
+ </h1>
11
18
  <div class="post-content">
12
19
  {{ content }}
13
20
  </div>
data/_layouts/post.html CHANGED
@@ -17,24 +17,28 @@ layout: default
17
17
  <span class="semi-bold">
18
18
  {{ page.author | default: site.social.name }}
19
19
  </span>
20
- {% include timeago.html date=page.date prep="on" tooltip=true %}
20
+ {% capture _preposition %}{{ site.data.locales[site.lang].post.published | default: 'on' }}{% endcapture %}
21
+ {% include timeago.html date=page.date tooltip=true preposition=_preposition %}
21
22
  </div>
22
23
 
23
24
  <div>
24
25
  <!-- lastmod -->
25
26
  {% if page.last_modified_at %}
26
27
  <span>
27
- {% include timeago.html date=page.last_modified_at
28
- class="lastmod" prefix="Updated" tooltip=true %}
28
+ {{ site.data.locales[site.lang].post.updated | default: 'Updated' }}
29
+ {% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
29
30
  </span>
30
31
  {% endif %}
31
32
 
32
33
  <!-- read time -->
33
- {% include read-time.html content=content %}
34
+ {% include read-time.html content=content prompt=true %}
34
35
 
35
36
  <!-- page views -->
36
37
  {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
37
- <span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
38
+ <span id="pv" class="pageviews">
39
+ <i class="fas fa-spinner fa-spin fa-fw"></i>
40
+ </span>
41
+ {{ site.data.locales[site.lang].post.pageview_measure | default: "views" }}
38
42
  {% endif %}
39
43
 
40
44
  </div>
@@ -44,7 +48,11 @@ layout: default
44
48
  <div class="post-content">
45
49
 
46
50
  {% if page.image.src %}
47
- <img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}">
51
+ <img src="{{ page.image.src }}"
52
+ class="preview-img"
53
+ alt="{{ page.image.alt | default: "Preview Image" }}"
54
+ {% if page.image.width %}width="{{ page.image.width }}"{% endif %}
55
+ {% if page.image.height %}height="{{ page.image.height }}"{% endif %}>
48
56
  {% endif %}
49
57
 
50
58
  {{ content }}
@@ -55,6 +63,7 @@ layout: default
55
63
 
56
64
  <!-- categories -->
57
65
  {% if page.categories.size > 0 %}
66
+
58
67
  <div class="post-meta mb-3">
59
68
  <i class="far fa-folder-open fa-fw mr-1"></i>
60
69
  {% for category in page.categories %}
@@ -79,13 +88,18 @@ layout: default
79
88
 
80
89
  <div class="post-tail-bottom
81
90
  d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
82
- {% if site.data.rights.license %}
83
91
  <div class="license-wrapper">
84
- This post is licensed under
85
- <a href="{{ site.data.rights.license.link }}">{{ site.data.rights.license.name }}</a>
86
- by the author.
87
- </div>
92
+ {% if site.data.locales[site.lang].copyright.license.template %}
93
+ {% capture _replacement %}
94
+ <a href="{{ site.data.locales[site.lang].copyright.license.link }}">
95
+ {{ site.data.locales[site.lang].copyright.license.name }}
96
+ </a>
97
+ {% endcapture %}
98
+ {{ site.data.locales[site.lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
99
+ {% else %}
100
+ <span class="text-muted small">{{ site.outdated }}</span>
88
101
  {% endif %}
102
+ </div>
89
103
 
90
104
  {% include post-sharing.html %}
91
105
 
data/_layouts/tag.html CHANGED
@@ -3,7 +3,6 @@ layout: page
3
3
  # The layout for Tag page
4
4
  ---
5
5
 
6
-
7
6
  <div id="page-tag">
8
7
  <h1 class="pl-lg-2">
9
8
  <i class="fa fa-tag fa-fw text-muted"></i>
@@ -11,13 +10,13 @@ layout: page
11
10
  <span class="lead text-muted pl-2">{{ page.posts | size }}</span>
12
11
  </h1>
13
12
  <ul class="post-content pl-0">
14
- {% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
13
+ {% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
15
14
 
16
15
  {% for post in page.posts %}
17
16
  <li class="d-flex justify-content-between pl-md-3 pr-md-3">
18
17
  <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
19
18
  <span class="dash flex-grow-1"></span>
20
- <span class="text-muted small">{{ post.date | date: post_long_df }}</span>
19
+ <span class="text-muted small">{{ post.date | date: post_df }}</span>
21
20
  </li>
22
21
  {% endfor %}
23
22
  </ul>
@@ -107,6 +107,7 @@ a {
107
107
 
108
108
  img {
109
109
  max-width: 100%;
110
+ height: auto;
110
111
  }
111
112
 
112
113
  blockquote {
@@ -363,9 +364,29 @@ footer {
363
364
  overflow-wrap: break-word;
364
365
  word-wrap: break-word;
365
366
 
367
+ @mixin caption {
368
+ + em {
369
+ display: block;
370
+ text-align: center;
371
+ font-style: normal;
372
+ font-size: 80%;
373
+ padding: 0;
374
+ color: #6d6c6c;
375
+ }
376
+ }
377
+
378
+ @keyframes fade-in {
379
+ from { opacity: 0; }
380
+ to { opacity: 1; }
381
+ }
382
+
366
383
  img[data-src] {
367
384
  margin: 0.5rem 0;
368
385
 
386
+ &[data-loaded=true] {
387
+ animation: fade-in linear .5s;
388
+ }
389
+
369
390
  &.left {
370
391
  float: left;
371
392
  margin: 0.75rem 1rem 1rem 0;
@@ -380,6 +401,8 @@ footer {
380
401
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
381
402
  }
382
403
 
404
+ @include caption;
405
+
383
406
  }
384
407
 
385
408
  a {
@@ -404,14 +427,7 @@ footer {
404
427
  }
405
428
 
406
429
  &.img-link {
407
- + em {
408
- display: block;
409
- text-align: center;
410
- font-style: normal;
411
- font-size: 80%;
412
- padding: 0;
413
- color: #6d6c6c;
414
- }
430
+ @include caption;
415
431
  }
416
432
 
417
433
  } // a
@@ -589,8 +605,6 @@ figure .mfp-title {
589
605
 
590
606
  /* --- sidebar layout --- */
591
607
 
592
- $tab-count: 5 !default;
593
-
594
608
  $sidebar-display: "sidebar-display";
595
609
 
596
610
  #sidebar {
@@ -601,7 +615,7 @@ $sidebar-display: "sidebar-display";
601
615
  left: 0;
602
616
  height: 100%;
603
617
  overflow-y: auto;
604
- width: $sidebar-width-medium;
618
+ width: $sidebar-width;
605
619
  z-index: 99;
606
620
  background: var(--sidebar-bg);
607
621
 
@@ -710,7 +724,6 @@ $sidebar-display: "sidebar-display";
710
724
  width: 100%;
711
725
 
712
726
  &:last-child {
713
- $cursor-width: 3px;
714
727
 
715
728
  a {
716
729
  position: relative;
@@ -740,12 +753,12 @@ $sidebar-display: "sidebar-display";
740
753
 
741
754
  @for $i from 1 through $tab-count {
742
755
  $offset: $tab-count - $i;
743
- $top: -$offset * $tab-height + $tab-cursor-height / 2;
756
+ $top: -$offset * $tab-height + ($tab-height - $tab-cursor-height) / 2;
744
757
 
745
758
  @if $i < $tab-count {
746
759
  > li.active:nth-child(#{$i}),
747
760
  > li.nav-item:nth-child(#{$i}):hover {
748
- ~li:last-child::after {
761
+ ~ li:last-child::after {
749
762
  @include fix-cursor($top);
750
763
  }
751
764
  }
@@ -839,7 +852,7 @@ $sidebar-display: "sidebar-display";
839
852
  height: $topbar-height;
840
853
  position: fixed;
841
854
  top: 0;
842
- left: 260px; /* same as sidebar width */
855
+ left: $sidebar-width; /* same as sidebar width */
843
856
  right: 0;
844
857
  transition: top 0.2s ease-in-out;
845
858
  z-index: 50;
@@ -880,7 +893,7 @@ $sidebar-display: "sidebar-display";
880
893
 
881
894
  #search-wrapper {
882
895
  display: flex;
883
- width: 95%;
896
+ width: 85%;
884
897
  border-radius: 1rem;
885
898
  border: 1px solid var(--search-wrapper-bg);
886
899
  background: var(--search-wrapper-bg);
@@ -1083,7 +1096,7 @@ $sidebar-display: "sidebar-display";
1083
1096
 
1084
1097
  @media all and (max-width: 576px) {
1085
1098
 
1086
- $footer-height: 6rem; // overwrite
1099
+ $footer-height: $footer-height-mobile; // overwrite
1087
1100
 
1088
1101
  #main > div.row:first-child > div:first-child {
1089
1102
  min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
@@ -1157,7 +1170,7 @@ $sidebar-display: "sidebar-display";
1157
1170
 
1158
1171
  #topbar-wrapper,
1159
1172
  #main-wrapper {
1160
- transform: translateX(#{$sidebar-width-medium});
1173
+ transform: translateX(#{$sidebar-width});
1161
1174
  }
1162
1175
 
1163
1176
  }
@@ -1165,8 +1178,8 @@ $sidebar-display: "sidebar-display";
1165
1178
  #sidebar {
1166
1179
  @extend %slide;
1167
1180
 
1168
- transform: translateX(-#{$sidebar-width-medium}); // hide
1169
- -webkit-transform: translateX(-#{$sidebar-width-medium});
1181
+ transform: translateX(-#{$sidebar-width}); // hide
1182
+ -webkit-transform: translateX(-#{$sidebar-width});
1170
1183
 
1171
1184
  .cursor {
1172
1185
  -webkit-transition: none;
@@ -1264,7 +1277,7 @@ $sidebar-display: "sidebar-display";
1264
1277
  }
1265
1278
 
1266
1279
  #main-wrapper {
1267
- margin-left: $sidebar-width-medium;
1280
+ margin-left: $sidebar-width;
1268
1281
  }
1269
1282
 
1270
1283
  .profile-wrapper {
@@ -39,8 +39,6 @@ html[mode=dark] {
39
39
  padding: 1.5rem;
40
40
  }
41
41
 
42
- $code-font-size: 0.85rem;
43
-
44
42
  div > pre {
45
43
  @extend %code-snippet-bg;
46
44
  @extend %code-snippet-radius;
@@ -65,26 +63,14 @@ div > pre {
65
63
  }
66
64
 
67
65
  overflow: auto;
68
- .lineno {
69
- margin-left: 0.2rem;
70
- padding-right: 0.5rem;
71
- min-width: 2.2rem;
72
- text-align: right;
73
- color: var(--highlight-lineno-color);
74
- border-right: 1px solid var(--highlight-lineno-border-color);
75
- -webkit-user-select: none;
76
- -khtml-user-select: none;
77
- -moz-user-select: none;
78
- -ms-user-select: none;
79
- -o-user-select: none;
80
- user-select: none;
81
- }
66
+
82
67
  pre {
83
68
  margin-bottom: 0;
84
69
  font-size: $code-font-size;
85
70
  line-height: 1.4rem;
86
71
  word-wrap: normal; /* Fixed Safari overflow-x */
87
72
  }
73
+
88
74
  table {
89
75
  padding: 0;
90
76
  border: 0;
@@ -93,10 +79,32 @@ div > pre {
93
79
  word-break: normal; /* Fixed iOS safari linenos code break */
94
80
  }
95
81
  }
82
+
96
83
  td {
97
84
  padding: 0;
98
85
  border: 0;
99
86
  }
87
+
88
+ .lineno {
89
+ margin-left: 0.2rem;
90
+ padding-right: 0.5rem;
91
+ min-width: 2.2rem;
92
+ text-align: right;
93
+ color: var(--highlight-lineno-color);
94
+ border-right: 1px solid var(--highlight-lineno-border-color);
95
+ -webkit-user-select: none;
96
+ -khtml-user-select: none;
97
+ -moz-user-select: none;
98
+ -ms-user-select: none;
99
+ -o-user-select: none;
100
+ user-select: none;
101
+ }
102
+
103
+ /* set the dollar sign to non-selectable */
104
+ .gp {
105
+ user-select: none;
106
+ }
107
+
100
108
  } //.highlight
101
109
 
102
110
  code {