@@ -191,6 +191,25 @@ def on_page_markdown(
191191 flags = re .IGNORECASE ,
192192 )
193193
194+ # Also add site last updated information, for developers
195+ site_dates = self .util .get_date_formats_for_timestamp (self .last_site_revision_timestamp )
196+ site_date = site_dates [self .config ["type" ]]
197+ if self .config ["type" ] == "timeago" :
198+ site_date += site_dates ["iso_date" ]
199+ page .meta ["git_site_revision_date_localized" ] = site_date
200+ site_dates_raw = self .util .get_date_formats_for_timestamp (self .last_site_revision_timestamp , add_spans = False )
201+ for date_type , date_string in site_dates_raw .items ():
202+ page .meta ["git_site_revision_date_localized_raw_%s" % date_type ] = date_string
203+
204+ # Replace any occurances in markdown page
205+ markdown = re .sub (
206+ r"\{\{\s*git_site_revision_date_localized\s*\}\}" ,
207+ site_date ,
208+ markdown ,
209+ flags = re .IGNORECASE ,
210+ )
211+
212+
194213 # If creation date not enabled, return markdown
195214 # This is for speed: prevents another `git log` operation each file
196215 if not self .config .get ("enable_creation_date" ):
@@ -227,17 +246,6 @@ def on_page_markdown(
227246 flags = re .IGNORECASE ,
228247 )
229248
230- # Finally,
231- # Also add site last updated information, for developers
232- site_dates = self .util .get_date_formats_for_timestamp (self .last_site_revision_timestamp )
233- site_date = site_dates [self .config ["type" ]]
234- if self .config ["type" ] == "timeago" :
235- site_date += site_dates ["iso_date" ]
236- page .meta ["git_site_revision_date_localized" ] = site_date
237- site_dates_raw = self .util .get_date_formats_for_timestamp (self .last_site_revision_timestamp , add_spans = False )
238- for date_type , date_string in site_dates_raw .items ():
239- page .meta ["git_site_revision_date_localized_raw_%s" % date_type ] = date_string
240-
241249 return markdown
242250
243251 def on_post_build (self , config : Dict [str , Any ], ** kwargs ) -> None :
0 commit comments