forestryio / jekyll-menus

A menus (site navigation) plugin for your Jekyll website that also works with https://forestry.io (Jekyll CMS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Front matter does not work on Ruby 3 as the fix is not live

alanrme opened this issue · comments

commented

Front matter menus display an error when used (wrong number of arguments (given 2, expected 1) (ArgumentError))
This fix in pull request #23 is not present when the plugin is downloaded through both bundle and gem. Once the file is updated manually the plugin functions as normal.

To reproduce

---
layout: default
title: Exploits
menus:
    header:
        identifier: exploits
---

Logs

C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:190:in `_fill_front_matter_menu': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:130:in `block in _front_matter_menu'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:110:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:110:in `_front_matter_menu'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:69:in `block (2 levels) in _page_menus'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:68:in `map'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:68:in `block in _page_menus'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:67:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:67:in `each_with_object'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:67:in `_page_menus'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:18:in `menus'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb:26:in `to_liquid_drop'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus/hook.rb:14:in `block in <top (required)>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/hooks.rb:103:in `block in trigger'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/hooks.rb:102:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/hooks.rb:102:in `trigger'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:208:in `render'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:80:in `process'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:28:in `process_site'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:65:in `build'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:36:in `process'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby31-x64/bin/jekyll:25:in `load'
        from C:/Ruby31-x64/bin/jekyll:25:in `<main>'

Solution

Manually replacing C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-menus-0.6.1/lib/jekyll/menus.rb with the updated file in pull request #23

commented

It should be noted that using gem "jekyll-menus", :git => "https://github.com/forestryio/jekyll-menus.git" in my gemfile has resolved this issue, even on GitHub pages. This should be added to the documentation if the changes cannot be made live.

It should be noted that using gem "jekyll-menus", :git => "https://github.com/forestryio/jekyll-menus.git" in my gemfile has resolved this issue, even on GitHub pages. This should be added to the documentation if the changes cannot be made live.

I tried making this change, my site now builds correctly, but the menu is no longer being generated. How are you referencing jekyll-menus in your config?

UPDATE:

Need to place the gem in the plugins section of the config file, like so:

source 'https://rubygems.org'
gem 'jekyll'
gem 'rdiscount'

group :jekyll_plugins do
  gem "jekyll-remote-theme"
  gem "github-pages"
  gem "jekyll-menus", :git => "https://github.com/forestryio/jekyll-menus.git"  # <---- IT GOES HERE
  gem "jekyll-relative-links"
  gem "jekyll-github-metadata"
end

gem "webrick", "~> 1.8"
                                                                                # <---- NOT DOWN HERE