I’m trying to code the new date tag we talked about earlier, but as
I’m new to ruby, I’m posting the code for you to have a look.
Renders the actual date or the date the page was published, created or
(in the event that it has not been published yet, the date that it
The format attribute uses the same formating codes used by the Ruby
function. By default it’s set to @%A, %B %d, %Y@.
tag ‘date’ do |tag|
page = tag.locals.page
format = (tag.attr[‘format’] || ‘%A, %B %d, %Y’)
if (tag.attr[‘which’] == ‘now’)
date = Date::Time.now
which = tag.attr[‘which’] # are this two lines correct?
date = page.which # i don’t know if it’s the way to do it
date = page.published_at || page.created_at
date_type would be [created_at | published_at | updated_at | now]
I need some help