jekyll-linked-posts 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +26 -0
- data/lib/jekyll-linked-posts.rb +1 -0
- data/lib/jekyll/filters/breadcrumbs.rb +28 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 567b5bf4cd5fbc9ed6b521ed1a76d6b609ac4bdd0d5e61b01f963ffe81ec6229
|
4
|
+
data.tar.gz: 9fbca911800e53b4259be09b74d82c8d96e8e59c555a276b774310bf4b90cab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d52bf528f5ad92507d44c698321e95cdfc7b1bd6506b5c618f6f4aafea9e97d2fdf76b56b0288653e4eeb1611b5541a19f22f4c776cafd78b82143d24cc46ae
|
7
|
+
data.tar.gz: f1ecddd44fcc19576bbc58382df7371587ab3bcd60bb4c5b3ff74fc26c0a7af48d574324714633a24f13bf5310359ea76f27780c17121d8dd11997a4dea55ef9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -90,6 +90,29 @@ them with other fields, re-add them to the configuration.
|
|
90
90
|
|
91
91
|
It also works between collections!
|
92
92
|
|
93
|
+
## Breadcrumbs
|
94
|
+
|
95
|
+
If you're linking articles by the same field, you can create
|
96
|
+
a breadcrumb like this:
|
97
|
+
|
98
|
+
```html
|
99
|
+
{%- assign breadcrumbs = page | breadcrumbs: 'previous' -%}
|
100
|
+
|
101
|
+
<nav aria-label="Breadcrumbs">
|
102
|
+
<ol class="breadcrumb">
|
103
|
+
{% for crumb in breadcrumbs %}
|
104
|
+
{% if forloop.last %}
|
105
|
+
<li class="breadcrumb-item active" aria-current="page">{{ crumb.title }}</li>
|
106
|
+
{% else %}
|
107
|
+
<li class="breadcrumb-item">
|
108
|
+
<a href="{{ crumb.url }}">{{ crumb.title }}</a>
|
109
|
+
</li>
|
110
|
+
{% endif %}
|
111
|
+
{% endfor %}
|
112
|
+
</ol>
|
113
|
+
</nav>
|
114
|
+
```
|
115
|
+
|
93
116
|
## Contributing
|
94
117
|
|
95
118
|
Bug reports and pull requests are welcome on 0xacab.org at
|
@@ -98,6 +121,9 @@ intended to be a safe, welcoming space for collaboration, and
|
|
98
121
|
contributors are expected to adhere to the [Sutty code of
|
99
122
|
conduct](https://sutty.nl/en/code-of-conduct/).
|
100
123
|
|
124
|
+
If you like our plugins, [please consider
|
125
|
+
donating](https://donaciones.sutty.nl/en/)!
|
126
|
+
|
101
127
|
## License
|
102
128
|
|
103
129
|
The gem is available as free software under the terms of the GPL3
|
data/lib/jekyll-linked-posts.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Filters
|
5
|
+
module Breadcrumbs
|
6
|
+
# The breadcrumbs filter returns an Array of Jekyll::Documents
|
7
|
+
# that are linked recursively by the same field.
|
8
|
+
#
|
9
|
+
# @param [Jekyll::Document]
|
10
|
+
# @param [String]
|
11
|
+
# @return [Array]
|
12
|
+
def breadcrumbs(input, field)
|
13
|
+
return unless input.respond_to? :[]
|
14
|
+
|
15
|
+
crumbs = [ input ]
|
16
|
+
prev = input
|
17
|
+
|
18
|
+
while prev&.public_send(:[], field)
|
19
|
+
crumbs << (prev = prev[field])
|
20
|
+
end
|
21
|
+
|
22
|
+
crumbs.reverse
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Liquid::Template.register_filter(Jekyll::Filters::Breadcrumbs)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-linked-posts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- LICENSE.txt
|
39
39
|
- README.md
|
40
40
|
- lib/jekyll-linked-posts.rb
|
41
|
+
- lib/jekyll/filters/breadcrumbs.rb
|
41
42
|
- lib/jekyll/linked_posts.rb
|
42
43
|
homepage: https://0xacab.org/sutty/jekyll/jekyll-linked-posts
|
43
44
|
licenses:
|
@@ -48,7 +49,7 @@ metadata:
|
|
48
49
|
source_code_uri: https://0xacab.org/sutty/jekyll/jekyll-linked-posts
|
49
50
|
changelog_uri: https://0xacab.org/sutty/jekyll/jekyll-linked-posts/-/blob/master/CHANGELOG.md
|
50
51
|
documentation_uri: https://rubydoc.info/gems/jekyll-linked-posts
|
51
|
-
post_install_message:
|
52
|
+
post_install_message:
|
52
53
|
rdoc_options:
|
53
54
|
- "--title"
|
54
55
|
- jekyll-linked-posts - Adds linked posts to Jekyll
|
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
74
|
rubygems_version: 3.0.3
|
74
|
-
signing_key:
|
75
|
+
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: Adds linked posts to Jekyll
|
77
78
|
test_files: []
|