Module: Jekyll::VitePressTheme::LastUpdated

Defined in:
lib/jekyll/vitepress_theme/hooks.rb

Class Method Summary collapse

Class Method Details

.source_file_time(site, path) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/jekyll/vitepress_theme/hooks.rb', line 78

def source_file_time(site, path)
  return nil unless path

  source_path = if Pathname.new(path).absolute?
                  path
                else
                  File.join(site.source, path)
                end

  return nil unless File.file?(source_path)

  File.mtime(source_path).utc
rescue StandardError
  nil
end