Add a method to retrieve type to post, page and draft

This commit is contained in:
maul.esel 2013-09-11 00:48:05 +02:00
parent 70d9225d9c
commit 3ccd8dad31
3 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,10 @@ module Jekyll
name =~ MATCHER name =~ MATCHER
end end
def type
:draft
end
# Get the full path to the directory containing the draft files # Get the full path to the directory containing the draft files
def containing_dir(source, dir) def containing_dir(source, dir)
File.join(source, dir, '_drafts') File.join(source, dir, '_drafts')

View File

@ -30,6 +30,10 @@ module Jekyll
self.read_yaml(File.join(base, dir), name) self.read_yaml(File.join(base, dir), name)
end end
def type
:page
end
# The generated directory into which the page will be placed # The generated directory into which the page will be placed
# upon generation. This is derived from the permalink or, if # upon generation. This is derived from the permalink or, if
# permalink is absent, we be '/' # permalink is absent, we be '/'

View File

@ -65,6 +65,10 @@ module Jekyll
self.populate_tags self.populate_tags
end end
def type
:post
end
def published? def published?
if self.data.has_key?('published') && self.data['published'] == false if self.data.has_key?('published') && self.data['published'] == false
false false