More ignores

This commit is contained in:
Ben Hollis 2014-05-30 22:22:24 -07:00
parent 0309753561
commit 5760d64ef9
2 changed files with 10 additions and 2 deletions

View file

@ -52,6 +52,9 @@ module Middleman::CoreExtensions
resource.add_metadata options: opts, page: fmdata
# TODO: resource.ignore! if ignored
# TODO: This doesn't really work because resources can't themselves be ignored / when
# an ignore rule is in place it's forever
resource.ignore! if ignored == true && !resource.proxy?
# TODO: Save new template here somewhere?
end

View file

@ -48,11 +48,16 @@ module Middleman
# Helpers methods for Resources
module IgnoreResourceInstanceMethods
# Ignore a resource directly, without going through the whole
# ignore filter stuff.
def ignore!
@ignored = true
end
# Whether the Resource is ignored
# @return [Boolean]
def ignored?
# Check frontmatter/data
return true if !proxy? && data[:ignored] == true
return true if @ignored
# Ignore based on the source path (without template extensions)
return true if @app.sitemap.ignored?(path)
# This allows files to be ignored by their source file name (with template extensions)