How to output in layout a variable instantiated by erb in page content processing?

I’m no Ruby whiz, and I’m in over my head on this one. I want to capture the datestamp of my page source compile, then output it in my layout AFTER I have output the page. I don’t know how to store the datestamp so that the layout processing can find it. I’m pretty sure this is possible, though. I won’t detail all my failed attempts. I’d just like a hint about how to do this.

Simple example:

  1. My source file is index.html.md.erb

  2. It contains:

Here is the compile datestamp from within the compile: <%= Time.new %>

  1. Here is the relevant part of my layout file:

<%= yield %>
<% require ‘date’ %>
<%= DateTime.now %>

Never mind that I seem to be trying to output the same date twice. In my production run I will ouput it ONLY after the compile is run, and not from within the compiled text - if this is possible

Thanks for you thoughts on this!

Time (and more thought) works wonders. This code, inserted in the compile source (processed by erb) captures the page compile time for access by code in my layout:

<% current_page.data.compile_time = Time.now %>

Simple.