in reply to Re^4: Last Modified for Template file
in thread Last Modified for Template file

The real question is "did any of the content change", and that would be very very hard to answer from inside the template. You would actually need to record the newest date of any of the three: head, body, or foot, and you'd need to update the logic if you ever call out to additional templates.

I think your best bet would be to handle it in the server. Call out to Template, build the complete bytes of the body, then hash them (md5 or sha1) and save that somewhere (database, textfile) and if it doesn't match the previous value for this URL, update the timestamp.Then add the header the way it was meant to be added - as a header.

Edit: just saw your comment about "to process with a static site generator". In that case, in the step where you generate the pages from templates, you could just render to memory first, hash it, and only overwrite the file on disk if the content has changed. Your static site generator should then be able to get the last-modified from the mtime of the pages.