1
votes

I'm trying to build a personal website using Jekyll. I chose Jekyll by following the extensive tutorial from Learn Enough CSS & Layout to be Dangerous by Michael Hartl.

I'm trying to show a selection of blog posts on my home page.

My _posts folder is in the root directory, the filenames are in the correct DD-MM-YYYY-title.md format and the dates occur in the past.

I outputted site.posts using

{{ site.posts.size }}
{{ site.posts | inspect }}

They output "0" and "[]", so it looks like the array is empty.

The repo is available here: https://github.com/jpallard6120/jpallard6120.github.io

Help is much appreciated!

1

1 Answers

0
votes

After some more debugging, it seems there was a conflict with the kramdown gem module. I saw the error after commenting out the "collections_dir" line from _config.yaml, following an idea from another SO post. It gave me this error when trying to generate:

  Rendering Markup: _posts/2019-06-01-post1.md
/usr/lib/ruby/vendor_ruby/kramdown/options.rb:36: warning: already initialized constant Kramdown::Options::Definition
/var/lib/gems/2.7.0/gems/kramdown-2.3.0/lib/kramdown/options.rb:36: warning: previous definition of Definition was here
/usr/lib/ruby/vendor_ruby/kramdown/options.rb:39: warning: already initialized constant Kramdown::Options::ALLOWED_TYPES
/var/lib/gems/2.7.0/gems/kramdown-2.3.0/lib/kramdown/options.rb:39: warning: previous definition of ALLOWED_TYPES was here
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2019-06-01-post1.md':
                    Option name hard_wrap is already used
                    ------------------------------------------------
      Jekyll 4.1.1   Please append `--trace` to the `serve` command 
                     for any additional information or backtrace. 
                    ------------------------------------------------
Traceback (most recent call last):
        44: from /usr/local/bin/jekyll:23:in `<main>'
        43: from /usr/local/bin/jekyll:23:in `load'
        42: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/exe/jekyll:15:in `<top (required)>'
        41: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        40: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        39: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        38: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        37: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        36: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        35: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        34: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `each'
        33: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        32: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:36:in `process'
        31: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:65:in `build'
        30: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:28:in `process_site'
        29: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:80:in `process'
        28: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:207:in `render'
        27: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `render_docs'
        26: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `each_value'
        25: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `block in render_docs'
        24: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `each'
        23: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:517:in `block (2 levels) in render_docs'
        22: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:532:in `render_regenerated'
        21: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:63:in `run'
        20: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:84:in `render_document'
        19: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `convert'
        18: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `reduce'
        17: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `each'
        16: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:102:in `block in convert'
        15: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:84:in `convert'
        14: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:15:in `setup'
        13: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:37:in `get_processor'
        12: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:37:in `new'
        11: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown/kramdown_parser.rb:89:in `initialize'
        10: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown/kramdown_parser.rb:122:in `load_dependencies'
         9: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
         8: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
         7: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown-parser-gfm.rb:10:in `<top (required)>'
         6: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown-parser-gfm.rb:10:in `require_relative'
         5: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm.rb:13:in `<top (required)>'
         4: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm.rb:13:in `require_relative'
         3: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:10:in `<top (required)>'
         2: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:11:in `<module:Kramdown>'
         1: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:13:in `<module:Options>'
/usr/lib/ruby/vendor_ruby/kramdown/options.rb:52:in `define': Option name hard_wrap is already used (ArgumentError)

So I uninstalled and re-installed Ruby & Jekyll, and leaving the "collections_dir" line commented out in _config.yaml. The posts are now being generated.