I use org-mode publish a website for a class I teach. I want to keep all my old notes on the hosting server. I want to keep using very predictable filenames (e.g. "hw1.pdf", "hw2.pdf", etc.) in my source directory, but I don't want users to be able to access certain files until I have linked to them on the website--needless to say, I don't publish a site-map. I also want old files to be removed from the public directory automatically so students cannot accidentally obtain an old version of a homework (in case I need to make a correction/adition to an assignment).

Here was my idea: I'll just make filenames in the published directory the hash of the corresponding file. Implementing this has been a bit difficult. Here is what I plan to do:

  • add-org-link-type for pointing to pdfs in my source directory.
  • Write a function my/org-publish-attachment which copies files to the appropriate directory with renaming and removes files not linked to on the site.

I think org-mode already hashes the files when running org-publish-attachment (so it can check for updates to the file in the public directory), but I don't know where (or if) those hashes are stored.


  1. Am I right that org-mode hashes files when running org-publish-attachment? If so, are these hashes stored somewhere I can access?
  2. How can I make the html links "dynamic"? If hashes are stored, I could just modify the publishing function for that org-link-type. If they aren't, what are my options?
  3. What other variables and functions are relevant here?

PS. I'm relatively new to org-mode, and there is a LOT out there; this has made it difficult to get started. If I've missed some obvious reference that solves my problem, please let me know. Thanks in advance for your help!

  • Have you looked at the code of org-publish-attachment? The only thing it does is to copy the file to the publishing directory - that's it. – NickD Aug 29 '20 at 7:27

Your Answer

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

Browse other questions tagged or ask your own question.