Created
February 21, 2012 14:38
-
-
Save gma/1876872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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