pole 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 592df8fdb3c7dae642995e3160447f15cc8335cd73b510178736d752a36e551a
4
+ data.tar.gz: 3abb02d0764259dbb4b4e2267efe8faabb1b13f3dd8ca302af4cebd06fec8e38
5
+ SHA512:
6
+ metadata.gz: 7236baae3fb0bcd992a1be5d12382af1182dc9efb96660dbf1501f7aeb7bc0a3b75ee6b090a857327453e088f1a96f96ed2b9c9570d22a53608688c8dddec0e5
7
+ data.tar.gz: b76c45f6bd484eb5f9f7e28c824ad70423468643a5d22aee94753881dffc653e23b8c46fd36ae1a2f05bbca90293cc9b5f8c9b1f587c5b50ffac91b9e217fbaa
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 szivong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,190 @@
1
+ # Pole <!-- omit in toc -->
2
+
3
+ Pole is *a one-column minimal responsive Jekyll blog theme*.
4
+
5
+ One of the purposes of Pole is to be an alternative option to the default theme of Jekyll -- [Minima](https://github.com/jekyll/minima). Pole is still keeping minimal, but meanwhile, more beautiful and mellow, and doesn't lose some useful basic features, such as archive.
6
+
7
+ Check the *[live demo](https://szivong.io/pole/)*.
8
+
9
+ ![Screenshot Light](screenshot-light.png)
10
+ ![Screenshot Dark](screenshot-dark.png)
11
+
12
+ ## Highlight Features <!-- omit in toc -->
13
+
14
+ - [Normalize.css](https://github.com/necolas/normalize.css)
15
+ - [Open Color](https://github.com/yeun/open-color)
16
+ - [Font Awesome](https://fontawesome.com/)
17
+ - [Disqus](https://disqus.com/)
18
+ - [MathJax](https://www.mathjax.org/)
19
+ - [Google Analytics 4](https://support.google.com/analytics/answer/10089681?hl=en)
20
+ - [Jekyll Feed](https://github.com/jekyll/jekyll-feed/)
21
+ - [Jekyll Paginate](https://github.com/jekyll/jekyll-paginate)
22
+ - [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag/)
23
+ - Related posts (time-based, because Jekyll) below each post
24
+ - Dark mode, via [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
25
+ - Archive implemented by pure [Liquid](https://shopify.github.io/liquid/)
26
+
27
+ ## Table of Contents <!-- omit in toc -->
28
+
29
+ - [Installation](#installation)
30
+ - [Usage](#usage)
31
+ - [Global Configuration](#global-configuration)
32
+ - [Post Configuration](#post-configuration)
33
+ - [Homepage](#homepage)
34
+ - [Custom Head](#custom-head)
35
+ - [Navigation](#navigation)
36
+ - [Social Links](#social-links)
37
+ - [Alert Messages](#alert-messages)
38
+ - [Google Analytics 4](#google-analytics-4)
39
+ - [Archive](#archive)
40
+ - [Contributing](#contributing)
41
+ - [Development](#development)
42
+ - [License](#license)
43
+
44
+ ## Installation
45
+
46
+ Add this line to your Jekyll site's `Gemfile`:
47
+
48
+ ```ruby
49
+ gem "pole"
50
+ ```
51
+
52
+ And add this line to your Jekyll site's `_config.yml`:
53
+
54
+ ```yaml
55
+ theme: pole
56
+ ```
57
+
58
+ And then execute:
59
+
60
+ ```shell
61
+ bundle
62
+ ```
63
+
64
+ Or install it yourself as:
65
+
66
+ ```shell
67
+ gem install pole
68
+ ```
69
+
70
+ You can also install the latest code via [`jekyll-remote-theme`](https://github.com/benbalter/jekyll-remote-theme):
71
+
72
+ 1. Add this line to your Jekyll site's `Gemfile`:
73
+
74
+ ```ruby
75
+ gem "jekyll-remote-theme"
76
+ ```
77
+
78
+ 2. Add these lines to your Jekyll site's `_config.yml`:
79
+
80
+ ```ruby
81
+ plugins:
82
+ - jekyll-remote-theme
83
+
84
+ remote_theme: szivong/pole@main
85
+ ```
86
+
87
+ ## Usage
88
+
89
+ ### Global Configuration
90
+
91
+ | Variable | Type | Default | Specification |
92
+ | -------- | ---- | ------- | ------------- |
93
+ | `title` | String | --- | The title of the website |
94
+ | `tagline` | String | --- | The tagline of the website |
95
+ | `lang` | String | `en` | The language of pages; The value can be overwritten by the `lang` variable on each page |
96
+ | `author.name` | String | --- | The name of the website author |
97
+ | `author.url` | String | --- | A URL of the website author |
98
+ | `tags_path` | String | --- | A path to the archive-by-tags page; It is used by tags on each post |
99
+ | `categories_path` | String | --- | A path to the archive-by-categories page; It is used by categories on each post |
100
+ | `disqus` | String | --- | Disqus short name |
101
+ | `google_analytics` | String | --- | Google Analytics 4 Measurement ID |
102
+
103
+ ### Post Configuration
104
+
105
+ | Variable | Type | Default | Specification |
106
+ | -------- | ---- | ------- | ------------- |
107
+ | `description` | String | --- | A description of the current post |
108
+ | `last_modified_at` | String | --- | The date of the last modification you made on a post after its publishing |
109
+ | `author` | String or Array | --- | The author name(s) of the post |
110
+ | `comments` | Boolean | `true` | Does enable the Disqus comment system |
111
+ | `math` | Boolean | `false` | Does enable MathJax on this page |
112
+
113
+ ### Homepage
114
+
115
+ You can create a homepage for your blog by setting `layout: home` in your `index.html`.
116
+
117
+ ### Custom Head
118
+
119
+ Pole leaves a placeholder to allow defining custom head. All you need to do is putting data into `_includes/custom-head.html`, and they would be automatically included in `<head>`.
120
+
121
+ ### Navigation
122
+
123
+ The navigation bar of Pole is configurable. You just need to specify titles and URLs in the file `_data/navigation.yml`, for example,
124
+
125
+ ```yml
126
+ - title: About
127
+ url: /about/
128
+ - title: Archive
129
+ url: /archive/
130
+ - title: Categories
131
+ url: /categories/
132
+ ```
133
+
134
+ ### Social Links
135
+
136
+ Pole allows you to show social links on the website. All you need to do is creating a file `_data/social.yml`, for example,
137
+
138
+ ```yml
139
+ - title: Email
140
+ url: mailto:szivong@gmail.com
141
+ icon: fas fa-envelope
142
+ - title: Twitter
143
+ url: https://twitter.com/szivong
144
+ icon: fab fa-twitter
145
+ - title: GitHub
146
+ url: https://github.com/szivong
147
+ icon: fab fa-github
148
+ ```
149
+
150
+ ### Alert Messages
151
+
152
+ Pole provides some predefined classes to specify different levels of **alert messages**. In order of tone from light to heavy, they are: `message-info`, `message-warning`, and `message-danger`. You may add it to single elements like a `<p>`, or to a parent if there are multiple elements to show.
153
+
154
+ ### Google Analytics 4
155
+
156
+ To enable [Google Analytics 4](https://support.google.com/analytics/answer/10089681?hl=en), you just need to set the [Measurement ID](https://support.google.com/analytics/answer/7372977?hl=en) in your `_config.yml`, for example,
157
+
158
+ ```yml
159
+ google_analytics: G-XXXXXXX
160
+ ```
161
+
162
+ ### Archive
163
+
164
+ Pole provides some built-in archive pages. It is implemented in pure Liquid. If you want to archive posts by years, you can create a page and put these code in it:
165
+
166
+ ```yml
167
+ ---
168
+ layout: archive
169
+ type: years
170
+ ---
171
+ ```
172
+
173
+ Similarly, if you want to archive posts by categories or tags, you can set the `type` property as `categories` or `tags`.
174
+
175
+ ## Contributing
176
+
177
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/szivong/pole](https://github.com/szivong/pole). 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.
178
+
179
+ ## Development
180
+
181
+ To set up your environment to develop this theme, run `bundle install`.
182
+
183
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
184
+
185
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
186
+ To add a custom directory to your theme-gem, please edit the regexp in `pole.gemspec` accordingly.
187
+
188
+ ## License
189
+
190
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,71 @@
1
+ {%- if page.type == 'categories' -%}
2
+ {%- assign taxonomies = site.categories -%}
3
+ {%- elsif page.type == 'tags' -%}
4
+ {%- assign taxonomies = site.tags -%}
5
+ {%- else -%}
6
+ {%- assign taxonomies = none -%}
7
+ {%- endif -%}
8
+
9
+ {%- assign max_count = 0 -%}
10
+ {%- for taxonomy in taxonomies -%}
11
+ {%- assign posts = taxonomy[1] -%}
12
+ {%- if posts.size > max_count -%}
13
+ {%- assign max_count = posts.size -%}
14
+ {%- endif -%}
15
+ {%- endfor -%}
16
+
17
+ <div class="taxonomies-wrapper">
18
+ <ul class="taxonomies">
19
+ {%- for i in (1..max_count) reversed -%}
20
+ {%- for taxonomy in taxonomies -%}
21
+ {%- assign taxonomy_name = taxonomy[0] -%}
22
+ {%- assign slugified_taxonomy_name = taxonomy_name | slugify -%}
23
+ {%- assign posts = taxonomy[1] -%}
24
+ {%- if posts.size == i -%}
25
+ <li>
26
+ {%- capture link -%}{{ page.permalink }}#{{ slugified_taxonomy_name }}{%- endcapture -%}
27
+ <a class="taxonomy" href="{{ link | relative_url }}">
28
+ <span>
29
+ {%- if page.type == 'tags' -%}
30
+ {{ slugified_taxonomy_name }}
31
+ {%- else -%}
32
+ {{ taxonomy_name }}
33
+ {%- endif -%}
34
+ </span>
35
+ <span class="taxonomy-count">{{ posts.size }}</span>
36
+ </a>
37
+ </li>
38
+ {%- endif -%}
39
+ {%- endfor -%}
40
+ {%- endfor -%}
41
+ </ul>
42
+ </div>
43
+
44
+ {%- for i in (1..max_count) reversed -%}
45
+ {%- for taxonomy in taxonomies -%}
46
+ {%- assign taxonomy_name = taxonomy[0] -%}
47
+ {%- assign slugified_taxonomy_name = taxonomy_name | slugify -%}
48
+ {%- assign posts = taxonomy[1] -%}
49
+ {%- if posts.size == i -%}
50
+ <h2 id="{{ slugified_taxonomy_name }}">
51
+ {%- if page.type == 'tags' -%}
52
+ {{ slugified_taxonomy_name }}
53
+ {%- else -%}
54
+ {{ taxonomy_name }}
55
+ {%- endif -%}
56
+ </h2>
57
+ <ul class="post-list-by-taxonomy">
58
+ {%- for post in posts -%}
59
+ <li>
60
+ <time datetime="{{ page.date | date_to_xmlschema }}">{{ post.date | date: "%Y-%m-%d" }}</time>
61
+ &raquo;
62
+ <a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a>
63
+ </li>
64
+ {%- endfor -%}
65
+ </ul>
66
+ <a href="#" onclick="backToTop()" class="back-to-top">Top &#8648;</a>
67
+ {%- endif -%}
68
+ {%- endfor -%}
69
+ {%- endfor -%}
70
+
71
+ {% include back-to-top.html %}
@@ -0,0 +1,32 @@
1
+ {% assign taxonomies = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
2
+
3
+ <div class="taxonomies-wrapper">
4
+ <ul class="taxonomies">
5
+ {%- for taxonomy in taxonomies -%}
6
+ <li>
7
+ {%- capture link -%}{{ page.permalink }}#{{ taxonomy.name }}{%- endcapture -%}
8
+ <a class="taxonomy" href="{{ link | relative_url }}">
9
+ <span>{{ taxonomy.name }}</span>
10
+ <span class="taxonomy-count">{{ taxonomy.size }}</span>
11
+ </a>
12
+ </li>
13
+ {%- endfor -%}
14
+ </ul>
15
+ </div>
16
+
17
+ {%- for taxonomy in taxonomies -%}
18
+ <h2 id="{{ taxonomy.name }}">{{ taxonomy.name }}</h2>
19
+ <ul class="post-list-by-taxonomy">
20
+ {%- assign posts = taxonomy.items -%}
21
+ {%- for post in posts -%}
22
+ <li>
23
+ <time datetime="{{ page.date | date_to_xmlschema }}">{{ post.date | date: "%Y-%m-%d" }}</time>
24
+ &raquo;
25
+ <a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a>
26
+ </li>
27
+ {%- endfor -%}
28
+ </ul>
29
+ <a href="#" onclick="backToTop()" class="back-to-top">Top &#8648;</a>
30
+ {%- endfor -%}
31
+
32
+ {% include back-to-top.html %}
@@ -0,0 +1,6 @@
1
+ <script>
2
+ function backToTop() {
3
+ const main = document.getElementById("site-main");
4
+ main.scrollTop = 0;
5
+ }
6
+ </script>
@@ -0,0 +1,6 @@
1
+ {% comment %}
2
+ Placeholder to allow defining custom head, in principle, you can add anything here, e.g. favicons:
3
+
4
+ 1. Head over to https://realfavicongenerator.net/ to add your own favicons.
5
+ 2. Customize default _includes/custom-head.html in your source directory and insert the given code snippet.
6
+ {% endcomment %}
@@ -0,0 +1,17 @@
1
+ <div id="disqus_thread"></div>
2
+ <script>
3
+ var disqus_config = function () {
4
+ this.page.url = '{{ page.url | absolute_url }}';
5
+ this.page.identifier = '{{ page.url | absolute_url }}';
6
+ };
7
+
8
+ (function() {
9
+ var d = document, s = d.createElement('script');
10
+
11
+ s.src = 'https://{{ site.disqus }}.disqus.com/embed.js';
12
+
13
+ s.setAttribute('data-timestamp', +new Date());
14
+ (d.head || d.body).appendChild(s);
15
+ })();
16
+ </script>
17
+ <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
@@ -0,0 +1,39 @@
1
+ <footer class="footer">
2
+ <div class="footer-column">
3
+ <p>
4
+ <small>
5
+ &copy;&nbsp;
6
+ {%- assign date_from = site.posts[-1].date | date_to_xmlschema -%}
7
+ {%- assign year_from = date_from | date: '%Y' -%}
8
+ {%- assign date_to = site.time | date_to_xmlschema -%}
9
+ {%- assign year_to = date_to | date: '%Y' -%}
10
+ {%- unless year_from == nil or year_from == year_to -%}
11
+ <time datetime="{{ date_from }}">{{ year_from }}</time>-
12
+ {%- endunless -%}
13
+ <time datetime="{{ date_to }}">{{ year_to }}</time>
14
+ {%- if site.author -%}
15
+ &nbsp;<a href="{{ site.author.url }}" target="_blank">{{ site.author.name }}</a>
16
+ {%- endif -%}
17
+ . All right reserved.
18
+ </small>
19
+ </p>
20
+ <p>
21
+ <small>
22
+ Powered by <a href="https://jekyllrb.com/" target="_blank">Jekyll</a> & <a href="https://github.com/szivong/pole" target="_blank">Pole</a>
23
+ </small>
24
+ </p>
25
+ </div>
26
+ {% if site.data.social %}
27
+ <div class="footer-column">
28
+ <ul class="social-icons">
29
+ {% for social in site.data.social %}
30
+ <li class="social-icon-item">
31
+ <a class="social-icon" href="{{ social.url }}" target="_blank">
32
+ <i class="{{ social.icon | default: 'fas fa-link' }}" title="{{ social.title }}"></i>
33
+ </a>
34
+ </li>
35
+ {% endfor %}
36
+ </ul>
37
+ </div>
38
+ {% endif %}
39
+ </footer>
@@ -0,0 +1,9 @@
1
+ <!-- Global site tag (gtag.js) - Google Analytics -->
2
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
3
+ <script>
4
+ window.dataLayer = window.dataLayer || [];
5
+ function gtag(){dataLayer.push(arguments);}
6
+ gtag('js', new Date());
7
+
8
+ gtag('config', '{{ site.google_analytics }}');
9
+ </script>
@@ -0,0 +1,13 @@
1
+ <head>
2
+ <meta charset="UTF-8">
3
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
4
+ <link rel="stylesheet" href="{{ 'assets/normalize.css' | relative_url }}">
5
+ <link rel="stylesheet" href="{{ 'assets/open-color.css' | relative_url }}">
6
+ <link rel="stylesheet" href="{{ 'assets/pole/styles.css' | relative_url }}">
7
+ {% feed_meta %}
8
+ {% seo %}
9
+
10
+ <script async src="https://use.fontawesome.com/releases/v5.0.12/js/all.js"></script>
11
+
12
+ {% include custom-head.html %}
13
+ </head>
@@ -0,0 +1,20 @@
1
+ <header class="masthead">
2
+ <div class="masthead-title">
3
+ <a href="{{ '/' | relative_url }}" title="Home">{{ site.title }}</a>
4
+ <small class="tagline">{{ site.tagline }}</small>
5
+ </div>
6
+
7
+ {% if site.data.navigation %}
8
+ <nav class="nav">
9
+ <ul class="nav-list">
10
+ {% for item in site.data.navigation %}
11
+ <li class="nav-item">
12
+ <a href="{{ item.url | relative_url }}" class="{% if page.url == item.url %}current{% endif %}">
13
+ {{ item.title }}
14
+ </a>
15
+ </li>
16
+ {% endfor %}
17
+ </ul>
18
+ </nav>
19
+ {% endif %}
20
+ </header>