sutty-liquid 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/filters/menu.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d90e4da9fe0d1b7d177e20fd9a05f825a07d3465d99b1641d79b75879d526c00
|
4
|
+
data.tar.gz: f467555d544fca178ba15dce7f1de53eadfcbea7a263fe91f9a6066ac92664d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b85e20c7c10e267e67534ab215d94539b482cc807ff7623f03d8f281463df12395cde294d00814b0b8db04897dfde6cbe0880d882982459050f7d8f53e28eb
|
7
|
+
data.tar.gz: 1dd71eb67a50c79a1f796ff0813968f2275e7b3fd56afe5f45234a2efc5244bb87c0da10fc90fb417547d64f72a3dbc534efa09c772dfe95eae063def69a2dd0
|
data/lib/jekyll/filters/menu.rb
CHANGED
@@ -35,6 +35,17 @@ module Jekyll
|
|
35
35
|
def site_menu
|
36
36
|
site = @context.registers[:site]
|
37
37
|
@site_menu ||= site.data.dig(site.config['locale'], 'menu', 'items')&.reduce({}) do |menu, item|
|
38
|
+
# If the item has a layout, we pick the first post and update
|
39
|
+
# the href. We can't do the same for all posts because we
|
40
|
+
# wouldn't be able to cache the menu.
|
41
|
+
if item['layout']
|
42
|
+
doc = site.documents.find do |doc|
|
43
|
+
doc.data['layout'] == item['layout']
|
44
|
+
end
|
45
|
+
|
46
|
+
item['href'] = doc&.url
|
47
|
+
end
|
48
|
+
|
38
49
|
# Ignore empty or anchor items
|
39
50
|
next menu if item['href'].nil? || item['href'].empty? || item['href']&.start_with?('#')
|
40
51
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutty-liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|