Sha256: b65061dc67aa24cc7d814893e76db796dc8bf11306ab025fc08b1ab27b10a182
Contents?: true
Size: 655 Bytes
Versions: 2
Compression:
Stored size: 655 Bytes
Contents
# frozen_string_literal: true module Bridgetown module Resource class Base def sitemap_last_modified_at (data.last_modified_at || latest_git_commit_date || date)&.to_time end private def latest_git_commit_date return nil unless git_repo? date = sitemap_cache.getset(id) do `git log -1 --pretty="format:%cI" "#{path}"` end Time.parse(date) if date.present? end def git_repo? system "git status", out: File::NULL, err: File::NULL end def sitemap_cache @sitemap_cache = Bridgetown::Cache.new("sitemap") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-sitemap-2.0.2 | lib/bridgetown/resource/base.rb |
bridgetown-sitemap-2.0.1 | lib/bridgetown/resource/base.rb |