Skip to content

Commit 88afdba

Browse files
committed
extract mtimes of Pages and Documents to API
1 parent 66ee967 commit 88afdba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/jekyll-admin/apiable.rb

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def to_api(include_content: false)
4747
output["name"] = basename
4848
end
4949

50+
if is_a?(Jekyll::Page) || is_a?(Jekyll::Document)
51+
output["modified_at"] = mtime
52+
end
53+
5054
output
5155
end
5256

@@ -70,6 +74,10 @@ def name
7074
@name
7175
end
7276

77+
def mtime
78+
@mtime ||= File.stat(file_path).mtime
79+
end
80+
7381
def file_contents
7482
@file_contents ||= File.read(file_path, file_read_options) if file_exists?
7583
end

0 commit comments

Comments
 (0)