jekyll-theme-yat 1.2.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 199b703930a9c7789ba8aa41c785b78c60297f4deb8ecae19a0931279a041a43
4
- data.tar.gz: 5bb14cf3155134a0adb196352f8fdf50b40e0867644979bd11423cb79f2c7eba
3
+ metadata.gz: b240330b198155ad46585d5205c0d08f794cdd5267edb1d3d9d07ed8e228f1cd
4
+ data.tar.gz: cbf130a4d7beb75c8d68c44b7621ba0c140b6ea839e4521f1ce7e4a8e57a0484
5
5
  SHA512:
6
- metadata.gz: '08e63a1440c99e39c40acede34c082b69c30fbf1aead084ed7054ec8359aa01bb0bd4e798242594c544872ac4febde68d5c3ca237f0dc618ef1fb7bfa0c5cece'
7
- data.tar.gz: 141aa0359967926e9dc208297e31cf1799ddb6dd2e676f46d8e2833758886722f54f33f820b53d8d652a8192ac7c3513c8608eeda78c9d1428e8c86d1eeae663
6
+ metadata.gz: 7e7475aa560905263a4e4448b4ba7d4e4eafe36ceb93a851637ae8d4983b6ca499b270fc729ac27ce3d3b14d5108eb48c3841bbe5b2d69191b97b78334bca975
7
+ data.tar.gz: 67f7984dd1c2620267a8b0808b48ce7b6ee8ad45330739b1f69c393aef99f3ee995ccd016f33d01b77e40197da630aec5fc8cc1604f9d2fb618d7616b36c3845
data/README.md CHANGED
@@ -1,11 +1,21 @@
1
1
  # jekyll-theme-yat
