jekyll-theme-endless 0.2.1 → 0.3.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.adoc +35 -0
- data/_includes/function_list-posts.html +1 -1
- data/_includes/function_tag-cloud.html +77 -0
- data/_layouts/default.html +17 -1
- data/_layouts/html.html +1 -1
- data/_layouts/page-postlist.html +1 -1
- data/_layouts/page-tag.html +22 -0
- data/_sass/address.scss +15 -0
- data/_sass/tag-cloud.scss +18 -0
- data/assets/css/main.scss +2 -1
- data/lib/jekyll-theme-endless.rb +8 -0
- data/lib/jekyll-theme-endless/generate-tagpages.rb +80 -0
- data/lib/jekyll-theme-endless/version.rb +5 -0
- metadata +9 -3
- data/_sass/icons.scss +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89c0139c45315d50216ab24a38a764af14992c71f47bd10e7aa886927d681471
|
4
|
+
data.tar.gz: c6e8250581b4e0347545af3096a350fa0efb7ca242bc69e81743084367ee5fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898b9fd609cbc6511a168d3936f903977448b1ec2a1268d8605ebc09f5ca096b6a5aef0a6bc3e871c62295f7e8ed68b516be2d17442a8e0543c6fc80796d8b89
|
7
|
+
data.tar.gz: 70568707691fd41f0d074d00a42e614c41c26bd822c9bf6deb413bd2bbc48ff131a9614cad43695346877deece0c0d4df6e251d65a0bb89cc0cf4fa689b22651
|
data/README.adoc
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
:page-menu_position: 300
|
4
4
|
|
5
5
|
|
6
|
+
== Quicktstart for testing
|
7
|
+
|
8
|
+
* Clone the repository
|
9
|
+
* Run `bundle exec jekyll serve --config _config.yml,_data.yml`
|
10
|
+
* Open http://127.0.0.1:4000/ to view a page using this theme
|
6
11
|
|
7
12
|
== Installation
|
8
13
|
|
@@ -122,6 +127,10 @@ Content
|
|
122
127
|
`_layouts/page-postlist.html`::
|
123
128
|
Layout of page-content with a list of blog posts at the end.
|
124
129
|
|
130
|
+
`_layouts/page-tag.html`::
|
131
|
+
Layout of pages containing a list of those posts being tagged with a given tag.
|
132
|
+
This file is required by the `generate-tagpages`-plugin.
|
133
|
+
|
125
134
|
`_layouts/post.html`::
|
126
135
|
Layout of blog-posts.
|
127
136
|
|
@@ -173,6 +182,9 @@ This can be useful for your 404 page, which should be generated by Jekyll, but n
|
|
173
182
|
Generates the code containing links to each blog-post.
|
174
183
|
The text of the link is the title of the post.
|
175
184
|
|
185
|
+
`_includes/function_tag-cloud.html`::
|
186
|
+
Generates a tag cloud.
|
187
|
+
|
176
188
|
`_includes/content_footer-usernames.html`::
|
177
189
|
Creates a list of contact options based on provided usernames and addresses.
|
178
190
|
The entries are preceded with the icons of (e.g.) the social network and are linked to the corresponding profile.
|
@@ -190,6 +202,29 @@ username_linkedin: XXXX
|
|
190
202
|
|
191
203
|
|
192
204
|
|
205
|
+
=== Plugins
|
206
|
+
|
207
|
+
`_plugins/generate-tagpages.rb`
|
208
|
+
|
209
|
+
Generates a page for each tag listed in `site.tags`.
|
210
|
+
The files created are by default named `tags/<tagname>/index.html`.
|
211
|
+
The content is generated using the layout file `_layouts/page-tag.html`
|
212
|
+
|
213
|
+
The following values can be set in `_config.yml`:
|
214
|
+
|
215
|
+
[source, YAML]
|
216
|
+
----
|
217
|
+
# Settings for tag cloud:
|
218
|
+
# The name of the directory in which the files for each tag are created
|
219
|
+
# default: `tags`
|
220
|
+
tag_dir: post-for-tag
|
221
|
+
# Prefix to be used for the title of the tag-page
|
222
|
+
# default: `Tag: `
|
223
|
+
tag_title_prefix: "Posts tagged with: "
|
224
|
+
----
|
225
|
+
|
226
|
+
|
227
|
+
|
193
228
|
=== Styles
|
194
229
|
|
195
230
|
In order to contribute SCSS-code, simply add a file `_sass/user.scss`, containing your SCCS-code.
|
@@ -5,7 +5,7 @@ List of blog-posts.
|
|
5
5
|
<ul>
|
6
6
|
{% for current_post in site.posts %}
|
7
7
|
<li>
|
8
|
-
<a href="{{ current_post.url }}">{{ current_post.title }}</a>
|
8
|
+
{{ current_post.date | date: "%Y-%m-%d" }}: <a href="{{ current_post.url }}">{{ current_post.title }}</a>
|
9
9
|
</li>
|
10
10
|
{% endfor %}
|
11
11
|
</ul>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
{% comment %}
|
2
|
+
Creates a tag cloud with tags beeing sized according to the number of occurences in blog posts.
|
3
|
+
{% endcomment %}
|
4
|
+
|
5
|
+
{% comment %}
|
6
|
+
Create an empty array.
|
7
|
+
{% endcomment %}
|
8
|
+
{% assign tags = "" | split:"" %}
|
9
|
+
|
10
|
+
{% comment %}
|
11
|
+
Fill the tags-array with tag-names.
|
12
|
+
The push-filter is a Jekyll specific filter.
|
13
|
+
{% endcomment %}
|
14
|
+
{% for tag in site.tags %}
|
15
|
+
{% assign tags = tags | push: tag.first %}
|
16
|
+
{% endfor %}
|
17
|
+
|
18
|
+
{% comment %}
|
19
|
+
Sort the tag-array case-insensitive.
|
20
|
+
{% endcomment %}
|
21
|
+
{% assign tags_sorted = tags | sort_natural %}
|
22
|
+
|
23
|
+
{% comment %}
|
24
|
+
Requirements:
|
25
|
+
- The tag with the most posts should always be displayed at 250%
|
26
|
+
- The tag with the fewest posts (this can also be more than 1!) always with 100%.
|
27
|
+
- All gradations in between should be distributed linearly.
|
28
|
+
|
29
|
+
Determine minimum an maximum value.
|
30
|
+
Assumption: Non of the tags occurs more than one million times.
|
31
|
+
|
32
|
+
{% endcomment %}
|
33
|
+
{% assign min = 1000000 %}
|
34
|
+
{% assign max = 0 %}
|
35
|
+
|
36
|
+
{% for tag in tags_sorted %}
|
37
|
+
{% assign postsWithThisTag = site.tags[tag] | size %}
|
38
|
+
{% if postsWithThisTag > max %}
|
39
|
+
{% assign max = postsWithThisTag %}
|
40
|
+
{% endif %}
|
41
|
+
{% if postsWithThisTag < min %}
|
42
|
+
{% assign min = postsWithThisTag %}
|
43
|
+
{% endif %}
|
44
|
+
{% endfor %}
|
45
|
+
|
46
|
+
{% assign sizeDifference = 150 %}
|
47
|
+
{% assign steps = max | minus: min %}
|
48
|
+
|
49
|
+
<ul class="tag-cloud list-unstyled">
|
50
|
+
|
51
|
+
{% for tag in tags_sorted %}
|
52
|
+
<li>
|
53
|
+
{% comment %}
|
54
|
+
The size difference should be 150%.
|
55
|
+
The rarest tag should be displayed in 100%, the most frequent should be 250%.
|
56
|
+
100 + (aktZahl - min) * (250 / (max -min))
|
57
|
+
|
58
|
+
100: Minimum size
|
59
|
+
(aktZahl - min): Distance from the current value to the smallest value
|
60
|
+
(150 / (max -min)): Size difference in measures of the number of steps between the largest and the smallest value.
|
61
|
+
|
62
|
+
https://shopify.github.io/liquid/filters/divided_by/
|
63
|
+
To be on the safe side, create a float (times: 1.0)
|
64
|
+
{% endcomment %}
|
65
|
+
|
66
|
+
{% assign number = site.tags[tag] | size %}
|
67
|
+
{% assign percent = number | times: 1.0 | minus: min | times: sizeDifference | divided_by: steps | plus: 100 %}
|
68
|
+
{% assign tagname = tag | replace:'-', ' ' %}
|
69
|
+
|
70
|
+
<a
|
71
|
+
href = "/{{ site.tag_dir | default: 'tags' }}/{{ tag }}"
|
72
|
+
style = "font-size: {{ percent }}%"
|
73
|
+
title = "Number of posts with the tag '{{ tagname }}': {{ number }}"
|
74
|
+
>{{ tagname }}</a>
|
75
|
+
</li>
|
76
|
+
{% endfor %}
|
77
|
+
</ul>
|
data/_layouts/default.html
CHANGED
@@ -53,7 +53,23 @@ layout: html
|
|
53
53
|
<!-- Page content -->
|
54
54
|
<main class="container pt-4 pb-5" style="flex-grow: 1;" aria-label="Content">
|
55
55
|
|
56
|
-
|
56
|
+
<div class="row">
|
57
|
+
|
58
|
+
<div class="col-lg-8">
|
59
|
+
{{ content }}
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div class="col-lg-4">
|
63
|
+
<aside>
|
64
|
+
<h3>Blog Navigation</h3>
|
65
|
+
|
66
|
+
<!-- Tag-cloud -->
|
67
|
+
{% include function_tag-cloud.html %}
|
68
|
+
|
69
|
+
</aside>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
</div>
|
57
73
|
|
58
74
|
</main>
|
59
75
|
|
data/_layouts/html.html
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
<meta charset="utf-8">
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
10
10
|
<title>
|
11
|
-
{{ page.title }}
|
11
|
+
{{ page.title | default: page.menu_label | strip_html }}
|
12
12
|
</title>
|
13
13
|
|
14
14
|
<!-- Font-awesome CSS: https://www.bootstrapcdn.com/fontawesome/ -->
|
data/_layouts/page-postlist.html
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
menu_position: -10
|
4
|
+
---
|
5
|
+
{% comment %}
|
6
|
+
page.tag and page.title are set by the plugin `generate-taglist`.
|
7
|
+
{% endcomment %}
|
8
|
+
{% if page.title %}
|
9
|
+
<h1>{{ page.title }}</h1>
|
10
|
+
{% endif %}
|
11
|
+
|
12
|
+
<ul>
|
13
|
+
{% for post in site.tags[ page.tag ] %}
|
14
|
+
|
15
|
+
<li>
|
16
|
+
{{ post.date | date: "%Y-%m-%d" }}: <a href="{{ post.url }}">{{ post.title }}</a>
|
17
|
+
</li>
|
18
|
+
|
19
|
+
{% endfor %}
|
20
|
+
</ul>
|
21
|
+
|
22
|
+
|
data/_sass/address.scss
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Tag cloud.
|
3
|
+
*/
|
4
|
+
.tag-cloud {
|
5
|
+
text-align: center;
|
6
|
+
|
7
|
+
li {
|
8
|
+
display: inline;
|
9
|
+
}
|
10
|
+
/* Every tag in the tag cloud should have a point as a separator. */
|
11
|
+
li::after {
|
12
|
+
content: "·";
|
13
|
+
}
|
14
|
+
/* The last entry in the tag cloud should not have a point. */
|
15
|
+
li:last-child::after {
|
16
|
+
content: "";
|
17
|
+
}
|
18
|
+
}
|
data/assets/css/main.scss
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Generator
|
2
|
+
|
3
|
+
# Generates a page for each tag listed in `site.tags`.
|
4
|
+
# The files created are by default named `tags/<tagname>/index.html`.
|
5
|
+
# The content is generated using the layout file `_layouts/page-tag.html`
|
6
|
+
|
7
|
+
# The following values can be set in `_config.yml`
|
8
|
+
# `tag_dir`
|
9
|
+
# * the name of the directory in which the files for each tag are created;
|
10
|
+
# * default: `tags`
|
11
|
+
# `tag_title_prefix`
|
12
|
+
# * Prefix to be used for the title of the page
|
13
|
+
# * default: `Tag: `
|
14
|
+
|
15
|
+
# Necessary files:
|
16
|
+
# `_layouts/page-tag.html` - used to generate content of tag files.
|
17
|
+
|
18
|
+
# The following values are made available in the layout:
|
19
|
+
# * `page.tag` - contains the tag
|
20
|
+
# * `page.title` - contains the generated title, e.g. "Tag: <tagname>"
|
21
|
+
|
22
|
+
# NOTE: after changes to the plugin, `jekyll serve` must be started again.
|
23
|
+
|
24
|
+
# See also: https://jekyllrb.com/docs/plugins/
|
25
|
+
# See also: https://jekyllrb.com/docs/plugins/generators/
|
26
|
+
|
27
|
+
module Jekyll
|
28
|
+
|
29
|
+
module Endless
|
30
|
+
|
31
|
+
# TagPageGenerator is a subclass of Generator
|
32
|
+
class TagPageGenerator < Generator
|
33
|
+
safe true
|
34
|
+
# A Generator needs to implement the generate method
|
35
|
+
def generate(site)
|
36
|
+
# If a layout with the name `page-tag` exists
|
37
|
+
if site.layouts.key? 'page-tag'
|
38
|
+
# The directory in which the files are to be created is configured in `site.tag_dir`.
|
39
|
+
# If not, the directory `tags/` is used.
|
40
|
+
dir = site.config['tag_dir'] || 'tags'
|
41
|
+
|
42
|
+
# For each tag in the tag-list:
|
43
|
+
site.tags.each_key do |tag|
|
44
|
+
# Create a page-object using TagPage and add it to the `site.pages` array
|
45
|
+
site.pages << TagPage.new(site, site.source, File.join(dir, tag), tag)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# TagPage is a subclass of Page
|
53
|
+
# It is used in the `TagPageGenerator`
|
54
|
+
class TagPage < Page
|
55
|
+
def initialize(site, base, dir, tag)
|
56
|
+
# Define instance variables ('@') to make values available in the super-class `Page`.
|
57
|
+
# The variables are available in the layout as e.g. `page.name`.
|
58
|
+
@site = site
|
59
|
+
@base = base
|
60
|
+
@dir = dir
|
61
|
+
@name = 'index.html'
|
62
|
+
|
63
|
+
self.process(@name)
|
64
|
+
self.read_yaml(File.join(base, '_layouts'), 'page-tag.html')
|
65
|
+
|
66
|
+
# The prefix for the generated title is set via `tag_title_prefix` in `_config.yml` and defaults to `Tag: `
|
67
|
+
tag_title_prefix = site.config['tag_title_prefix'] || 'Tag: '
|
68
|
+
# Generates the title for the tag page and makes it available in the layout file as `page.title`
|
69
|
+
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
70
|
+
# Makes `page.tag` available in the layout file
|
71
|
+
self.data['tag'] = tag
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-endless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Boekhoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -37,15 +37,21 @@ files:
|
|
37
37
|
- _includes/content_footer-usernames.html
|
38
38
|
- _includes/function_list-pages.html
|
39
39
|
- _includes/function_list-posts.html
|
40
|
+
- _includes/function_tag-cloud.html
|
40
41
|
- _layouts/default.html
|
41
42
|
- _layouts/html.html
|
42
43
|
- _layouts/page-postlist.html
|
44
|
+
- _layouts/page-tag.html
|
43
45
|
- _layouts/page.html
|
44
46
|
- _layouts/post.html
|
47
|
+
- _sass/address.scss
|
45
48
|
- _sass/background.scss
|
46
|
-
- _sass/
|
49
|
+
- _sass/tag-cloud.scss
|
47
50
|
- _sass/user.scss
|
48
51
|
- assets/css/main.scss
|
52
|
+
- lib/jekyll-theme-endless.rb
|
53
|
+
- lib/jekyll-theme-endless/generate-tagpages.rb
|
54
|
+
- lib/jekyll-theme-endless/version.rb
|
49
55
|
homepage: https://gitlab.com/jekyll-theme-endless/jekyll-theme-endless.gitlab.io
|
50
56
|
licenses:
|
51
57
|
- MIT
|