jekyll-theme-endless 0.2.0 → 0.3.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: 957d3391d580b9bd3160aecdae5ef1d1fc753a89f064d041e63daba2a56187dd
4
- data.tar.gz: 905d9b727e40b1854c91b5f271eb1a04931ece3a48feae7c1c29a4125ae7733c
3
+ metadata.gz: 9383008f153eb0b678be801500b2a806d5d384a77e643a8af2bb131944b62a3f
4
+ data.tar.gz: 5364902b367bb5752fa6e751a9e82a544e6b83516573ae6ee5d4594b437527b8
5
5
  SHA512:
6
- metadata.gz: 505742088ffb87869f12dd0390021ae8dec70baf8627037717eeb2246d43cfa98f30e2ad1a1cbd58db6a4e8a6daaa02e9406914bc66a3b5f95b41368f55dcadd
7
- data.tar.gz: 1fb13f4ffead3fc1a25ebe7cb98614c17c43f729397b634b746be19adab1cb114034a1dd21fd454523c5710e9a81881dc35beb1962704b957542495f4899e4d5
6
+ metadata.gz: e4970875e16f5f5257fcc4defe679de7ce4452b7e4e5eac1f0d115926d32738edd95613f8af50e51cb1c063faf2dfe5ef34ac8abcdc65b4493e825da2a29291e
7
+ data.tar.gz: 926e1e3779d2799122fddc966d0110a42fd4d6d873a89749f32420e0e73ebc565a27510250d0ce5eb64aa235cf7eb8402df07ad37402361c9f5f8c1011154c1a
@@ -1,6 +1,13 @@
1
1
  = jekyll-theme-endless
2
+ :page-menu_label: Documentation
3
+ :page-menu_position: 300
2
4
 
3
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
4
11
 
5
12
  == Installation
6
13
 
@@ -120,6 +127,10 @@ Content
120
127
  `_layouts/page-postlist.html`::
121
128
  Layout of page-content with a list of blog posts at the end.
122
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
+
123
134
  `_layouts/post.html`::
124
135
  Layout of blog-posts.
125
136
 
@@ -171,6 +182,9 @@ This can be useful for your 404 page, which should be generated by Jekyll, but n
171
182
  Generates the code containing links to each blog-post.
172
183
  The text of the link is the title of the post.
173
184
 
185
+ `_includes/function_tag-cloud.html`::
186
+ Generates a tag cloud.
187
+
174
188
  `_includes/content_footer-usernames.html`::
175
189
  Creates a list of contact options based on provided usernames and addresses.
176
190
  The entries are preceded with the icons of (e.g.) the social network and are linked to the corresponding profile.
@@ -188,6 +202,29 @@ username_linkedin: XXXX
188
202
 
189
203
 
190
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
+
191
228
  === Styles
192
229
 
193
230
  In order to contribute SCSS-code, simply add a file `_sass/user.scss`, containing your SCCS-code.
@@ -223,9 +260,14 @@ To set up your environment to develop this theme:
223
260
  . clone this repository
224
261
  . run `bundle install`
225
262
 
226
- Your theme is setup just like a normal Jekyll site!
227
- To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`.
263
+ The theme is setup just like a normal Jekyll site!
264
+ To test the theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`.
228
265
  This starts a Jekyll server using your theme.
266
+ To test the theme *with example-data*, run `bundle exec jekyll serve --config _config.yml,_data.yml`.
267
+ Values for theme specific configurations are stored in `_data.yml` and not in the themes `_config.yml`.
268
+ Since the `_config.yml` is shipped with the gem,
269
+ the users of your theme would otherwise have to unset the values in their own `config.yml`.
270
+
229
271
  Add pages, documents, data, etc. like normal to test your theme's contents.
230
272
  As you make modifications to your theme and to your content, your site will regenerate and
231
273
  you should see the changes in the browser after a refresh, just like normal.
@@ -22,37 +22,10 @@ baseurl: "" # the subpath of your site, e.g. /blog
22
22
  url: "" # the base hostname & protocol for your site, e.g. http://example.com
23
23
 
24
24
 
