algolia / algolia/jekyll-algolia

undefined method `include?' for nil:NilClass

Open
#197 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
211
Forks
35
PR merge metrics
No merged PRs in 30d

Description

## I want to report a bug:

### What is the current behavior?

```
bundle exec jekyll algolia
Configuration file: /root/site/_config.yml
Processing site...
jekyll 4.3.1 | Error: undefined method `include?' for nil:NilClass

translate_posts = !site.config['exclude_from_localizations'].include?("_posts")
^^^^^^^^^
/root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-multiple-languages-plugin-1.8.0/lib/jekyll-multiple-languages-plugin.rb:251:in `read_posts': undefined method `include?' for nil:NilClass (NoMethodError)

translate_posts = !site.config['exclude_from_localizations'].include?("_posts")
^^^^^^^^^
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:91:in `retrieve_posts'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:76:in `read_directories'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:16:in `read'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:181:in `read'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/algolia/overwrites/jekyll-algolia-site.rb:23:in `process'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll-algolia.rb:82:in `run'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/commands/algolia.rb:38:in `block (2 levels) in init_with_program'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/exe/jekyll:15:in `'
from /root/3.1.2/bin/jekyll:25:in `load'
from /root/3.1.2/bin/jekyll:25:in `'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:48:in `block in '
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:36:in `'
from /root/3.1.2/bin/bundle:25:in `load'
from /root/3.1.2/bin/bundle:25:in `'
```

### What is your expected behavior?

I would expect it to create index the pages into algolia.

### Git repository to reproduce the issue:
https://github.com/hellotext/help

### Ruby version used:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

### Jekyll version used:
jekyll 4.3.1

Contributor guide

Open the contributing guide

Research direction

Start with jekyll-multiple-languages-plugin.rb:251, the call shown in the stack trace, and reproduce it with bundle exec jekyll algolia using the linked repository and its _config.yml. Done means the command completes indexing the pages into Algolia without the NoMethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
jekyll, ruby
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.