mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
make sure pages with published being false are not generated
This commit is contained in:
@@ -21,6 +21,11 @@ module Jekyll
|
||||
self.content || ''
|
||||
end
|
||||
|
||||
# Whether the file is published or not, as indicated in YAML front-matter
|
||||
def published?
|
||||
!(self.data.has_key?('published') && self.data['published'] == false)
|
||||
end
|
||||
|
||||
# Returns merged option hash for File.read of self.site (if exists)
|
||||
# and a given param
|
||||
def merged_file_read_opts(opts)
|
||||
|
||||
@@ -35,7 +35,7 @@ module Jekyll
|
||||
|
||||
attr_accessor :site
|
||||
attr_accessor :data, :extracted_excerpt, :content, :output, :ext
|
||||
attr_accessor :date, :slug, :published, :tags, :categories
|
||||
attr_accessor :date, :slug, :tags, :categories
|
||||
|
||||
attr_reader :name
|
||||
|
||||
@@ -60,20 +60,10 @@ module Jekyll
|
||||
self.date = Time.parse(self.data["date"].to_s)
|
||||
end
|
||||
|
||||
self.published = self.published?
|
||||
|
||||
self.populate_categories
|
||||
self.populate_tags
|
||||
end
|
||||
|
||||
def published?
|
||||
if self.data.has_key?('published') && self.data['published'] == false
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def populate_categories
|
||||
if self.categories.empty?
|
||||
self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase}
|
||||
|
||||
@@ -170,7 +170,8 @@ module Jekyll
|
||||
f_rel = File.join(dir, f)
|
||||
read_directories(f_rel) unless self.dest.sub(/\/$/, '') == f_abs
|
||||
elsif has_yaml_header?(f_abs)
|
||||
pages << Page.new(self, self.source, dir, f)
|
||||
page = Page.new(self, self.source, dir, f)
|
||||
pages << page if page.published?
|
||||
else
|
||||
static_files << StaticFile.new(self, self.source, dir, f)
|
||||
end
|
||||
@@ -189,7 +190,7 @@ module Jekyll
|
||||
posts = read_content(dir, '_posts', Post)
|
||||
|
||||
posts.each do |post|
|
||||
if post.published && (self.future || post.date <= self.time)
|
||||
if post.published? && (self.future || post.date <= self.time)
|
||||
aggregate_post_info(post)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user