Sha256: a4412de71889ea370dbf47c2cf2971b321a4365711ab977ed7f85ea17a3b4524
Contents?: true
Size: 511 Bytes
Versions: 3
Compression:
Stored size: 511 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 = `git log -1 --pretty="format:%cI" "#{path}"` Time.parse(date) if date.present? end def git_repo? system "git status", out: File::NULL, err: File::NULL end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-sitemap-2.0.0 | lib/bridgetown/resource/base.rb |
bridgetown-sitemap-1.2.0 | lib/bridgetown/resource/base.rb |
bridgetown-sitemap-1.1.2 | lib/bridgetown/resource/base.rb |