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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.