diff options
Diffstat (limited to '_plugins/log.rb')
| -rw-r--r-- | _plugins/log.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/_plugins/log.rb b/_plugins/log.rb index d524e68..99473c5 100644 --- a/_plugins/log.rb +++ b/_plugins/log.rb @@ -19,13 +19,17 @@ require 'date' require_relative 'modified_time_helper' module Jekyll - # Render the last modification time of the given page. + # Render the last modification time of the given page. This plugin requires + # the use of the Jekyll multiple-language plugin, and a value for the + # 'log.unknown' key. class RenderModifiedAt < Liquid::Tag include ::Jekyll::ModifiedTimeHelper def render(context) - time = Time.iso8601(modified_time(context['page'])) + mt = modified_time(context['page']) + return unknown(context) if mt.nil? + time = Time.iso8601(mt) if context['page']['lang'] == 'en' time.strftime('%B %-d, %Y, at %H:%m') else @@ -35,6 +39,14 @@ module Jekyll protected + # Returns the 'log.unknown' string. + def unknown(context) + lang = context['site']['lang'] + ts = context['site']['translations'][lang] + + ts['log']['unknown'] + end + # Given a month number, return its catalan translation. # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity def catalan_month(month) |
