diff --git a/lib/jekyll-pandoc-multiple-formats/generator.rb b/lib/jekyll-pandoc-multiple-formats/generator.rb index 5a57b2c..a8174ea 100644 --- a/lib/jekyll-pandoc-multiple-formats/generator.rb +++ b/lib/jekyll-pandoc-multiple-formats/generator.rb @@ -50,6 +50,13 @@ def generate(site) @site.post_attr_hash('categories').each_pair do |title, posts| posts.sort! pandoc_file = PandocFile.new(@site, output, posts, title) + + if @site.keep_files.include? pandoc_file.relative_path + puts "#{pandoc_file.relative_path} is a category file AND a post file" + puts 'change the category name to fix this' + next + end + next unless pandoc_file.write @site.keep_files << pandoc_file.relative_path diff --git a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb index a145c20..14b698f 100644 --- a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb +++ b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb @@ -41,12 +41,12 @@ def initialize(site, format, posts, title = nil) raise ArgumentError.new "'title' argument is required for multipost file" unless title @title = title - @slug = Utils.slugify(title) else @posts = [posts] - @slug = posts.data['slug'] @title = posts.data['title'] unless title end + + @slug = Utils.slugify(title) end def path