2
+ [![Gem Version](https://badge.fury.io/rb/jekyll-theme-yat.svg)](http://badge.fury.io/rb/jekyll-theme-yat)
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
4
+ [![Donate (Liberapay)](http://img.shields.io/liberapay/goal/jeffreytse.svg?logo=liberapay)](https://liberapay.com/jeffreytse)
5
+ [![Donate (Patreon)](https://img.shields.io/badge/support-patreon-F96854.svg?style=flat-square)](https://patreon.com/jeffreytse)
6
+ <a href="https://ko-fi.com/jeffreytse">
7
+ <img height="20" src="https://www.ko-fi.com/img/githubbutton_sm.svg"
8
+ alt="Donate (Ko-fi)" />
9
+ </a>
2
10
 
3
- Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
11
+ Hey, nice to meet you, you found this Jekyll theme. Here the yet another theme is a modern theme, and it's quiet clear, clean and neat for writers and posts.
4
12
 
5
- To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!
6
13
 
7
- TODO: Delete this and the text above, and describe your gem
14
+ <p align="center">
8
15
 
16
+ <img src="https://user-images.githubusercontent.com/9413601/87244819-c34ada80-c472-11ea-9c67-5827dd55d3c7.png" alt="demo-screenshot" width="720px" style="box-shadow: 0px 0px 18px 5px #f2f2f2" />
17
+
18
+ </p>
9
19
 
10
20
  ## Installation
11
21
 
@@ -33,10 +43,6 @@ Or install it yourself as:
33
43
 
34
44
  TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
35
45
 
36
- ## Contributing
37
-
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/jeffreytse/jekyll-theme-yat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
-
40
46
  ## Development
41
47
 
42
48
  To set up your environment to develop this theme, run `bundle install`.
@@ -46,7 +52,12 @@ Your theme is setup just like a normal Jekyll site! To test your theme, run `bun
46
52
  When your theme is released, only the files in `_data`, `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
47
53
  To add a custom directory to your theme-gem, please edit the regexp in `jekyll-theme-yat.gemspec` accordingly.
48
54
 
49
- ## License
55
+ ## Contributing
56
+
57
+ Issues and Pull Requests are greatly appreciated. If you've never contributed to an open source project before I'm more than happy to walk you through how to create a pull request.
50
58
 
51
- The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
59
+ You can start by [opening an issue](https://github.com/jeffreytse/jekyll-theme-yat/issues/new) describing the problem that you're looking to resolve and we'll go from there.
60
+
61
+ ## License
52
62
 
63
+ This theme is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php) © JeffreyTse.
@@ -13,10 +13,6 @@
13
13
  img: https://www.countryflags.io/cn/flat/64.png
14
14
  text: Chinese(Simple)
15
15
 
16
- - lang: zh-TW
17
- img: https://www.countryflags.io/tw/flat/64.png
18
- text: Chinese(Traditional)
19
-
20
16
  - lang: ja
21
17
  img: https://www.countryflags.io/jp/flat/64.png
22
18
  text: Japan
@@ -1,6 +1,6 @@
1
1
  <div id="gitment_thread"></div>
2
- <link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
3
- <script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
2
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/>
3
+ <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js"></script>
4
4
  <script>
5
5
  var gitment = new Gitment({
6
6
  id: '{{ page.id }}',
@@ -7,18 +7,21 @@
7
7
  return;
8
8
  }
9
9
 
10
- var header = document.querySelector('header');
10
+ var header = document.querySelector('header.site-header');
11
+ var headerRect = header.getBoundingClientRect();
12
+ var headerTop = Math.floor(headerRect.top);
13
+ var headerHeight = Math.floor(headerRect.height);
11
14
  var scrollPos = getScrollPos();
12
- var offsetY = element.offsetTop - (header.offsetTop + header.offsetHeight + 20);
15
+ var offsetY = element.offsetTop - (headerTop + headerHeight + 20);
13
16
 
14
- if (offsetY == scrollPos.y) {
17
+ if (offsetY == scrollPos.y) {
15
18
  return;
16
19
  }
17
20
 
18
- if (header.offsetTop == 0 && offsetY > scrollPos.y) {
19
- offsetY += header.offsetHeight;
20
- } else if (header.offsetTop < 0 && offsetY < scrollPos.y) {
21
- offsetY -= header.offsetHeight;
21
+ if (headerTop == 0 && offsetY > scrollPos.y) {
22
+ offsetY += headerHeight + 2;
23
+ } else if (headerTop < 0 && offsetY < scrollPos.y) {
24
+ offsetY -= headerHeight - 2;
22
25
  }
23
26
 
24
27
  smoothScrollTo(offsetY);
@@ -0,0 +1,41 @@
1
+ {% if include.article %}
2
+ {% assign article = include.article %}
3
+ {% endif %}
4
+
5
+ {% if include.speed %}
6
+ {% assign speed = include.speed %}
7
+ {% else %}
8
+ {% assign speed = 160 %}
9
+ {% endif %}
10
+
11
+ {% assign total_mins = article
12
+ | number_of_words
13
+ | divided_by: speed
14
+ | at_least: 1 %}
15
+
16
+ {% assign hours = total_mins | divided_by: 60 %}
17
+ {% assign mins = total_mins | modulo: 60 %}
18
+
19
+ {% assign return = "About" %}
20
+
21
+ {% if hours > 0 %}
22
+ {% assign unit = "hour" %}
23
+ {% if hours > 1 %}
24
+ {% assign unit = unit | append: "s" %}
25
+ {% endif %}
26
+ {% assign return = return
27
+ | append: " "
28
+ | append: hours
29
+ | append: " "
30
+ | append: unit %}
31
+ {% endif %}
32
+
33
+ {% assign unit = "min" %}
34
+ {% if mins > 1 %}
35
+ {% assign unit = unit | append: "s" %}
36
+ {% endif %}
37
+ {% assign return = return
38
+ | append: " "
39
+ | append: mins
40
+ | append: " "
41
+ | append: unit %}
@@ -6,10 +6,17 @@
6
6
  {%- seo -%}
7
7
  <link rel="shortcut icon" href="{{ site.favicon }}">
8
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
9
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-noto-sans@0.0.72/index.min.css">
10
+ <link rel="stylesheet"
11
+ href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css">
12
+ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script>
13
+ <!-- and it's easy to individually load additional languages -->
14
+ <script charset="UTF-8"
15
+ src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/languages/go.min.js"></script>
9
16
  <link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
10
17
  <script src="{{ "/assets/js/main.js" | relative_url }}"></script>
11
18
  {%- feed_meta -%}
12
19
  {%- if jekyll.environment == 'production' and site.google_analytics -%}
13
- {%- include extensions/google-analytics.html -%}
20
+ {%- include extensions/google-analytics.html -%}
14
21
  {%- endif -%}
15
22
  </head>
@@ -7,15 +7,21 @@
7
7
  </style>
8
8
 
9
9
  <div class="post-menu">
10
- <div class="post-menu-title">Contents</div>
10
+ <div class="post-menu-title">TOC</div>
11
11
  <div class="post-menu-content"></div>
12
12
  </div>
13
13
 
14
14
  <script>
15
15
  function generateContent() {
16
- var menu = document.querySelector(".post-menu .post-menu-content");
16
+ var menu = document.querySelector(".post-menu");
17
+ var menuContent = menu.querySelector(".post-menu-content");
17
18
  var headings = document.querySelector(".post-content").querySelectorAll("h2, h3, h4, h5, h6");
18
19
 
20
+ // Hide menu when no headings
21
+ if (headings.length === 0) {
22
+ return menu.style.display = "none";
23
+ }
24
+
19
25
  // Generate post menu
20
26
  var menuHTML = '';
21
27
  for (var i = 0; i < headings.length; i++) {
@@ -25,22 +31,26 @@
25
31
  + '<a href="#h-' + h.getAttribute('id') + '">' + h.textContent + '</a></li>');
26
32
  }
27
33
 
28
- menu.innerHTML = '<ul>' + menuHTML + '</ul>';
34
+ menuContent.innerHTML = '<ul>' + menuHTML + '</ul>';
29
35
 
30
36
  // The header element
31
37
  var header = document.querySelector('header.site-header');
32
38
 
33
39
  // Active the menu item
34
40
  window.addEventListener('scroll', function (event) {
35
- var lastActive = menu.querySelector('.active');
41
+ var lastActive = menuContent.querySelector('.active');
36
42
  var changed = true;
37
43
  for (var i = headings.length - 1; i >= 0; i--) {
38
44
  var h = headings[i];
39
- var clientRect = h.getBoundingClientRect();
40
- var headerHeight = header.offsetTop + header.offsetHeight + 20;
41
- if (clientRect.top <= headerHeight) {
45
+ var headingRect = h.getBoundingClientRect();
46
+ var headerRect = header.getBoundingClientRect();
47
+ var headerTop = Math.floor(headerRect.top);
48
+ var headerHeight = Math.floor(headerRect.height);
49
+ var headerHeight = headerTop + headerHeight + 20;
50
+ if (headingRect.top <= headerHeight) {
42
51
  var id = 'h-' + h.getAttribute('id');
43
- var curActive = menu.querySelector('a[href="#' + id + '"]');
52
+ var a = menuContent.querySelector('a[href="#' + id + '"]');
53
+ var curActive = a.parentNode;
44
54
  if (curActive) {
45
55
  curActive.classList.add('active');
46
56
  }
@@ -6,6 +6,4 @@
6
6
 
7
7
  </div>
8
8
 
9
- <div>
10
-
11
9
  </article>
@@ -19,20 +19,9 @@
19
19
  {% assign subheading = return %}
20
20
 
21
21
  {% if banner %}
22
-
23
- {% assign auto_banner = true %}
24
- {% assign array = banner | split: '/' %}
25
- {% assign protocol = array[0] %}
26
-
27
- {% if array.size > 1 and (protocol == '' or protocol == 'http:' or protocol == 'https:') %}
28
- {% assign auto_banner = false %}
29
- {% endif %}
30
-
31
22
  <section class="page-banner">
32
23
  <div class="page-banner-img">
33
- {%- if auto_banner == false -%}
34
- <div style="background-image: url({{ banner }})"></div>
35
- {%- endif -%}
24
+ <div style="background-image: url({{ banner }})"></div>
36
25
  </div>
37
26
  <div class="wrapper">
38
27
  <div class="page-banner-inner">
@@ -48,36 +37,14 @@
48
37
  <h1 class="page-banner-heading">
49
38
  {{ heading | default: page.title | escape }}
50
39
  </h1>
51
- <h3 class="page-banner-subheading">
40
+ <h2 class="page-banner-subheading">
52
41
  {{ subheading | default: page.subtitle | escape }}
53
- </h3>
42
+ </h2>
54
43
  </div>
55
44
 
56
45
  {%- endif -%}
57
46
  </div>
58
47
  </div>
59
48
  </section>
60
-
61
- {%- if auto_banner -%}
62
-
63
- {%- assign selector = ".page-banner-img" -%}
64
-
65
- {%- if banner == "default" -%}
66
-
67
- {%- assign heading = page.heading | default: page.title | escape -%}
68
- {%- assign subheading = page.subheading | default: page.subtitle | escape -%}
69
- {%- assign seed = page.date | append: heading | append: subheading -%}
70
-
71
- {%- else -%}
72
-
73
- {%- assign seed = 'theme-' | append: banner -%}
74
-
75
- {%- endif -%}
76
-
77
- {%- assign zoom = 1.5 -%}
78
- {%- include extensions/trianglify.html -%}
79
-
80
- {%- endif -%}
81
-
82
49
  {%- endif -%}
83
50
 
@@ -7,7 +7,7 @@
7
7
  {%- include functions.html func='log' level='debug' msg='Get header_transparent value' -%}
8
8
  {% assign name = 'header_transparent' %}
9
9
  {%- include functions.html func='get_value' -%}
10
- {% assign header_transparent = return %}
10
+ {% assign header_transparent = return | default: true %}
11
11
 
12
12
  {%- if banner and header_transparent -%}
13
13
  {%- assign header_transparent_class = "site-header-transparent" -%}
@@ -39,9 +39,7 @@
39
39
  {%- for path in page_paths -%}
40
40
  {%- assign my_page = site.pages | where: "path", path | first -%}
41
41
  {%- if my_page.title -%}
42
- <a class="page-link" href="{{ my_page.url | relative_url }}">
43
- {{ my_page.title | upcase | escape }}
44
- </a>
42
+ <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | upcase | escape }}</a>
45
43
  {%- endif -%}
46
44
  {%- endfor -%}
47
45
 
@@ -11,16 +11,29 @@
11
11
  {%- for post in paginator.posts -%}
12
12
  <li>
13
13
  {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
14
- <span class="post-meta">{{ post.date | date: date_format }}</span>
15
- <h3>
14
+
15
+ {% assign article = post.content %}
16
+ {%- include functions.html func='get_reading_time' -%}
17
+ {% assign reading_time = return %}
18
+
19
+ <h2 class="post-title">
16
20
  {%- assign post_url = post.url | relative_url -%}
17
21
  <a class="post-link" href="{{ post_url }}">
18
22
  {{ post.title | escape }}
19
23
  </a>
20
- </h3>
24
+ </h2>
25
+ <div class="post-meta">
26
+ <span class="post-date"><i class="fa fa-calendar"></i> {{ post.date | date: date_format }}</span>
27
+ <span class="post-reading-time left-vsplit"><i class="fa fa-clock-o"></i> {{ reading_time }}</span>
28
+ </div>
21
29
  <p class="post-excerpt">
22
30
  {{ post.content | strip_html | truncatewords: 50 }}
23
31
  </p>
32
+ <div class="post-tags">
33
+ {%- for tag in post.tags -%}
34
+ <a class="post-tag" href="/tags.html#{{tag}}">#{{tag}}</a>
35
+ {%- endfor -%}
36
+ </div>
24
37
  </li>
25
38
  {%- endfor -%}
26
39
  </ul>
@@ -3,19 +3,23 @@
3
3
  {% endif %}
4
4
 
5
5
  {% if paginator.posts.size > 0 %}
6
- <div class="pagination">
6
+ <div class="paginator">
7
+ <span class="previous">
7
8
  {% if paginator.previous_page %}
8
- <a href="{{ paginator.previous_page_path }}">&laquo; Prev</a>
9
+ <a href="{{ paginator.previous_page_path }}">Prev</a>
9
10
  {% else %}
10
- <span>&laquo; Prev</span>
11
+ <span>Prev</span>
11
12
  {% endif %}
13
+ </span>
12
14
 
13
- <span> {{ paginator.page }}/{{ paginator.total_pages }}</span>
15
+ <span class="indicator"> {{ paginator.page }}/{{ paginator.total_pages }}</span>
14
16
 
17
+ <span class="next">
15
18
  {% if paginator.next_page %}
16
- <a href="{{ paginator.next_page_path }}">Next &raquo;</a>
19
+ <a href="{{ paginator.next_page_path }}">Next</a>
17
20
  {% else %}
18
- <span>Next &raquo;</span>
21
+ <span>Next</span>
19
22
  {% endif %}
23
+ </span>
20
24
  </div>
21
25
  {% endif %}
@@ -1,11 +1,25 @@
1
1
  <header class="post-header">
2
2
  <h1 class="post-title p-name" itemprop="name headline">{{ heading | default: page.title | escape }}</h1>
3
- <h3>{{ subheading | default: page.subtitle | escape }}</h3>
3
+ <h3 class="post-subtitle">{{ subheading | default: page.subtitle | escape }}</h3>
4
4
 
5
5
  <p class="post-meta">
6
6
  <time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
7
7
  {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
8
- {{ page.date | date: date_format }}
8
+ <i class="fa fa-calendar"></i> {{ page.date | date: date_format }}
9
9
  </time>
10
+
11
+ {% assign article = page.content %}
12
+ {%- include functions.html func='get_reading_time' -%}
13
+ {% assign reading_time = return %}
14
+ <span class="post-reading-time left-vsplit"><i class="fa fa-clock-o"></i> {{ reading_time }}</span>
10
15
  </p>
16
+
17
+ {%- if page.tags.size > 0 -%}
18
+ <div class="post-tags">
19
+ {%- for tag in page.tags -%}
20
+ <a class="post-tag" href="/tags.html#{{tag}}">#{{tag}}</a>
21
+ {%- endfor -%}
22
+ </div>
23
+ {%- endif -%}
24
+
11
25
  </header>
@@ -11,4 +11,4 @@ sidebar: category-list
11
11
  {{ content }}
12
12
 
13
13
  {% include views/pagination.html %}
14
- <div>
14
+ </div>
@@ -1,53 +1,60 @@
1
1
  ---
2
2
  layout: framework
3
- banner: 'default'
3
+ banner:
4
4
  banner_html: post-header.html
5
5
  sidebar:
6
6
  - article-menu
7
7
  ---
8
8
 
9
9
  <div class="post">
10
- <section>
10
+ <section>
11
11
 
12
- {%- assign name = 'banner' -%}
13
- {%- include functions.html func='get_value' -%}
14
- {%- assign banner = return -%}
12
+ {%- assign name = 'banner' -%}
13
+ {%- include functions.html func='get_value' -%}
14
+ {%- assign banner = return -%}
15
15
 
16
- {%- if banner == nil -%}
17
- {%- include views/post-header.html -%}
18
- {%- endif -%}
16
+ {%- if banner == nil -%}
17
+ {%- include views/post-header.html -%}
18
+ {%- endif -%}
19
19
 
20
- {%- include views/article.html -%}
20
+ {%- include views/article.html -%}
21
21
 
22
- <div class="post-nav">
23
- {%- if page.previous -%}
24
- <a href="{{ page.previous.url }}" title="{{ page.previous.title | escape }}">&laquo; Prev</a>
25
- {%- else -%}
26
- <span></span>
27
- {%- endif -%}
22
+ <div class="post-nav">
23
+ {%- if page.previous -%}
24
+ <a class="previous" href="{{ page.previous.url }}" title="{{
25
+ page.previous.title | escape }}">{{ page.previous.title | escape | truncatewords: 6 }}</a>
26
+ {%- else -%}
27
+ <span></span>
28
+ {%- endif -%}
28
29
 
29
- {%- if page.next -%}
30
- <a href="{{ page.next.url }}" title="{{ page.next.title | escape }}">Next &raquo;</a>
31
- {%- else -%}
32
- <span></span>
33
- {%- endif -%}
34
- </div>
30
+ {%- if page.next -%}
31
+ <a class="next" href="{{ page.next.url }}" title="{{ page.next.title | escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a>
32
+ {%- else -%}
33
+ <span></span>
34
+ {%- endif -%}
35
+ </div>
35
36
 
36
- {%- if page.comments != false -%}
37
+ <div class="post-related">
38
+ <div>Related Articles</div>
39
+ <ul>
40
+ {% assign posts = site[page.collection] | sample:4 %}
41
+ {%- for post in posts -%}
42
+ <li><a class="post-link" href="{{post.url}}" title="{{ page.next.title | escape }}">{{ post.title | escape | truncatewords: 12 }}</a></li>
43
+ {%- endfor -%}
44
+ </ul>
45
+ </div>
37
46
 
38
- {%- if site.disqus.shortname -%}
39
- {%- include extensions/comments/disqus.html -%}
40
- {%- endif -%}
47
+ {%- if page.comments != false -%}
41
48
 
42
- {%- if site.gitment.username -%}
43
- {%- include extensions/comments/gitment.html -%}
44
- {%- endif -%}
49
+ {%- if site.disqus.shortname -%}
50
+ {%- include extensions/comments/disqus.html -%}
51
+ {%- endif -%}
45
52
 
46
- {%- endif -%}
53
+ {%- if site.gitment.username -%}
54
+ {%- include extensions/comments/gitment.html -%}
55
+ {%- endif -%}
47
56
 
48
- </section>
57
+ {%- endif -%}
49
58
 
50
- {%- include extensions/mathjax.html -%}
59
+ </section>
51
60
  </div>
52
-
53
-