no-style-please 0.1.7 → 0.4.2

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: 2500f950ad63b645432f0fb69fd28adefd3bbfdc2dad4c0091764727308bea87
4
- data.tar.gz: 64e849ff9d780d819186f90e3365bace3a4afe17b1b314169fc78bed8f2a7a79
3
+ metadata.gz: 1ecb684babe73633d99791b629f4a6f8f77f3e3edc0acc52596a54010551b1f8
4
+ data.tar.gz: 182294102b68b76366d9b83f0589b5f7159ab9f8f8aea517400c4c29a81c7c8e
5
5
  SHA512:
6
- metadata.gz: 065da5fc107e92a59854fbc344edde9e942a0a226060a49af23cf30e3629c5ffc9c35b712daac203927c15901c0de069be42c94214435126001a6415a7709c2e
7
- data.tar.gz: 5453d08e3bbe5f66ac69dd52daf8cf9bedbc78205478fe1e65294290b3f4587aa82d0cadbee35d7f6f07c81a975c531aa45ac5dddce8b28edf4ed7b5ba47b8c4
6
+ metadata.gz: 4caccbd0ccc483e2c20d36d6314ddeb3e3b790d52c5ffc8815df6d873033a3b6a5e3431600d83abb79ba57c17e22cbafa41d15c22495e4c432ec4e78e684c622
7
+ data.tar.gz: a22246152c03f7bf57a48d1e70491c489970b3c64ddd735efe6c192230a345ced6b070308d36eddc03ee046007491760a16ac0659bfb60ac4746d868200a74aa
data/README.md CHANGED
@@ -1,19 +1,21 @@
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. Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my personal blog](https://riggraz.dev/).
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
+ Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my personal blog](https://riggraz.dev/).
4
5
 
5
- [Try the demo out!](https://riggraz.dev/no-style-please/)
6
+ <h3 align="center"><a href="https://riggraz.dev/no-style-please/">Try the demo out!</a></h3>
6
7
 
7
- <img src="./screenshots/featured-image.png" />
8
+ <img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/featured-image.png" />
8
9
 
9
10
  ## Features
10
11
 
11
- * 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
12
14
  * Responsive
13
15
  * Content first (typography optimized for maximum readability)
14
16
  * SEO optimized (uses [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag))
15
17
  * RSS feed (uses [Jekyll Feed](https://github.com/jekyll/jekyll-feed))
16
-
18
+ * Fully compatible with [GitHub Pages](https://pages.github.com/) (see [GitHub Pages installation](#github-pages-installation))
17
19
 
18
20
  ## Installation
19
21
 
@@ -47,7 +49,7 @@ If you want to use this theme for your Jekyll's site deployed on [GitHub Pages](
47
49
 
48
50
  ## Usage
49
51
 
50
- 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.
51
53
 
52
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.
53
55
 
@@ -59,15 +61,52 @@ The `menu.yml` file accepts the following fields:
59
61
 
60
62
  - `entries` define a new unordered list that will contain menu entries
61
63
  - each entry is marked by a `-` at the beginning of the line
62
- - each entry has the following attributes:
63
- - `title`, which defines the text to render for that menu entry
64
- - `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.
65
- - `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.
66
73
  - `entries`, yes, you can have entries inside entries. In this way you can create nested sublists!
67
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
+
68
107
  ## Contributing
69
108
 
70
- 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.
71
110
 
72
111
  ## Development
73
112
 
data/_config.yml CHANGED
@@ -1,16 +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
- favicon: "./logo.png" # relative path to site's favicon
9
+ permalink: /:slug.html
10
+
11
+ favicon: "logo.png" # name+extension of favicon (which must be put on the root folder)
9
12
  # goat_counter: "yoursitename" # put your GoatCounter name if you want to use GoatCounter analytics
10
13
 
11
14
  theme: no-style-please # if you are using GitHub Pages, change it to remote_theme: riggraz/no-style-please
12
15
 
13
16
  theme_config:
17
+ appearance: "auto" # can be "light", "dark" or "auto"
14
18
  back_home_text: ".." # customize text for homepage link in post layout
15
19
  date_format: "%Y-%m-%d" # customize how date is formatted
16
20
  show_description: false # show blog description in home page
@@ -20,4 +24,4 @@ sass:
20
24
 
21
25
  plugins:
22
26
  - jekyll-feed
23
- - 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,10 +42,13 @@ p { margin: 1rem 0; }
15
42
 
16
43
  li { margin: 0.4rem 0; }
17
44
 
18
- .wrapper {
19
- max-width: 60ch;
20
- margin: 4rem auto;
21
- padding: 0 1rem;
45
+ *:target { background: yellow; }
46
+
47
+ .w {
48
+ width: fit-content;
49
+ max-width: 640px;
50
+ margin: 0 auto;
51
+ padding: 4rem 2rem;
22
52
  }
23
53
 
24
54
  hr {
@@ -38,12 +68,13 @@ table, th, td {
38
68
 
39
69
  code {
40
70
  color: white;
41
- background-color: black;
71
+ background: black;
42
72
  }
43
73
 
44
74
  div.highlighter-rouge code {
45
75
  display: block;
46
76
  overflow-x: auto;
77
+ white-space: pre-wrap;
47
78
  padding: 1rem;
48
79
  }
49
80
 
@@ -53,4 +84,10 @@ blockquote {
53
84
  padding: 1rem;
54
85
 
55
86
  p { margin: 0; }
87
+ }
88
+
89
+ img {
90
+ max-width: 100%;
91
+ display: block;
92
+ margin: 0 auto;
56
93
  }
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.1.7
4
+ version: 0.4.2
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-21 00:00:00.000000000 Z
11
+ date: 2021-03-25 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