From cef66defbd1c6d2a3e49272a5a2d6a0a86738bb9 Mon Sep 17 00:00:00 2001 From: ashmaroli Date: Tue, 20 Feb 2018 20:12:45 +0530 Subject: [PATCH] Allow Jekyll Doctor to detect stray posts dir (#6681) Merge pull request 6681 --- lib/jekyll/commands/doctor.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index 960ee9f9..392a51fe 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -41,9 +41,22 @@ module Jekyll !conflicting_urls(site), !urls_only_differ_by_case(site), proper_site_url?(site), + properly_gathered_posts?(site), ].all? end + def properly_gathered_posts?(site) + return true if site.config["collections_dir"].empty? + posts_at_root = site.in_source_dir("_posts") + return true unless File.directory?(posts_at_root) + Jekyll.logger.warn "Warning:", + "Detected '_posts' directory outside custom `collections_dir`!" + Jekyll.logger.warn "", + "Please move '#{posts_at_root}' into the custom directory at " \ + "'#{site.in_source_dir(site.config["collections_dir"])}'" + false + end + def deprecated_relative_permalinks(site) if site.config["relative_permalinks"] Jekyll::Deprecator.deprecation_message "Your site still uses relative" \