Skip to content

Commit

Permalink
show a warning when a category and a post share the same file name
Browse files Browse the repository at this point in the history
  • Loading branch information
fauno committed Jan 10, 2017
1 parent e32877c commit d56cdba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/jekyll-pandoc-multiple-formats/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d56cdba

Please sign in to comment.