Fix bug in link_to_document to handle documents without title