25
- # Theme specific settings
26
- # Language. Is overriden by value of page.lang.
27
- lang: en
28
- # Brand is not escaped in the layout.
29
- # Thus, HTML-commands can be used.
30
- brand: '"<i>endless</i>"-Theme'
31
-
32
- # Title and subtile of the page
33
- title: jekyll-theme-endless
34
- subtitle: A Jekyll theme ready for AsciiDoc
35
-
36
- author: Sven Boekhoff
37
- copydate: 2020
38
- disclaimer: >- # this means to ignore newlines until the next entry
39
- I'm creating this Jekyll theme because I want to use it myself.
40
- Therefore, many things (e.g. the support of AsciiDoc) are based on personal requirements.
41
- You are welcome to use the theme (at your own risk) and contribute to the development.
42
-
43
- # eMail address
44
- email: your-email@example.com
45
- # Username on https://gitlab.com/
46
- username_gitlab: XXXX
47
- # Username on https://github.com/
48
- username_github: XXXX
49
- # Username on https://www.xing.com/
50
- username_xing: XXXX
51
- # Username on https://linkedin.com/
52
- username_linkedin: XXXX
53
-
54
-
55
25
 
26
+ # Theme specific settings
27
+ # Find example data in _data.yml of the theme repository.
28
+ # Run `bundle exec jekyll serve --config _config.yml,_data.yml`
56
29
 
57
30
 
58
31
  # Build settings
@@ -71,7 +44,6 @@ username_linkedin: XXXX
71
44
  exclude:
72
45
  - '*.gemspec'
73
46
  - LICENSE.txt
74
- - README.adoc
75
47
  # - .sass-cache/
76
48
  # - .jekyll-cache/
77
49
  # - gemfiles/
@@ -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>
@@ -8,7 +8,9 @@ layout: html
8
8
  <div class="container">
9
9
 
10
10
  <!-- Brand Icon -->
11
+ {% if site.brand %}
11
12
  <a class="navbar-brand" href="{{ "/" | relative_url}}">{{ site.brand }}</a>
13
+ {% endif %}
12
14
 
13
15
  <!-- Burger menu -->
14
16
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
@@ -51,7 +53,23 @@ layout: html
51
53
  <!-- Page content -->
52
54
  <main class="container pt-4 pb-5" style="flex-grow: 1;" aria-label="Content">
53
55
 
54
- {{ content }}
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>
55
73
 
56
74
  </main>
57
75
 
@@ -79,9 +97,11 @@ layout: html
79
97
 
80
98
  <div class="col-md-3 text-left py-3">
81
99
  <h4>Note:</h4>
100
+ {% if site.copydate and site.author %}
82
101
  <p>
83
102
  &copy; {{ site.copydate }} by <em>{{ site.author }}</em>
84
103
  </p>
104
+ {% endif %}
85
105
  <p>
86
106
  Powered by <a href="https://jekyll-theme-endless.gitlab.io/">jekyll-theme-endless</a>.
87
107
  </p>
@@ -1,5 +1,5 @@
1
1
  ---
2
- # Regular page with list of blog posts attached to the end of the content.
2
+ # Regular page with a list of blog posts attached to the end of the content.
3
3
  layout: page
4
4
  ---
5
5
  {{ content }}
@@ -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
+
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Address bar in the footer.
3
+ */
4
+ address {
5
+ li {
6
+ i {
7
+ display: inline-block;
8
+ padding: 2px 0;
9
+ margin: 2px 0;
10
+ vertical-align: top;
11
+ // Icons should take the same space;
12
+ min-width: 20px;
13
+ }
14
+ }
15
+ }
@@ -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
+ }
@@ -8,7 +8,8 @@
8
8
  * imports _scss/icons.scss
9
9
  */
10
10
  @import "background";
11
- @import "icons";
11
+ @import "address";
12
+ @import "tag-cloud";
12
13
 
13
14
  /*
14
15
  * import SCSS-Code contributed by the user of the theme.
@@ -0,0 +1,8 @@
1
+ module Jekyll
2
+ module Endless
3
+
4
+ end
5
+ end
6
+
7
+ require_relative 'jekyll-theme-endless/generate-tagpages'
8
+
@@ -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
+
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Endless
3
+ VERSION = '0.3.3'
4
+ end
5
+ end
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.2.0
4
+ version: 0.3.3
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-19 00:00:00.000000000 Z
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/icons.scss
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
@@ -1,12 +0,0 @@
1
-
2
- /**
3
- * Icons in the adress bar should take the same space;
4
- */
5
- address li i {
6
- display: inline-block;
7
- padding: 2px 0;
8
- margin: 2px 0;
9
- vertical-align: top;
10
- min-width: 15px;
11
- }
12
-