jekyll/tagging使用時にエラー:block in new_tag: undefined method ext for nil:NilClassが出る

カテゴリ: 未分類

発生した現象

jekyllでタグを使いたくてjekyll/taggingを使おうと思った所、下記のblock in new_tagエラーが発生しサイトが生成されなかった

$ jekyll serve --trace

...
Traceback (most recent call last):
    25: from /usr/local/bundle/bin/jekyll:29:in `<main>'
    24: from /usr/local/bundle/bin/jekyll:29:in `load'
    23: from /usr/gem/gems/jekyll-4.1.0/exe/jekyll:15:in `<top (required)>'
    22: from /usr/gem/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    21: from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
    20: from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
    19: from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
    18: from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
    17: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
    16: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
    15: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/command.rb:91:in `each'
    14: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
    13: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/commands/build.rb:36:in `process'
    12: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/commands/build.rb:65:in `build'
    11: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/command.rb:28:in `process_site'
    10: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/site.rb:79:in `process'
     9: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/site.rb:189:in `generate'
     8: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/site.rb:189:in `each'
     7: from /usr/gem/gems/jekyll-4.1.0/lib/jekyll/site.rb:191:in `block in generate'
     6: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:35:in `generate'
     5: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:45:in `generate_tag_pages'
     4: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:45:in `each'
     3: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:45:in `block in generate_tag_pages'
     2: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:49:in `new_tag'
     1: from /usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:49:in `each'
/usr/gem/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:61:in `block in new_tag': undefined method `ext' for nil:NilClass (NoMethodError)

理由

_config.ymlに下記の定義を行っていた。

tag_page_layout: tag_page
tag_page_dir: tag

この場合、_layouts/tag_page.htmlを作成する必要があるが、誤ってsを飛ばしてしまい_layout/tag_page.htmlでファイルを作っていたため。

ファイル名を修正したら正しく動作した。

Amazonでポイントを賢くGETする方法
Amazonギフト券チャージ で最大2.5%もお得!
こちらもおススメ

コメントを残す

メールアドレスが公開されることはありません。