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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/filters/menu.rb +11 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5821ac5773831bb4da8ff820a9e37e52cbdda1eb6d4d02394806b3553521d199
4
- data.tar.gz: 28fc6cadd2764f2c13d25a80464b2431b68c4bcb439dd8955b34fd7186943832
3
+ metadata.gz: d90e4da9fe0d1b7d177e20fd9a05f825a07d3465d99b1641d79b75879d526c00
4
+ data.tar.gz: f467555d544fca178ba15dce7f1de53eadfcbea7a263fe91f9a6066ac92664d2
5
5
  SHA512:
6
- metadata.gz: 6f03097086f1ec6790b5476d0e138aaae5719968e5967e33481d6995ac3abac78f3ed5f7ce29822f5622ae8d00e66296d52ffecfda696a9b619efebc205f6214
7
- data.tar.gz: 6c21db3c81ace646f82c244579f5452cdd18cb88ceb16ce9676d2026b3df85c24b41b4dc1d1834eea007feccb1208d0532c071806ec38c645b8858b90fc822e4
6
+ metadata.gz: 94b85e20c7c10e267e67534ab215d94539b482cc807ff7623f03d8f281463df12395cde294d00814b0b8db04897dfde6cbe0880d882982459050f7d8f53e28eb
7
+ data.tar.gz: 1dd71eb67a50c79a1f796ff0813968f2275e7b3fd56afe5f45234a2efc5244bb87c0da10fc90fb417547d64f72a3dbc534efa09c772dfe95eae063def69a2dd0
@@ -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.0
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-10-08 00:00:00.000000000 Z
11
+ date: 2020-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll