From f2263a11b73091f0b94b8c6fe6f467e0a96b2d3d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Apr 2016 11:49:24 -0700 Subject: [PATCH] Only write collections.posts.permalink if permalink is set. --- lib/jekyll/configuration.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 87bfeb46..5b5bb2df 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -72,7 +72,7 @@ module Jekyll 'hard_wrap' => false, 'footnote_nr' => 1 } - }] + }].freeze # Public: Turn all keys into string # @@ -271,14 +271,20 @@ module Jekyll def add_default_collections config = clone + # It defaults to `{}`, so this is only if someone sets it to null manually. return config if config['collections'].nil? + # Ensure we have a hash. if config['collections'].is_a?(Array) config['collections'] = Hash[config['collections'].map { |c| [c, {}] }] end + + # Add posts. config['collections']['posts'] ||= {} config['collections']['posts']['output'] = true - config['collections']['posts']['permalink'] = style_to_permalink(config['permalink']) + if config['permalink'] + config['collections']['posts']['permalink'] ||= style_to_permalink(config['permalink']) + end config end