one solution of that would be to store a key related to the document, for instance the MD5 key of a post.
advantage:
document change => key change
key not in current server => could be located in the web, should the key contains that info
disadvantage:
MD5 key is long, 32 bytes
MD5 is not collision free, but no collision known
quite easy for document, post, images but for a bug
note that malte post a similar idea https://openacs.org/forums/message-view?message_id=65365