jekyll-theme-satellite 1.1.0 → 1.2.4
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.
- checksums.yaml +4 -4
- data/README.md +24 -11
- data/_includes/footer.html +2 -3
- data/_includes/head.html +37 -8
- data/_includes/navigation.html +45 -30
- data/_includes/pagination.html +1 -1
- data/_includes/post.html +4 -4
- data/_includes/search_event.html +1 -175
- data/_includes/sidebar.html +6 -10
- data/_layouts/page.html +5 -6
- data/_sass/darkmode.scss +115 -122
- data/_sass/layout.scss +40 -40
- data/_sass/navigation.scss +133 -138
- data/_sass/pagination.scss +198 -211
- data/_sass/post.scss +553 -552
- data/_sass/search.scss +185 -204
- data/_sass/sidebar.scss +253 -254
- data/_sass/toc.scss +41 -41
- data/assets/css/404.scss +35 -35
- data/assets/css/highlight.min.css +2 -0
- data/assets/css/style.scss +22 -44
- data/assets/fonts/Lato-Regular.woff2 +0 -0
- data/assets/fonts/NunitoSans-Regular.woff2 +0 -0
- data/assets/fonts/Righteous-Regular.woff2 +0 -0
- data/assets/img/favicon.webp +0 -0
- data/assets/img/icon/house.webp +0 -0
- data/assets/img/loading.webp +0 -0
- data/assets/img/profile.webp +0 -0
- data/assets/js/background.js +1 -700
- data/assets/js/common.js +194 -21
- data/assets/js/post.js +171 -126
- data/assets/js/subject.js +1 -1
- metadata +58 -14
- data/assets/css/fonts.scss +0 -29
- data/assets/css/highlight-dark.min.css +0 -1
- data/assets/css/highlight-default.min.css +0 -1
- data/assets/fonts/Lato-Regular.ttf +0 -0
- data/assets/fonts/NunitoSans-Regular.ttf +0 -0
- data/assets/fonts/Righteous-Regular.ttf +0 -0
- data/assets/img/profile.jpg +0 -0
- data/assets/js/search.js +0 -168
- data/assets/js/sweet-scroll.min.js +0 -2
- data/assets/js/tocbot.min.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed3af2bd8fdbb4d034ce1a6197b31bb7fd849025bb9d67851817337484526e14
|
4
|
+
data.tar.gz: db045ddb62c8dcafb88def655fc99e0493e7f180f26bec2d1dc2e77e2d1ef382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f04d0d13a909e8d31a4b41d64706f0d517252b7d1ca6aa9e4a7ea44a9e54357d6681e767c0b64872211d6d6809f39c7e71871418f998513b446a9306997c6d08
|
7
|
+
data.tar.gz: 2eaf0439be549aa6518b901fc765a61a7c775dc9b52e1cbe00d9a95e11e755a6db1eff31c55436c33c89ce7d2f21ca3de8558ea6c05d8dfb43b34322fc7d2760
|
data/README.md
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
[](gem)
|
5
5
|
|
6
6
|
# Satellite🛰️ - Jekyll blog theme
|
7
|
-
An emotional and adorable blog theme powered by ***Jekyll***.
|
7
|
+
An emotional and adorable blog theme powered by ***Jekyll***.
|
8
|
+
|
9
|
+
Live demo is available [here](https://byanko55.github.io)
|
8
10
|
|
9
11
|

|
10
12
|
|
@@ -20,6 +22,8 @@ An emotional and adorable blog theme powered by ***Jekyll***. Live demo is avail
|
|
20
22
|
<img src="https://i.ibb.co/WvyBzkL/Animation.gif" height="400px" align="center"/>
|
21
23
|
</p>
|
22
24
|
|
25
|
+
<br></br>
|
26
|
+
|
23
27
|
## Features
|
24
28
|
|
25
29
|
* Comment System using *giscus*
|
@@ -35,23 +39,27 @@ An emotional and adorable blog theme powered by ***Jekyll***. Live demo is avail
|
|
35
39
|
* Table of Contents
|
36
40
|
* Visitor Counter (*goatcounter*)
|
37
41
|
|
42
|
+
<br></br>
|
43
|
+
|
38
44
|
## Installation
|
39
45
|
|
40
|
-
There are two
|
46
|
+
There are two ways to setup this theme:
|
47
|
+
<br></br>
|
41
48
|
|
42
49
|
### Method 1: Build from source (Recommended)
|
43
|
-
Fork this repository or download the [source](https://github.com/byanko55/jekyll-theme-satellite/releases) as a zip.
|
44
|
-
|
45
|
-
If you use as destination a repository named USERNAME.github.io then your url will be https://USERNAME.github.io/.
|
50
|
+
Fork [this repository](https://github.com/byanko55/jekyll-theme-satellite) or download the [source](https://github.com/byanko55/jekyll-theme-satellite/releases) as a zip.
|
46
51
|
|
52
|
+
If you use as destination a repository named USERNAME.github.io, then your url will be https://USERNAME.github.io/.
|
53
|
+
<br></br>
|
47
54
|
|
48
55
|
### Method 2: Utilize Gem package
|
49
|
-
Create a clean site directory (Follow the **Instruction 1~4** described
|
56
|
+
Create a clean site directory (Follow the **Instruction 1~4** described [here](https://jekyllrb.com/docs/)).
|
50
57
|
|
51
58
|
The following materials are redundant, so remove them.
|
52
59
|
* index.markdown
|
53
60
|
* about.markdown
|
54
61
|
* 404.html
|
62
|
+
<br></br>
|
55
63
|
|
56
64
|
Then, add this line to your Jekyll site's `Gemfile`:
|
57
65
|
|
@@ -59,7 +67,8 @@ Then, add this line to your Jekyll site's `Gemfile`:
|
|
59
67
|
gem "jekyll-theme-satellite"
|
60
68
|
```
|
61
69
|
|
62
|
-
You need to replace the initial `_config.yml` file with the [prepared one](https://github.com/byanko55/jekyll-theme-satellite/docs/_config.yml).
|
70
|
+
You need to replace the initial `_config.yml` file with the [prepared one](https://github.com/byanko55/jekyll-theme-satellite/blob/master/docs/_config.yml).
|
71
|
+
<br></br>
|
63
72
|
|
64
73
|
### Modify your site setting
|
65
74
|
|
@@ -79,6 +88,7 @@ instagram_username: instagram
|
|
79
88
|
linkedin_username: linkedin
|
80
89
|
facebook_username: facebook
|
81
90
|
```
|
91
|
+
<br></br>
|
82
92
|
|
83
93
|
### Run site locally
|
84
94
|
|
@@ -87,6 +97,7 @@ From the site root directory, install the dependencies:
|
|
87
97
|
```
|
88
98
|
bundle install
|
89
99
|
```
|
100
|
+
<br></br>
|
90
101
|
|
91
102
|
Start a Jekyll service.
|
92
103
|
|
@@ -95,6 +106,7 @@ bundle exec jekyll serve
|
|
95
106
|
```
|
96
107
|
|
97
108
|
Now open [http://localhost:4000](http://localhost:4000) in your browser.
|
109
|
+
<br></br>
|
98
110
|
|
99
111
|
## Customizing
|
100
112
|
|
@@ -102,12 +114,13 @@ You can find useful manuals for customizing your site from the below table:
|
|
102
114
|
|
103
115
|
|||
|
104
116
|
|---|---|
|
105
|
-
|Posting guidelines|[link](https://github.com/byanko55/jekyll-theme-satellite/docs/Posting%
|
106
|
-
|Enabling ***comment system***|[link](https://github.com/byanko55/jekyll-theme-satellite/docs/Comment%
|
107
|
-
|Enabling ***Visitor counter***|[link](https://github.com/byanko55/jekyll-theme-satellite/docs/Visitor%
|
117
|
+
|Posting guidelines|[link](https://github.com/byanko55/jekyll-theme-satellite/blob/master/docs/Posting%20Guide.md)|
|
118
|
+
|Enabling ***comment system***|[link](https://github.com/byanko55/jekyll-theme-satellite/blob/master/docs/Comment%20System.md)|
|
119
|
+
|Enabling ***Visitor counter***|[link](https://github.com/byanko55/jekyll-theme-satellite/blob/master/docs/Visitor%20Counter.md)|
|
108
120
|
|
109
121
|
## Contribution
|
110
|
-
If you would like to report a bug
|
122
|
+
If you would like to report a bug or request a new feature, please open [an issue](https://github.com/byanko55/jekyll-theme-satellite/issues) We are open to any kind of feedback or collaboration.
|
123
|
+
<br></br>
|
111
124
|
|
112
125
|
## License
|
113
126
|
© 2024 *Yankos*. This theme is available as open source under the terms of the [MIT License](https://opensource.org/license/mit/).
|
data/_includes/footer.html
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
<script src="
|
2
|
-
<script src="{{
|
3
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
1
|
+
<script defer src="{{ '/assets/js/background.js' }}"></script>
|
2
|
+
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
4
3
|
<script>
|
5
4
|
window.dataLayer = window.dataLayer || [];
|
6
5
|
function gtag(){ dataLayer.push(arguments); }
|
data/_includes/head.html
CHANGED
@@ -1,11 +1,46 @@
|
|
1
1
|
<meta charset="utf-8">
|
2
2
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
4
|
+
<title>
|
5
|
+
{% if page.url == "/index.html" %}
|
6
|
+
Home
|
7
|
+
{% elsif page_type == "category" %}
|
8
|
+
{{ category_title }}
|
9
|
+
{% else %}
|
10
|
+
{{ page.title }}
|
11
|
+
{% endif %}
|
12
|
+
</title>
|
4
13
|
{% seo %}
|
5
14
|
|
6
15
|
<link rel="shortcut icon" type="image/png" href="{{ site.logo_img }}">
|
7
|
-
<
|
8
|
-
|
16
|
+
<style>
|
17
|
+
@font-face {
|
18
|
+
font-family: 'Nunito Sans';
|
19
|
+
font-style: normal;
|
20
|
+
font-weight: 400;
|
21
|
+
font-display: optional;
|
22
|
+
src: local('Nunito Sans'),
|
23
|
+
url(/assets/fonts/NunitoSans-Regular.woff2) format("woff2");
|
24
|
+
}
|
25
|
+
|
26
|
+
@font-face {
|
27
|
+
font-family: 'Righteous';
|
28
|
+
font-style: normal;
|
29
|
+
font-weight: 600;
|
30
|
+
font-display: optional;
|
31
|
+
src: local('Righteous'),
|
32
|
+
url(/assets/fonts/Righteous-Regular.woff2) format("woff2");
|
33
|
+
}
|
34
|
+
|
35
|
+
@font-face {
|
36
|
+
font-family: 'Lato';
|
37
|
+
font-style: normal;
|
38
|
+
font-weight: 400;
|
39
|
+
font-display: optional;
|
40
|
+
src: local('Lato'),
|
41
|
+
url(/assets/fonts/Lato-Regular.woff2) format("woff2");
|
42
|
+
}
|
43
|
+
</style>
|
9
44
|
|
10
45
|
<script src="{{ '/assets/js/fontfaceobserver.js' }}" type="text/javascript"></script>
|
11
46
|
<script type="text/javascript">
|
@@ -22,12 +57,6 @@
|
|
22
57
|
});
|
23
58
|
</script>
|
24
59
|
|
25
|
-
<title>
|
26
|
-
{% if page.title %}{{ page.title }}
|
27
|
-
{% else %}{{ site.title }}
|
28
|
-
{% endif %}
|
29
|
-
</title>
|
30
|
-
|
31
60
|
<meta
|
32
61
|
name="description"
|
33
62
|
content="{% if page.description %}{{ page.description | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
|
data/_includes/navigation.html
CHANGED
@@ -1,41 +1,55 @@
|
|
1
1
|
<nav id="navigation">
|
2
|
-
{%- assign nav_pages = site.pages
|
3
|
-
| where_exp: "item", "item.title != nil"
|
4
|
-
| where_exp: "item", "item.bookmark == true"
|
5
|
-
| sort: 'title' -%}
|
6
|
-
|
7
2
|
{% assign first_level_pages = "" | split, "" %}
|
8
3
|
{% assign second_level_pages = "" | split, "" %}
|
9
4
|
{% assign third_level_pages = "" | split, "" %}
|
10
5
|
|
11
|
-
{% for p in
|
6
|
+
{% for p in site.pages %}
|
12
7
|
{%- assign p_tree = p.url | remove_first: "/" | split: "/" -%}
|
8
|
+
{%- assign p_name = p_tree | last -%}
|
13
9
|
{%- assign p_level = p_tree | size -%}
|
14
10
|
|
15
|
-
{% if
|
16
|
-
{%
|
17
|
-
{%
|
18
|
-
|
19
|
-
{%
|
20
|
-
{%
|
11
|
+
{% if p.bookmark == nil and p_name != 'index.html' %}
|
12
|
+
{% continue %}
|
13
|
+
{% endif %}
|
14
|
+
|
15
|
+
{% if p.bookmark %}
|
16
|
+
{% if p_level == 1 %}
|
17
|
+
{% assign first_level_pages = first_level_pages | push:p %}
|
18
|
+
{% elsif p_level == 2 %}
|
19
|
+
{% assign second_level_pages = second_level_pages | push:p %}
|
20
|
+
{% elsif p_level == 3 %}
|
21
|
+
{% assign third_level_pages = third_level_pages | push:p %}
|
22
|
+
{% endif %}
|
23
|
+
{% else %}
|
24
|
+
{% if p_level <= 2 %}
|
25
|
+
{% assign first_level_pages = first_level_pages | push:p %}
|
26
|
+
{% elsif p_level == 3 %}
|
27
|
+
{% assign second_level_pages = second_level_pages | push:p %}
|
28
|
+
{% elsif p_level == 4 %}
|
29
|
+
{% assign third_level_pages = third_level_pages | push:p %}
|
30
|
+
{% endif %}
|
21
31
|
{% endif %}
|
22
32
|
{% endfor %}
|
23
33
|
|
34
|
+
{% assign first_level_pages = first_level_pages | sort: 'url' %}
|
35
|
+
{% assign second_level_pages = second_level_pages | sort: 'url' %}
|
36
|
+
{% assign third_level_pages = third_level_pages | sort: 'url' %}
|
37
|
+
|
24
38
|
<ul class="nav-list">
|
25
39
|
{%- for node in first_level_pages -%}
|
26
40
|
{%- assign node_url = node.url | remove: 'index.html' -%}
|
41
|
+
{%- assign node_title = node.path | remove: 'index.md' | split: "/" | last | remove: '.md' | replace: "_pages", "Home" -%}
|
27
42
|
{%- assign children_list = second_level_pages
|
28
|
-
| where_exp: "item", "item.url contains node_url"
|
29
|
-
| sort: 'title' -%}
|
43
|
+
| where_exp: "item", "item.url contains node_url" -%}
|
30
44
|
{%- assign num_children = children_list | size -%}
|
31
|
-
<li id="nav-first" aria-label="{{
|
45
|
+
<li id="nav-first" aria-label="{{ node_title }}">
|
32
46
|
<div class="nav-item">
|
33
47
|
<a href="{{ node_url }}" class="nav-list-link nav-lh">
|
34
48
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8 320h95.1l21.3-128H187.1z"/></svg>
|
35
|
-
<span>{{
|
49
|
+
<span>{{ node_title }}</span>
|
36
50
|
</a>
|
37
51
|
{%- if num_children > 0 and node_url != "/" -%}
|
38
|
-
<button class="nav-list-expander" aria-label="toggle items in {{
|
52
|
+
<button class="nav-list-expander" aria-label="toggle items in {{ node_title }} category" aria-pressed="false">
|
39
53
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M201.4 342.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 274.7 86.6 137.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"/></svg>
|
40
54
|
</button>
|
41
55
|
{%- endif -%}
|
@@ -44,18 +58,18 @@
|
|
44
58
|
<ul class="nav-list">
|
45
59
|
{%- for child in children_list -%}
|
46
60
|
{%- assign child_url = child.url | remove: 'index.html' -%}
|
61
|
+
{%- assign child_title = child.path | remove: 'index.md' | split: "/" | last | remove: '.md' -%}
|
47
62
|
{%- assign grand_children_list = third_level_pages
|
48
|
-
| where_exp: "item", "item.url contains child_url"
|
49
|
-
| sort: 'title' -%}
|
63
|
+
| where_exp: "item", "item.url contains child_url" -%}
|
50
64
|
{%- assign num_grand_children = grand_children_list | size -%}
|
51
|
-
<li id="nav-second" aria-label="{{
|
65
|
+
<li id="nav-second" aria-label="{{ child_title }}">
|
52
66
|
<div class="nav-item">
|
53
67
|
<a href="{{ child_url }}" class="nav-list-link nav-sh">
|
54
68
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"/></svg>
|
55
|
-
<span>{{
|
69
|
+
<span>{{ child_title }}</span>
|
56
70
|
</a>
|
57
71
|
{%- if num_grand_children > 0 -%}
|
58
|
-
<button class="nav-list-expander" aria-label="toggle items in {{
|
72
|
+
<button class="nav-list-expander" aria-label="toggle items in {{ child_title }} category" aria-pressed="false">
|
59
73
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M201.4 342.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 274.7 86.6 137.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"/></svg>
|
60
74
|
</button>
|
61
75
|
{%- endif -%}
|
@@ -63,14 +77,15 @@
|
|
63
77
|
{%- if num_grand_children > 0 -%}
|
64
78
|
<ul class="nav-list">
|
65
79
|
{%- for grand_child in grand_children_list -%}
|
66
|
-
|
67
|
-
<
|
68
|
-
<
|
69
|
-
<
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
80
|
+
{%- assign grand_child_title = grand_child.path | remove: 'index.md' | split: "/" | last | remove: '.md' -%}
|
81
|
+
<li id="nav-third" aria-label="{{ grand_child_title }}">
|
82
|
+
<div class="nav-item">
|
83
|
+
<a href="{{ grand_child.url | relative_url }}" class="nav-list-link nav-sh">
|
84
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"/></svg>
|
85
|
+
<span>{{ grand_child_title }}</span>
|
86
|
+
</a>
|
87
|
+
</div>
|
88
|
+
</li>
|
74
89
|
{%- endfor -%}
|
75
90
|
</ul>
|
76
91
|
{%- endif -%}
|
data/_includes/pagination.html
CHANGED
data/_includes/post.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<span id="page-hits" usercode="{{ site.goatcounter_code }}">-</span>
|
34
34
|
</span>
|
35
35
|
{% endif %}
|
36
|
-
<a class="info-box"
|
36
|
+
<a class="info-box" id="comments-counter">
|
37
37
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>
|
38
38
|
<span id="num-comments">-</span>
|
39
39
|
</a>
|
@@ -41,9 +41,9 @@
|
|
41
41
|
</div>
|
42
42
|
</div>
|
43
43
|
</div>
|
44
|
-
<div class="
|
44
|
+
<div class="tag-box">
|
45
45
|
{%- for page_tag in page.tags -%}
|
46
|
-
<span class="tag
|
46
|
+
<span class="tag theme-{{ forloop.index0 | modulo: 3 }}" contentID="{{ page_tag }}">
|
47
47
|
{{ page_tag }}
|
48
48
|
</span>
|
49
49
|
{%- endfor -%}
|
@@ -61,5 +61,5 @@
|
|
61
61
|
</div>
|
62
62
|
</main>
|
63
63
|
<div class="top-arrow">
|
64
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"
|
64
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>
|
65
65
|
</div>
|
data/_includes/search_event.html
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
{%- assign page_list = site.pages
|
2
2
|
| where_exp: "item", "item.title != nil"
|
3
3
|
-%}
|
4
|
-
<script
|
5
|
-
<script>
|
4
|
+
<script defer>
|
6
5
|
var posts = [];
|
7
6
|
|
8
7
|
{% for page in page_list %}
|
@@ -41,177 +40,4 @@
|
|
41
40
|
{% if page_type == "post" %}
|
42
41
|
searchRelated(posts);
|
43
42
|
{% endif %}
|
44
|
-
|
45
|
-
/*
|
46
|
-
$('#search-input').on('keyup', function () {
|
47
|
-
var keyword = this.value.toLowerCase();
|
48
|
-
var searchResult = [];
|
49
|
-
|
50
|
-
if (keyword.length > 0) {
|
51
|
-
$('#search-result').show();
|
52
|
-
$('#btn-clear').show();
|
53
|
-
} else {
|
54
|
-
$('#search-result').hide();
|
55
|
-
$('#btn-clear').hide();
|
56
|
-
}
|
57
|
-
|
58
|
-
$('.result-item').remove();
|
59
|
-
|
60
|
-
for (var i = 0; i < posts.length; i++) {
|
61
|
-
var post = posts[i];
|
62
|
-
|
63
|
-
if (post.title === 'Home' && post.type == 'category') continue;
|
64
|
-
|
65
|
-
if (post.title.toLowerCase().indexOf(keyword) >= 0
|
66
|
-
|| post.path.toLowerCase().indexOf(keyword) >= 0
|
67
|
-
|| post.tags.toLowerCase().indexOf(keyword) >= 0){
|
68
|
-
searchResult.push(post);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
if (searchResult.length === 0) {
|
73
|
-
$('#search-result').append(
|
74
|
-
'<li class="result-item"><span class="description">There is no search result.</span></li>'
|
75
|
-
);
|
76
|
-
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
|
80
|
-
searchResult.sort(function (a, b) {
|
81
|
-
if (a.type == 'category') return 1;
|
82
|
-
|
83
|
-
return -1;
|
84
|
-
});
|
85
|
-
|
86
|
-
for (var i = 0; i < searchResult.length; i++) {
|
87
|
-
var highlighted_path = highlightKeyword(searchResult[i].path, keyword);
|
88
|
-
|
89
|
-
if (highlighted_path === '')
|
90
|
-
highlighted_path = "Home";
|
91
|
-
|
92
|
-
if (searchResult[i].type === 'post'){
|
93
|
-
var highlighted_title = highlightKeyword(searchResult[i].title, keyword);
|
94
|
-
var highlighted_tags = highlightKeyword(searchResult[i].tags, keyword);
|
95
|
-
|
96
|
-
if (highlighted_tags === '')
|
97
|
-
highlighted_tags = "none";
|
98
|
-
|
99
|
-
$('#search-result').append(
|
100
|
-
'<li class="result-item"><a href="' +
|
101
|
-
searchResult[i].url +
|
102
|
-
'"><table><thead><tr><th><svg class="ico-book"></svg></th><th>' + highlighted_title +
|
103
|
-
'</th></tr></thead><tbody><tr><td><svg class="ico-folder"></svg></td><td>' + highlighted_path +
|
104
|
-
'</td></tr><tr><td><svg class="ico-tags"></svg></td><td>' + highlighted_tags +
|
105
|
-
'</td></tr><tr><td><svg class="ico-calendar"></svg></td><td>' + searchResult[i].date +
|
106
|
-
'</td></tr></tbody></table></a></li>'
|
107
|
-
);
|
108
|
-
}
|
109
|
-
else {
|
110
|
-
$('#search-result').append(
|
111
|
-
'<li class="result-item"><a href="' +
|
112
|
-
searchResult[i].url +
|
113
|
-
'"><table><thead><tr><th><svg class="ico-folder"></svg></th><th>' + highlighted_path +
|
114
|
-
'</th></tr></thead></table></a></li>'
|
115
|
-
);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
});
|
119
|
-
|
120
|
-
function highlightKeyword(txt, keyword) {
|
121
|
-
var index = txt.toLowerCase().lastIndexOf(keyword);
|
122
|
-
|
123
|
-
if (index >= 0) {
|
124
|
-
out = txt.substring(0, index) +
|
125
|
-
"<span class='highlight'>" +
|
126
|
-
txt.substring(index, index+keyword.length) +
|
127
|
-
"</span>" +
|
128
|
-
txt.substring(index + keyword.length);
|
129
|
-
return out;
|
130
|
-
}
|
131
|
-
|
132
|
-
return txt;
|
133
|
-
}
|
134
|
-
|
135
|
-
{% if page_type == "post" %}
|
136
|
-
displayRelatedPosts(posts);
|
137
|
-
{% endif %}
|
138
|
-
|
139
|
-
function displayRelatedPosts(pages){
|
140
|
-
const refBox = document.getElementById('related-box');
|
141
|
-
|
142
|
-
if (!refBox) return;
|
143
|
-
|
144
|
-
var relatedPosts = [];
|
145
|
-
var currPost = pages.find(obj => {return obj.url === location.pathname});
|
146
|
-
|
147
|
-
let currTags = currPost.tags.split(', ');
|
148
|
-
let currCategory = currPost.path.split(' > ').pop();
|
149
|
-
|
150
|
-
for (var i = 0; i < pages.length; i++) {
|
151
|
-
let page = pages[i];
|
152
|
-
|
153
|
-
if (page.type === 'category') continue;
|
154
|
-
|
155
|
-
if (page.title === currPost.title) continue;
|
156
|
-
|
157
|
-
let tags = page.tags.split(', ');
|
158
|
-
let category = page.path.split(' > ').pop();
|
159
|
-
let correlationScore = 0;
|
160
|
-
|
161
|
-
for (var j = 0; j < currTags.length; j++){
|
162
|
-
if (tags.indexOf(currTags[j]) != -1) correlationScore += 1;
|
163
|
-
}
|
164
|
-
|
165
|
-
if (category === currCategory) correlationScore += 1;
|
166
|
-
|
167
|
-
if (correlationScore == 0) continue;
|
168
|
-
|
169
|
-
relatedPosts.push({
|
170
|
-
'title': page.title,
|
171
|
-
'date': page.date,
|
172
|
-
'category': category,
|
173
|
-
'url': page.url,
|
174
|
-
'thumbnail': page.image,
|
175
|
-
'score': correlationScore
|
176
|
-
});
|
177
|
-
}
|
178
|
-
|
179
|
-
relatedPosts.sort(function (a, b) {
|
180
|
-
if(a.hasOwnProperty('score')){
|
181
|
-
return b.score - a.score;
|
182
|
-
}
|
183
|
-
});
|
184
|
-
|
185
|
-
if (relatedPosts.length == 0){
|
186
|
-
$('#related-box').hide();
|
187
|
-
return;
|
188
|
-
}
|
189
|
-
|
190
|
-
for (var i = 0; i < Math.min(relatedPosts.length, 6); i++){
|
191
|
-
let post = relatedPosts[i];
|
192
|
-
let date = '-';
|
193
|
-
let category = 'No category';
|
194
|
-
|
195
|
-
if (post.date !== '1900-01-01'){
|
196
|
-
date = new Date(post.date);
|
197
|
-
date = date.toLocaleString('en-US', {day: 'numeric', month:'long', year:'numeric'});
|
198
|
-
}
|
199
|
-
|
200
|
-
if (post.category !== '') category = post.category;
|
201
|
-
|
202
|
-
if (post.thumbnail === ''){
|
203
|
-
post.thumbnail = "/assets/img/thumbnail/empty.jpg";
|
204
|
-
}
|
205
|
-
|
206
|
-
$('#related-posts').append(
|
207
|
-
'<li class="related-item"><a href="' + post.url +
|
208
|
-
'"><img src="' + post.thumbnail +
|
209
|
-
'"/><p class="category">' + category +
|
210
|
-
'</p><p class="title">' + post.title +
|
211
|
-
'</p><p class="date">' + date +
|
212
|
-
'</p></a></li>'
|
213
|
-
);
|
214
|
-
}
|
215
|
-
}
|
216
|
-
*/
|
217
43
|
</script>
|
data/_includes/sidebar.html
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
{%- assign page_tree = page.path | remove_first: "_pages/" | split: "/" -%}
|
2
|
-
{%- assign page_level = page_tree.size -%}
|
3
|
-
{% if page_tree.last == "index.md" %}
|
4
|
-
{%- assign page_type = "category" -%}
|
5
|
-
{% else %}
|
6
|
-
{%- assign page_type = "post" -%}
|
7
|
-
{% endif %}
|
8
1
|
<div class="sidebar sidebar-left">
|
9
2
|
<div class="side-banner">
|
10
|
-
<h1 class="site-
|
11
|
-
<a href="/"
|
3
|
+
<h1 class="site-tab">
|
4
|
+
<a href="/" class="site-name">
|
5
|
+
<img src="{{ '/assets/img/icon/house.webp' }}" alt="">
|
6
|
+
<mark>example.com</mark>
|
7
|
+
</a>
|
12
8
|
<button id="btn-brightness" aria-label="brightness-button">
|
13
9
|
<svg class='ico-dark' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"/></svg>
|
14
10
|
<svg class='ico-light' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM160 256a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zm224 0a128 128 0 1 0 -256 0 128 128 0 1 0 256 0z"/></svg>
|
@@ -21,7 +17,7 @@
|
|
21
17
|
</button>
|
22
18
|
</h1>
|
23
19
|
<a href="/" class="site-avatar" aria-label="site-avatar">
|
24
|
-
<img src="{{
|
20
|
+
<img src="{{ site.profile_img }}" loading="lazy" alt="homepage" aria-label="homepage-button">
|
25
21
|
</a>
|
26
22
|
</div>
|
27
23
|
<div class="side-info">
|
data/_layouts/page.html
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
{%- assign page_level = page_tree.size -%}
|
5
5
|
{% if page_tree.last == "index.md" %}
|
6
6
|
{%- assign page_type = "category" -%}
|
7
|
+
{%- assign category_title = page.path | remove: 'index.md' | split: "/" | last -%}
|
7
8
|
{% else %}
|
8
9
|
{%- assign page_type = "post" -%}
|
9
10
|
{% endif %}
|
@@ -74,13 +75,11 @@
|
|
74
75
|
{% if page_type == "category" %}
|
75
76
|
<script src="{{ '/assets/js/subject.js' }}"></script>
|
76
77
|
{% else %}
|
77
|
-
<script src="{{ '/assets/js/tocbot.min.js' }}"></script>
|
78
|
-
<script src="{{ '/assets/js/sweet-scroll.min.js' }}"></script>
|
79
|
-
<script src="{{ '/assets/js/highlight.min.js' }}"></script>
|
80
|
-
<link id="highlight-default" rel="stylesheet" href="{{ '/assets/css/highlight-default.min.css' }}">
|
81
|
-
<link id="highlight-dark" rel="stylesheet" href="{{ '/assets/css/highlight-dark.min.css' }}">
|
82
78
|
<script src="{{ '/assets/js/post.js' }}"></script>
|
79
|
+
<link rel="preload" href="{{ '/assets/css/highlight.min.css' }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
80
|
+
<noscript><link rel="stylesheet" href="{{ '/assets/css/highlight.min.css' }}"></noscript>
|
81
|
+
<script defer src="{{ '/assets/js/highlight.min.js' }}"></script>
|
83
82
|
{% endif %}
|
84
|
-
{% include search_event.html %}
|
85
83
|
<script src="{{ '/assets/js/common.js' }}"></script>
|
84
|
+
{% include search_event.html %}
|
86
85
|
</html>
|