diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 7a1b6eed..cedd1e62 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -106,6 +106,16 @@ module Jekyll defaults.merge(data).deep_merge(further_data) end + def type + if is_a?(Post) + :post + elsif is_a?(Page) + :page + elsif is_a?(Draft) + :draft + end + end + # Recursively render layouts # # layouts - a list of the layouts diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index 98fa7362..321a6e58 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -13,10 +13,6 @@ module Jekyll name =~ MATCHER end - def type - :draft - end - # Get the full path to the directory containing the draft files def containing_dir(source, dir) File.join(source, dir, '_drafts') diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index a8483307..e9146597 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -34,10 +34,6 @@ module Jekyll end end - def type - :page - end - # The generated directory into which the page will be placed # upon generation. This is derived from the permalink or, if # permalink is absent, we be '/' diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index b03c31f3..fcf22ecf 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -69,10 +69,6 @@ module Jekyll self.populate_tags end - def type - :post - end - def published? if self.data.has_key?('published') && self.data['published'] == false false