Skip to content

Instantly share code, notes, and snippets.

@gma
Created February 21, 2012 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gma/1876872 to your computer and use it in GitHub Desktop.
Save gma/1876872 to your computer and use it in GitHub Desktop.
# The best approach depends on how you define a blog entry. If you think
# of a blog article the same way I do, that means "all pages with a date".
#
# In Ruby you can re-open a class and redefine its methods. Normally, this
# would be a horrific thing to do (as others could be very confused by
# your code) but in the context of a typical Nesta site I don't think it's
# particularly bad news, and its very convenient.
#
# So, in app.rb, add this (which is very similar to the default):
module Nesta
class Page
def template
default = date.nil? ? 'layout_blog' : 'layout'
(metadata('layout') || default).to_sym
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment