I have a website with a handful (currently 3; I anticipate about a dozen when it's complete) of static html pages. I'd like to include "created" and "last-modified" dates in the pages for the benefit of visitors who arrive a week or a month or a few years from now. I expect anyone who cares to be viewing the source, so I could do:

<!-- created yyyy-mm-dd, last-modified yyyy-mm-dd -->

but I'd like to use something more standard (and elegant). I've found one reference to last modified (but only a mention in the text, not an actual code reference, so I'm not positive how to properly implement it) but not created.

Is there a proper way to display both (or at least one) of these dates?

  • I would have thought that "viewing the source" is very much a last resort if someone is trying to find the last-modified/created date of a page. If this is something you think is relevant for your users then it should be at least visible in the page content.
    – MrWhite
    Nov 29 '12 at 8:02

Created November 29, 2012. Last modified December 1, 2012.


Created 2012-11-29. Last modified 2012-12-01.

Trying to do use automated processes for this in the case of three static pages, probably to be modified once a year or so, would really be overkill. It would also be error-prone. Most “last modified” scripts use the last write access to a file as the basis. This means, among other things, that if you open a file, edit it, and then remove the edit, it will appear as having been modified when it was not.


Since they are all static HTML pages you should create a server side include. A single HTML file that is included into all other HTML files. Now after you update your websites you'll only have to update this single HTML file and write Last updated 11/29/2012 and it'll show up on all the pages. You can place the included HTML file in your footer which is quite common. Anyplace though really it's up to you this is just an easy way to manage static HTML files using a server side include.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy