JekyllのRSSの更新日について
JekyllのRSSは全ての記事でpublishedとupdatedが同じ日時になってしまっているので、 jekyll-last-modified-at を使ってみる。
現在、使用しているプラグインの各バージョンは下記のとおりです。
- jekyll (4.1.1)
- jekyll-feed (0.15.0)
- jekyll-sitemap (1.4.0)
- jekyll-last-modified-at (1.3.0)
- jekyll-tagging (1.1.0)
RSSの<updated>タグ
このサイトのRSS (feed.xml)は jekyll-feed を使って生成していますが、記事を修正してもRSSの<updated>タグの内容が 変ることはありません。
<!-- /feed.xml -->
<published>2020-08-19T14:19:15+09:00</published>
<updated>2020-08-19T14:19:15+09:00</updated>
そこで、jekyll-feedのテンプレートを見てみると
<!-- jekyll-feed-0.15.0/lib/jekyll-feed/feed.xml -->
<published>{{ post.date | date_to_xmlschema }}</published>
<updated>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
となっており、post.last_modified_atが未定義の場合post.dateを 使うようになっているようです。
Sitemapの<lastmod>タグ
また、jekyll-sitemap を使って生成しているSitemap (sitemap.xml) でも、記事を修正してもSitemapの<lastmod>タグの内容が変らない状態はRSSと同じです。
<lastmod>タグのついては README に説明があり、jekyll-last-modified-atプラグインをインストールすれば 最終更新日が反映されるようです。
The
tag in the sitemap.xml will reflect by priority: 
- The modified date of the file as reported by the filesystem if you have jekyll-last-modified-at plugin installed (not compatible with GitHub Pages auto building)
- A personalised date if you add the variable last_modified_at: with a date in the Front Matter
- The creation date of your post (corresponding to the post.date variable)
出典: jekyll/jekyll-sitemap
jekyll-last-modified-at
このプラグインは、ソースファイルの最後のGitコミット日をチェックすることにより、 ページの最終変更日を決定します。Gitが利用できない場合は、ファイルmtimeが使用されます。
出典: gjtorikian/ jekyll-last-modified-at (Google Translateによる翻訳)
インストール
インストールはGemfile, _config.ymlを編集してbundleするだけです。
# Gemfile
group :jekyll_plugins do
  gem "jekyll-last-modified-at"
end
# _config.yml
plugins:
  - jekyll-last-modified-at
結果
jekyll-last-modified-atをインストールすることでlast_modified_atが定義され、 RSS, Sitemapともに最終更新日が反映されます。
<!-- /feed.xml -->
<published>2020-08-19T00:00:00+09:00</published>
<updated>2020-08-19T16:36:54+09:00</updated>
jekyll-taggingとbuildエラー
bundle exec jekyll build時に下記のようなエラーがでるようになってしまった。
Liquid Exception: No such file or directory - .../tag/some-tag.html does not exist! in /_layouts/default.html
このエラーについては、 jekyll-last-modified-at を使うようにした (@znz blog) の対策が有効でした。(先達に感謝  )
)
Tag cloud
android (2), bash (1), bitbucket (2), chromebook (2), cifs (1), css (1), docker (1), git (1), gitlab (1), info (1), javascript (3), jekyll (13), markdown (1), nfs (1), nodejs (2), php (2), plugins (5), powerline (1), ruby (1), ssh (1), themes (1), vim (1), windows (1), wordpress (1), wsl (1), xrea (7)

