From 1279b3e07cf8847dcf8052691e31030f1d0e3430 Mon Sep 17 00:00:00 2001 From: imtodor Date: Mon, 22 Oct 2018 16:48:35 +0300 Subject: [PATCH] feat: Optimized sitemap lastmod generation and fixed page title --- _layouts/default.html | 2 +- _plugins/timestamp.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index 7cdfe4c..0e45890 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -6,7 +6,7 @@ - {{ page.page_title | page.title }} - {{ site.product }} + {{ page.page_title | default: page.title }} - {{ site.product }} {% if page.res_type %}{% else %}{% endif %} diff --git a/_plugins/timestamp.rb b/_plugins/timestamp.rb index 74ab5ee..92811c5 100644 --- a/_plugins/timestamp.rb +++ b/_plugins/timestamp.rb @@ -1,14 +1,16 @@ class TimeStampTag < Liquid::Block def initialize(tag_name, markup, tokens) @text = markup + @@today_date = Date.today.to_s super end def render(context) contents = super content = Liquid::Template.parse(contents).render context - # aim for YYYY-MM-DD format https://www.google.com/sitemaps/protocol.html#lastmoddef - `git log -1 --format=%cd --date=short #{content}`.strip + # aim for YYYY-MM-DD format https://www.google.com/sitemaps/protocol.html#lastmoddef + #`git log -1 --format=%cd --date=short #{content}`.strip + @@today_date end end