monophase 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: 22516e0e65efea0dcf287d53feb68536eec0c5fca17d8d220c8fb558d521c526
4
+ data.tar.gz: 9bc88c6a7ac1b7d41bc74c480a150ecdafd49f178c75849e00fbfc316fb3fa0c
5
+ SHA512:
6
+ metadata.gz: 011166e4ac0d76b81454811019466e97eb96b1f2521f06f8f4d036e3c58cdadeb3c88542e26e3e66691f21505c7cf3e160d45992abcc9d1417b28712b35bd203
7
+ data.tar.gz: b8942005a6bd2d53f47a5428f9e38855eb481a884cd515e76638bfc17355b97300601da09d362fab473c9f4a58e1754ee3a15a5fb2a83cac2595201eda9d00c6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Songzi Vong
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,194 @@
1
+ # Monophase <!-- omit in toc -->
2
+
3
+ <a href="https://jekyll-themes.com">
4
+ <img src="https://img.shields.io/badge/featured%20on-JekyllThemes-red.svg" height="20" alt="Jekyll Themes Shield" >
5
+ </a>
6
+
7
+ Monophase is *a one-column minimal responsive Jekyll blog theme*.
8
+
9
+ One of the purposes of Monophase is to be an alternative option to the default theme of Jekyll—[Minima](https://github.com/jekyll/minima). Monophase is still keeping minimal, but meanwhile, more beautiful and mellow, and doesn't lose some useful basic features, such as archive.
10
+
11
+ Check the *[live demo](https://zivlog.io/monophase/)*.
12
+
13
+ ![Screenshot Light](screenshot-light.png)
14
+ ![Screenshot Dark](screenshot-dark.png)
15
+
16
+ ## Highlight Features <!-- omit in toc -->
17
+
18
+ - [Normalize.css](https://github.com/necolas/normalize.css)
19
+ - [Open Color](https://github.com/yeun/open-color)
20
+ - [Font Awesome](https://fontawesome.com/)
21
+ - [Disqus](https://disqus.com/)
22
+ - [MathJax](https://www.mathjax.org/)
23
+ - [Google Analytics 4](https://support.google.com/analytics/answer/10089681?hl=en)
24
+ - [Jekyll Feed](https://github.com/jekyll/jekyll-feed/)
25
+ - [Jekyll Paginate](https://github.com/jekyll/jekyll-paginate)
26
+ - [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag/)
27
+ - Related posts (time-based, because Jekyll) below each post
28
+ - Dark mode, via [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
29
+ - Archive implemented by pure [Liquid](https://shopify.github.io/liquid/)
30
+
31
+ ## Table of Contents <!-- omit in toc -->
32
+
33
+ - [Installation](#installation)
34
+ - [Usage](#usage)
35
+ - [Global Configuration](#global-configuration)
36
+ - [Post Configuration](#post-configuration)
37
+ - [Homepage](#homepage)
38
+ - [Custom Head](#custom-head)
39
+ - [Navigation](#navigation)
40
+ - [Social Links](#social-links)
41
+ - [Alert Messages](#alert-messages)
42
+ - [Google Analytics 4](#google-analytics-4)
43
+ - [Archive](#archive)
44
+ - [Contributing](#contributing)
45
+ - [Development](#development)
46
+ - [License](#license)
47
+
48
+ ## Installation
49
+
50
+ Add this line to your Jekyll site's `Gemfile`:
51
+
52
+ ```ruby
53
+ gem "monophase"
54
+ ```
55
+
56
+ And add this line to your Jekyll site's `_config.yml`:
57
+
58
+ ```yaml
59
+ theme: monophase
60
+ ```
61
+
62
+ And then execute:
63
+
64
+ ```shell
65
+ bundle
66
+ ```
67
+
68
+ Or install it yourself as:
69
+
70
+ ```shell
71
+ gem install monophase
72
+ ```
73
+
74
+ You can also install the latest code via [`jekyll-remote-theme`](https://github.com/benbalter/jekyll-remote-theme):
75
+
76
+ 1. Add this line to your Jekyll site's `Gemfile`:
77
+
78
+ ```ruby
79
+ gem "jekyll-remote-theme"
80
+ ```
81
+
82
+ 2. Add these lines to your Jekyll site's `_config.yml`:
83
+
84
+ ```ruby
85
+ plugins:
86
+ - jekyll-remote-theme
87
+
88
+ remote_theme: zivhub/monophase@main
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ ### Global Configuration
94
+
95
+ | Variable | Type | Default | Specification |
96
+ | -------- | ---- | ------- | ------------- |
97
+ | `title` | String | --- | The title of the website |
98
+ | `tagline` | String | --- | The tagline of the website |
99
+ | `lang` | String | `en` | The language of pages; The value can be overwritten by the `lang` variable on each page |
100
+ | `author.name` | String | --- | The name of the website author |
101
+ | `author.url` | String | --- | A URL of the website author |
102
+ | `tags_path` | String | --- | A path to the archive-by-tags page; It is used by tags on each post |
103
+ | `categories_path` | String | --- | A path to the archive-by-categories page; It is used by categories on each post |
104
+ | `disqus` | String | --- | Disqus short name |
105
+ | `google_analytics` | String | --- | Google Analytics 4 Measurement ID |
106
+
107
+ ### Post Configuration
108
+
109
+ | Variable | Type | Default | Specification |
110
+ | -------- | ---- | ------- | ------------- |
111
+ | `description` | String | --- | A description of the current post |
112
+ | `last_modified_at` | String | --- | The date of the last modification you made on a post after its publishing |
113
+ | `author` | String or Array | --- | The author name(s) of the post |
114
+ | `comments` | Boolean | `true` | Does enable the Disqus comment system |
115
+ | `math` | Boolean | `false` | Does enable MathJax on this page |
116
+
117
+ ### Homepage
118
+
119
+ You can create a homepage for your blog by setting `layout: home` in your `index.html`.
120
+
121
+ ### Custom Head
122
+
123
+ Monophase 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>`.
124
+
125
+ ### Navigation
126
+
127
+ The navigation bar of Monophase is configurable. You just need to specify titles and URLs in the file `_data/navigation.yml`, for example,
128
+
129
+ ```yml
130
+ - title: About
131
+ url: /about/
132
+ - title: Archive
133
+ url: /archive/
134
+ - title: Categories
135
+ url: /categories/
136
+ ```
137
+
138
+ ### Social Links
139
+
140
+ Monophase allows you to show social links on the website. All you need to do is creating a file `_data/social.yml`, for example,
141
+
142
+ ```yml
143
+ - title: Email
144
+ url: mailto:zivmsg@gmail.com
145
+ icon: fas fa-envelope
146
+ - title: Twitter
147
+ url: https://twitter.com/zivtwt
148
+ icon: fab fa-twitter
149
+ - title: GitHub
150
+ url: https://github.com/zivhub
151
+ icon: fab fa-github
152
+ ```
153
+
154
+ ### Alert Messages
155
+
156
+ Monophase 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.
157
+
158
+ ### Google Analytics 4
159
+
160
+ 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,
161
+
162
+ ```yml
163
+ google_analytics: G-XXXXXXX
164
+ ```
165
+
166
+ ### Archive
167
+
168
+ Monophase 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:
169
+
170
+ ```yml
171
+ ---
172
+ layout: archive
173
+ type: years
174
+ ---
175
+ ```
176
+
177
+ Similarly, if you want to archive posts by categories or tags, you can set the `type` property as `categories` or `tags`.
178
+
179
+ ## Contributing
180
+
181
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/zivhub/monophase](https://github.com/zivhub/monophase). 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.
182
+
183
+ ## Development
184
+
185
+ To set up your environment to develop this theme, run `bundle install`.
186
+
187
+ 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.
188
+
189
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
190
+ To add a custom directory to your theme-gem, please edit the regexp in `monophase.gemspec` accordingly.
191
+
192
+ ## License
193
+
194
+ 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/zivhub/monophase" target="_blank">Monophase</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/monophase/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>