错误 运行 Jekyll with --safe: Liquid Exception: undefined method `map' for "/portfolio":String

Error running Jekyll with --safe: Liquid Exception: undefined method `map' for "/portfolio":String

我目前正在将 Jekyll 博客迁移到新主题,现在 运行 在将我的网站推到 GitHub 页和 运行 Jekyll 时遇到问题带有 --safe 标志的站点。

现在,Jekyll 站点在本地运行得非常好,但我在推送到 GitHub 页时开始遇到问题。

作为调试措施,我阅读以确保 Jekyll 站点运行时没有 --safe 标志的问题,但它没有。

但是,我不确定这里的问题是什么。这是我的输出 运行 它与 bundle exec jekyll serve --safe --trace --verbose:

         Rendering: portfolio/index.md
  Pre-Render Hooks: portfolio/index.md
  Rendering Markup: portfolio/index.md
  Rendering Layout: portfolio/index.md
     Layout source: site
  Liquid Exception: undefined method `map' for "/portfolio":String Did you mean? tap in /_layouts/portfolio.html
/Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/filters.rb:303:in `sort_input': undefined method `map' for "/portfolio":String (NoMethodError)
Did you mean?  tap
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/filters.rb:243:in `sort'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/strainer.rb:56:in `invoke'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/context.rb:86:in `invoke'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/variable.rb:84:in `block in render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `each'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `inject'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/tags/assign.rb:26:in `render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/block_body.rb:91:in `render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/liquid_renderer/file.rb:30:in `block (2 levels) in render!'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/liquid_renderer/file.rb:42:in `measure_bytes'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/liquid_renderer/file.rb:29:in `block in render!'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/liquid_renderer/file.rb:49:in `measure_time'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/liquid_renderer/file.rb:28:in `render!'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/renderer.rb:126:in `render_liquid'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/renderer.rb:195:in `render_layout'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/renderer.rb:158:in `place_in_layouts'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/renderer.rb:88:in `render_document'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/renderer.rb:62:in `run'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:479:in `render_regenerated'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:472:in `block in render_pages'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:471:in `each'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:471:in `render_pages'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:192:in `render'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/site.rb:71:in `process'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/command.rb:28:in `process_site'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:65:in `build'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:36:in `process'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `block in start'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `each'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `start'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/gems/jekyll-3.8.7/exe/jekyll:15:in `<top (required)>'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/bin/jekyll:23:in `load'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/bin/jekyll:23:in `<main>'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/bin/ruby_executable_hooks:24:in `eval'
    from /Users/adammorgan/.rvm/gems/ruby-2.4.9/bin/ruby_executable_hooks:24:in `<main>'

阅读该跟踪,我知道问题正在发生 here but I'm not exactly sure how to fix this? (repo link)

有什么想法吗?

我终于成功了,但我采用了不同的方法而不是解决 --safe 标志问题。

相反,我现在有两个分支。一个用于本地的普通 Jekyll 开发,另一个用于推送到 GitHub 页面(仅 _site 目录)。

概述了整个过程