@@ -70,7 +70,7 @@ def on_config(self, config: config_options.Config, **kwargs) -> Dict[str, Any]:
7070 self .util = Util (config = self .config , mkdocs_dir = os .path .abspath (os .path .dirname (config .get ('config_file_path' ))))
7171
7272 # Save last commit timestamp for entire site
73- self .last_site_revision_timestamp = self .util .get_git_commit_timestamp (
73+ self .last_site_revision_hash , self . last_site_revision_timestamp = self .util .get_git_commit_timestamp (
7474 config .get ('docs_dir' )
7575 )
7676
@@ -201,9 +201,9 @@ def on_page_markdown(
201201 # Retrieve git commit timestamp
202202 # Except for generated pages (f.e. by mkdocs-gen-files plugin)
203203 if getattr (page .file , "generated_by" , None ):
204- last_revision_timestamp = int (time .time ())
204+ last_revision_hash , last_revision_timestamp = "" , int (time .time ())
205205 else :
206- last_revision_timestamp = self .util .get_git_commit_timestamp (
206+ last_revision_hash , last_revision_timestamp = self .util .get_git_commit_timestamp (
207207 path = page .file .abs_src_path ,
208208 is_first_commit = False ,
209209 )
@@ -221,6 +221,8 @@ def on_page_markdown(
221221 # Add to page meta information, for developers
222222 # Include variants without the CSS <span> elements (raw date strings)
223223 page .meta ["git_revision_date_localized" ] = revision_date
224+ page .meta ["git_revision_date_localized_hash" ] = last_revision_hash
225+ page .meta ["git_revision_date_localized_tag" ] = self .util .get_tag_name_for_commit (last_revision_hash )
224226 revision_dates_raw = self .util .get_date_formats_for_timestamp (last_revision_timestamp , locale = locale , add_spans = False )
225227 for date_type , date_string in revision_dates_raw .items ():
226228 page .meta ["git_revision_date_localized_raw_%s" % date_type ] = date_string
@@ -234,6 +236,8 @@ def on_page_markdown(
234236 )
235237
236238 # Also add site last updated information, for developers
239+ page .meta ["git_site_revision_date_localized_hash" ] = self .last_site_revision_hash
240+ page .meta ["git_site_revision_date_localized_tag" ] = self .util .get_tag_name_for_commit (self .last_site_revision_hash )
237241 site_dates = self .util .get_date_formats_for_timestamp (self .last_site_revision_timestamp , locale = locale , add_spans = True )
238242 site_date = site_dates [self .config ["type" ]]
239243 if self .config ["type" ] == "timeago" :
@@ -260,9 +264,9 @@ def on_page_markdown(
260264 # Retrieve git commit timestamp
261265 # Except for generated pages (f.e. by mkdocs-gen-files plugin)
262266 if getattr (page .file , "generated_by" , None ):
263- first_revision_timestamp = int (time .time ())
267+ first_revision_hash , first_revision_timestamp = "" , int (time .time ())
264268 else :
265- first_revision_timestamp = self .util .get_git_commit_timestamp (
269+ first_revision_hash , first_revision_timestamp = self .util .get_git_commit_timestamp (
266270 path = page .file .abs_src_path ,
267271 is_first_commit = True ,
268272 )
@@ -279,6 +283,8 @@ def on_page_markdown(
279283
280284 # Add to page meta information, for developers
281285 # Include variants without the CSS <span> elements (raw date strings)
286+ page .meta ["git_creation_date_localized_hash" ] = first_revision_hash
287+ page .meta ["git_creation_date_localized_tag" ] = self .util .get_tag_name_for_commit (first_revision_hash )
282288 page .meta ["git_creation_date_localized" ] = creation_date
283289 creation_dates_raw = self .util .get_date_formats_for_timestamp (first_revision_timestamp , locale = locale , add_spans = False )
284290 for date_type , date_string in creation_dates_raw .items ():
0 commit comments