no-style-please 0.2.0 → 0.4.3

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: 360b8b480989db056edf39d88abb2351d9a7dceeadb69c0fb7d7009eb05a142c
4
- data.tar.gz: ae3ce04c8c17b35f8aa038ee65db879e0f7d1783da12640870f4f6f0f526a7f4
3
+ metadata.gz: ee746e88eb742a41e573949ef8d24b8c21ea1853d4958108048053f4d1863e73
4
+ data.tar.gz: 1b661bf1dd33148829029754fdb04fd1974adec17ab02997af8ce7ab32b838e7
5
5
  SHA512:
6
- metadata.gz: 63770655480e98cea80eefa481e6e29c509a57cbd819d1e20a19d17b7104823dcf1d0468a822e8f9d4036d1f42f76381cc654dd56fa6154385e2e9ccb9e026bb
7
- data.tar.gz: 8817fa1e7dc0f2dfa465decfaae650a4e35f0f31f64ec27c50a90d8d6b8f68f18ca6f8ca24a47bb4242148df4f7bac35b95a6cd53c6a5869a082192416a71aab
6
+ metadata.gz: a133eeeaadfa8f7c8ba988a26fd192dc9066bf8a11d749b7ff9aa0190fb9e9b45ed3898a914908266f175663718edd901f3745e2a7bb30fc3e433ec71d48bfaa
7
+ data.tar.gz: a3ee77d03d1348a099d0f6638c8a20a2098861f79b48d18e53cfaf9fcef9ac6bf40115b224d0fc04877c26e7f71554168e5d538c0ea1d35d0bdb0a3f34cd16bd
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # no style, please!
2
2
 
