lib/siteleaf/content.rb in siteleaf-2.0.0.pre.beta5 vs lib/siteleaf/content.rb in siteleaf-2.0.0.pre.beta7

- old
+ new

@@ -7,27 +7,32 @@ def site Site.find(self.site_id) if self.site_id end def draft? - !published? + visibility == 'draft' end - def published? - published != false + def hidden? + visibility == 'hidden' end + + def visible? + visibility == 'visible' + end + alias_method :published?, :visible? def to_file - [frontmatter, "---\n\n".freeze, body].join('') + frontmatter + "---\n\n".freeze + body.to_s end protected def frontmatter attrs = metadata || {} attrs['title'] = title - attrs['date'] = Time.parse(published_at).utc.strftime('%F %T %z') unless published_at.nil? - attrs['published'] = false if draft? + attrs['date'] = Time.parse(published_at).utc unless published_at.nil? + attrs['published'] = false if hidden? attrs['permalink'] = permalink unless permalink.nil? attrs.empty? ? "---\n".freeze : attrs.to_yaml end \ No newline at end of file