Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a website that is automatically regenerated every day based on a fresh copy of an externally-supplied database, which has no concept of the modification time of the individual records (e.g., OpenBSD ports), and I'm thinking that perhaps there is some way to automatically keep track of the last modification time of all files based on a SHA-1 signature, or something similar?

The primary need of this modification time is to ensure that an XML sitemap could include such data, and thus alert Google et al. of which pages may have changed, and which have not, in order to optimize crawling.

share|improve this question

1 Answer 1

I don't know of a specific tool to do that. However, and since you write the generator, you could work out a simple process where you (1) generate the page and (2) copy the resulting page to where it goes only if it changed. This is assuming your generator creates the page the exact same way every time (i.e. you do not add a creation date & time in your documents.)

So...

generate /tmp/page-123
if ! cmp /tmp/page-123 $WEBSITE_PATH/page-123
then
  cp /tmp/page-123 $WEBSITE_PATH/page-123
fi

Then your other tools can make use of the modification time of the file under $WEBSITE_PATH since it won't change when the new database comes in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.