3
- <img src="./logo.png" width="64" align="left" />A (nearly) no-CSS, fast, minimalist [Jekyll](https://jekyllrb.com/) theme.
3
+ <img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/logo.png" width="64" align="left" />A (nearly) no-CSS, fast, minimalist [Jekyll](https://jekyllrb.com/) theme.
4
4
  Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my personal blog](https://riggraz.dev/).
5
5
 
6
6
  <h3 align="center"><a href="https://riggraz.dev/no-style-please/">Try the demo out!</a></h3>
7
7
 
8
- <img src="./_screenshots/featured-image.png" />
8
+ <img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/featured-image.png" />
9
9
 
10
10
  ## Features
11
11
 
12
- * Fast (**< 1kb of CSS**, see [Page Speed Insights report](https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/page-speed-insights-report.png) and [Lighthouse report](https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/lighthouse-report.png))
12
+ * Fast (**1kb of CSS!** For more information on performance and more, see [Page Speed Insights report](https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/page-speed-insights-report.png) and [Lighthouse report](https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/lighthouse-report.png))
13
+ * Light, dark and auto modes
13
14
  * Responsive
14
15
  * Content first (typography optimized for maximum readability)
15
16
  * SEO optimized (uses [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag))
@@ -48,7 +49,7 @@ If you want to use this theme for your Jekyll's site deployed on [GitHub Pages](
48
49
 
49
50
  ## Usage
50
51
 
51
- You can edit `_config.yml` file to customize your blog. You can change things such as the name of the blog, the author, how dates are formatted, etc. Customizable fields should be straightforward to understand, however `_config.yml` contains some comments to help you understand what each fields does.
52
+ You can edit `_config.yml` file to customize your blog. You can change things such as the name of the blog, the author, the appearance of the theme (light, dark or auto), how dates are formatted, etc. Customizable fields should be straightforward to understand. Still, `_config.yml` contains some comments to help you understand what each field does.
52
53
 
53
54
  For further customization (e.g. layout, CSS) see the [official Jekyll's documentation](https://jekyllrb.com/docs/themes/#overriding-theme-defaults) on customizing gem-based themes.
54
55
 
@@ -60,15 +61,52 @@ The `menu.yml` file accepts the following fields:
60
61
 
61
62
  - `entries` define a new unordered list that will contain menu entries
62
63
  - each entry is marked by a `-` at the beginning of the line
63
- - each entry has the following attributes:
64
- - `title`, which defines the text to render for that menu entry
65
- - `url`, which can either be a URL or `false`. If it is `false`, the entry will be rendered as plain text; otherwise the entry will be rendered as a link pointing to the specified URL. Note that the URL can either be relative or absolute.
66
- - `post_list`, which can be `true` or `false`. If it is true, the entry will have all posts in the site as subentries. This is used to render your post list.
64
+ - each entry can have the following attributes:
65
+ - `title`, which defines the text to render for this menu entry (**NB: you can also specify HTML!**)
66
+ - `url`, which can be used to specify an URL for this entry. If not specified, `title` will be rendered as-is; otherwise `title` will be sorrounded by a link tag pointing to the specified URL. Note that the URL can either be relative or absolute. Also note that you can get the same result by placing an ```<a>``` tag in the `title` field.
67
+ - `post_list`, which can be set either to `true` or to an object. If it is true, the entry will have a list of all posts as subentries. This is used to render your post list. If you want to customize which posts to render (e.g. by category), you can add one or more of the following attributes under `post_list`:
68
+ - `category`, which can be set to a string. It is used to render a list of posts of the specified category only. If you don't set it, then posts of all categories will be rendered.
69
+ - `limit`, which can be set to a number. It specifies the number of posts to show. If not set, all posts will be rendered.
70
+ - `show_more`, which can be true. If it is true and if the number of posts to show is greater than the specified `limit`, render a link to another page. To specify the URL and the text of the link, you can set `show_more_url` and `show_more_text` attributes, which are documented below.
71
+ - `show_more_url`, which can be a string. It specifies the URL for the show more link. Use only if `show_more` is true. This will usually redirect to a page containing all posts, which you can easily create using an archive page (see [create archive pages](#create-archive-pages) section)
72
+ - `show_more_text`, which can be a string. It specifies the text for the show more link. Use only if `show_more` is true.
67
73
  - `entries`, yes, you can have entries inside entries. In this way you can create nested sublists!
68
74
 
75
+ ### Create archive pages
76
+
77
+ A so-called archive page is a page that shows a list of posts (see [this](https://riggraz.dev/no-style-please/all-posts) for an example). You can create an archive page by creating a page and putting the following frontmatter:
78
+
79
+ ```
80
+ ---
81
+ layout: archive
82
+ title: The title of the page here
83
+ which_category: name-of-category
84
+ ---
85
+ ```
86
+
87
+ `which_category` is optional: if you don't put it, then all posts of the blog will be listed; on the other hand, if you specify a category, only posts of that category will be shown.
88
+
89
+ This feature is particularly useful if used together with the `show_more` attribute in the menu. For example, if you want to limit the number of posts shown in the home page to 5 but add a link to view them all, then you can create an archive page using the method showed above and link to it using the `show_more_url` attribute in `menu.yml`. See [this example](https://github.com/riggraz/no-style-please/blob/master/_data/menu.yml) if you're in doubt.
90
+
91
+ ### Customize the index page
92
+
93
+ The `index.md` page should use layout `home`, which is the layout that displays the menu. If you want to have some content after the menu, you can just add that content in the `index.md` file, and it will automatically show under the menu.
94
+
95
+ Another thing you can do to customize the index page is show the description of your blog between the title and the menu. To do this, just edit `_config.yml` and change `theme_config.show_description` to `true`.
96
+
97
+ ### Pro tips
98
+
99
+ #### Dark mode for images
100
+
101
+ This theme provides dark mode by inverting all colors of light mode throught the CSS `invert()` function. This approach would also invert the color of all images, but, since this is not the behaviour one would expect, images are not inverted by default.
102
+
103
+ However, if you would like to force the color inversion on a specific image you can do so by applying `class="ioda"` to that image ("ioda" stands for "invert on dark appearance"). See the image in the [overview post](https://github.com/riggraz/no-style-please/blob/master/_posts/2020-07-07-overview-post.md) for an example of this approach. Note that color inversion will take place only when the theme has dark appearance!
104
+
105
+ For example, if you have a black and white image it could make sense to invert it in dark mode. On the other hand, a colorful image will probably look bad if inverted.
106
+
69
107
  ## Contributing
70
108
 
71
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. 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.
109
+ Bug reports and pull requests are welcome on GitHub at https://github.com/riggraz/no-style-please. 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.
72
110
 
73
111
  ## Development
74
112
 
data/_config.yml CHANGED
@@ -1,18 +1,20 @@
1
1
  title: no style, please! # name of the site
2
2
  author: Riccardo Graziosi # name of site's author
3
3
  email: riccardo.graziosi97@gmail.com # email of site's author
4
- url: https://riggraz.dev/no-style-please # root address of the site
4
+ url: https://riggraz.dev # root address of the site
5
+ baseurl: "/no-style-please" # subpath of the site, e.g. "/blog" (leave it blank "" if you're site shouldn't use a subpath)
5
6
  description: > # description of the site (multiple lines allowed)
6
7
  A (nearly) no-CSS, fast, minimalist Jekyll theme.
7
8
 
8
9
  permalink: /:slug.html
9
10
 
10
- favicon: "./logo.png" # relative path to site's favicon
11
+ favicon: "logo.png" # name+extension of favicon (which must be put on the root folder)
11
12
  # goat_counter: "yoursitename" # put your GoatCounter name if you want to use GoatCounter analytics
12
13
 
13
14
  theme: no-style-please # if you are using GitHub Pages, change it to remote_theme: riggraz/no-style-please
14
15
 
15
16
  theme_config:
17
+ appearance: "auto" # can be "light", "dark" or "auto"
16
18
  back_home_text: ".." # customize text for homepage link in post layout
17
19
  date_format: "%Y-%m-%d" # customize how date is formatted
18
20
  show_description: false # show blog description in home page
@@ -22,4 +24,4 @@ sass:
22
24
 
23
25
  plugins:
24
26
  - jekyll-feed
25
- - jekyll-seo-tag
27
+ - jekyll-seo-tag
@@ -0,0 +1 @@
1
+ <a href="{{ "/" | relative_url }}">{{ site.theme_config.back_home_text }}</a>
data/_includes/head.html CHANGED
@@ -4,16 +4,16 @@
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1" />
5
5
 
6
6
  <title>
7
- {% if page.title %}
7
+ {%- if page.title -%}
8
8
  {{ page.title }}
9
- {% else %}
9
+ {%- else -%}
10
10
  {{ site.title }}
11
- {% endif %}
11
+ {%- endif -%}
12
12
  </title>
13
13
 
14
- {% seo title=false %}
15
- {% feed_meta %}
14
+ {%-seo title=false-%}
15
+ {%-feed_meta-%}
16
16
 
17
- <link rel="shortcut icon" type="image/x-icon" href="/{{ site.favicon }}" />
18
- <link rel="stylesheet" href="{{ site.url }}/assets/css/main.css" />
17
+ <link rel="shortcut icon" type="image/x-icon" href="{{ site.favicon | relative_url }}" />
18
+ <link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}" />
19
19
  </head>
@@ -1,19 +1,26 @@
1
1
  <ul>
2
- {% for item in include.collection %}
2
+ {%-for item in include.collection-%}
3
3
  <li>
4
- {% if item.url != false %}
4
+ {%- if item.url -%}
5
5
  <a href="{{ item.url }}">{{ item.title }}</a>
6
- {% else %}
6
+ {%- else -%}
7
7
  {{ item.title }}
8
- {% endif %}
8
+ {%- endif -%}
9
9
  </li>
10
10
 
11
- {% if item.post_list == true %}
12
- {% include post_list.html %}
13
- {% endif %}
11
+ {%-if item.post_list-%}
12
+ {%
13
+ include post_list.html
14
+ category=item.post_list.category
15
+ limit=item.post_list.limit
16
+ show_more=item.post_list.show_more
17
+ show_more_text=item.post_list.show_more_text
18
+ show_more_url=item.post_list.show_more_url
19
+ -%}
20
+ {%-endif-%}
14
21
 
15
- {% if item.entries != blank %}
16
- {% include menu_item.html collection=item.entries %}
17
- {% endif %}
18
- {% endfor %}
22
+ {%-if item.entries-%}
23
+ {%-include menu_item.html collection=item.entries-%}
24
+ {%-endif-%}
25
+ {%-endfor-%}
19
26
  </ul>
@@ -1,9 +1,25 @@
1
- {% if site.posts.size > 0 %}
1
+ {%-if include.category-%}
2
+ {%-assign posts = site.categories[include.category]-%}
3
+ {%-else-%}
4
+ {%-assign posts = site.posts-%}
5
+ {%-endif-%}
6
+
7
+ {%-if include.limit and posts.size > include.limit-%}
8
+ {%-assign limit_exceeded = true-%}
9
+ {%-else-%}
10
+ {%-assign limit_exceeded = false-%}
11
+ {%-endif-%}
12
+
13
+ {%- if posts.size > 0 -%}
2
14
  <ul>
3
- {% for post in site.posts %}
4
- <li>
5
- {{ post.date | date: site.theme_config.date_format }} <a href="{{ post.url | relative_url }}">{{ post.title | downcase }}</a>
6
- </li>
7
- {% endfor %}
15
+ {%- for post in posts limit: include.limit -%}
16
+ <li>
17
+ <span>{{- post.date | date: site.theme_config.date_format -}}</span>
18
+ <a href="{{ post.url | relative_url }}">{{ post.title | downcase }}</a>
19
+ </li>
20
+ {%- endfor -%}
21
+ {%- if include.show_more and limit_exceeded -%}
22
+ <li><a href="{{ include.show_more_url }}">{{ include.show_more_text | default: "Show more..." }}</a></li>
23
+ {%- endif -%}
8
24
  </ul>
9
- {% endif %}
25
+ {%- endif -%}
@@ -0,0 +1,9 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {%-include back_link.html-%}
6
+
7
+ <h1>{{ page.title }}</h1>
8
+
9
+ {%-include post_list.html category=page.which_category-%}
@@ -1,15 +1,15 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="{{ page.lang | default: "en" }}">
3
- {%- include head.html -%}
4
- <body>
3
+ {%- include head.html -%}
4
+ <body a="{{ site.theme_config.appearance | default: "auto" }}">
5
5
  <main class="page-content" aria-label="Content">
6
- <div class="wrapper">
7
- {{ content }}
8
- </div>
6
+ <div class="w">
7
+ {{ content }}
8
+ </div>
9
9
  </main>
10
10
 
11
- {% if site.goat_counter and jekyll.environment == "production" %}
12
- {% include goat_counter.html %}
13
- {% endif %}
14
- </body>
11
+ {%-if site.goat_counter and jekyll.environment == "production"-%}
12
+ {%-include goat_counter.html-%}
13
+ {%-endif-%}
14
+ </body>
15
15
  </html>
data/_layouts/home.html CHANGED
@@ -3,9 +3,11 @@ layout: default
3
3
  ---
4
4
  <header>
5
5
  <h1>{{ site.title }}</h1>
6
- {% if site.theme_config.show_description == true %}
6
+ {%-if site.theme_config.show_description-%}
7
7
  <p>{{ site.description }}</p>
8
- {% endif %}
8
+ {%-endif-%}
9
9
  </header>
10
10
 
11
- {% include menu_item.html collection=site.data.menu.entries %}
11
+ {%-include menu_item.html collection=site.data.menu.entries-%}
12
+
13
+ {{ content }}
@@ -0,0 +1,9 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {%-include back_link.html-%}
6
+
7
+ <h1>{{ page.title }}</h1>
8
+
9
+ {{ content }}
data/_layouts/post.html CHANGED
@@ -2,6 +2,14 @@
2
2
  layout: default
3
3
  ---
4
4
 
5
- <a href="{{ site.url }}">{{ site.theme_config.back_home_text }}</a>
6
- <h1>{{ page.title }}</h1>
7
- {{ content }}
5
+ {%-include back_link.html-%}
6
+
7
+ <article>
8
+ <p class="post-meta">
9
+ <time datetime="{{ page.date }}">{{ page.date | date: site.theme_config.date_format }}</time>
10
+ </p>
11
+
12
+ <h1>{{ page.title }}</h1>
13
+
14
+ {{ content }}
15
+ </article>
@@ -1,12 +1,39 @@
1
- html {
1
+ // -------------- THEME SWITCHER -------------- //
2
+ @mixin dark-appearance {
3
+ filter: invert(1);
4
+ img {
5
+ filter: invert(1);
6
+
7
+ &.ioda { filter: invert(0); }
8
+ }
9
+ }
10
+
11
+ body[a="dark"] { @include dark-appearance; }
12
+
13
+
14
+ @media (prefers-color-scheme: dark) {
15
+ body[a="auto"] { @include dark-appearance; }
16
+ }
17
+ // -------------------------------------------- //
18
+
19
+ // bg color is also needed in html in order to
20
+ // block body's background propagation
21
+ // see: https://stackoverflow.com/a/61265706
22
+ html, body { background: white; }
23
+
24
+ html { height: 100%; }
25
+
26
+ body {
2
27
  color: black;
3
- background-color: white;
4
28
  font-family: monospace;
5
29
  font-size: 1.3rem;
6
30
  line-height: 1.3;
7
- -webkit-font-smoothing: antialiased;
31
+ margin: 0;
32
+ min-height: 100%;
8
33
  }
9
34
 
35
+ .post-meta { text-align: right; }
36
+
10
37
  h2, h3, h4, h5, h6 { margin-top: 3rem; }
11
38
 
12
39
  hr { margin: 2rem 0; }
@@ -15,12 +42,13 @@ p { margin: 1rem 0; }
15
42
 
16
43
  li { margin: 0.4rem 0; }
17
44
 
18
- *:target { background-color: yellow; }
45
+ *:target { background: yellow; }
19
46
 
20
- .wrapper {
21
- max-width: 60ch;
22
- margin: 4rem auto;
23
- padding: 0 1rem;
47
+ .w {
48
+ width: fit-content;
49
+ max-width: 640px;
50
+ margin: 0 auto;
51
+ padding: 4rem 2rem;
24
52
  }
25
53
 
26
54
  hr {
@@ -31,8 +59,9 @@ hr {
31
59
  &:after { content: attr(data-content) '/////' }
32
60
  }
33
61
 
62
+ table { width: 100%; }
63
+
34
64
  table, th, td {
35
- width: 100%;
36
65
  border: thin solid black;
37
66
  border-collapse: collapse;
38
67
  padding: 0.4rem;
@@ -40,12 +69,13 @@ table, th, td {
40
69
 
41
70
  code {
42
71
  color: white;
43
- background-color: black;
72
+ background: black;
44
73
  }
45
74
 
46
75
  div.highlighter-rouge code {
47
76
  display: block;
48
77
  overflow-x: auto;
78
+ white-space: pre-wrap;
49
79
  padding: 1rem;
50
80
  }
51
81
 
@@ -55,4 +85,10 @@ blockquote {
55
85
  padding: 1rem;
56
86
 
57
87
  p { margin: 0; }
88
+ }
89
+
90
+ img {
91
+ max-width: 100%;
92
+ display: block;
93
+ margin: 0 auto;
58
94
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Riccardo Graziosi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -62,12 +62,15 @@ files:
62
62
  - LICENSE.txt
63
63
  - README.md
64
64
  - _config.yml
65
+ - _includes/back_link.html
65
66
  - _includes/goat_counter.html
66
67
  - _includes/head.html
67
68
  - _includes/menu_item.html
68
69
  - _includes/post_list.html
70
+ - _layouts/archive.html
69
71
  - _layouts/default.html
70
72
  - _layouts/home.html
73
+ - _layouts/page.html
71
74
  - _layouts/post.html
72
75
  - _sass/no-style-please.scss
73
76
  - assets/css/main.scss