1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#
# description_from_body.rb - set meta description by first section's body in day mode
#
# Copyright (C) 2011, TADA Tadashi <t@tdtds.jp>
# You can redistribute it and/or modify it under GPL.
#
alias description_tag_dfb_orig description_tag
def description_tag
if @mode == 'day' then
diary = @diaries[@date.strftime '%Y%m%d']
return '' unless diary
body = ''
diary.each_section do |sec|
body = remove_tag( apply_plugin( sec.body_to_html ) ).strip
break
end
%Q|<meta name="description" content="#{@conf.shorten body, 256}">|
else
description_tag_dfb_orig
end
end
|