I am aware that individual files contain their creation date in their filenames. In addition to that, I am looking at adding a “creation” metadata to the notes – both file level roam nodes, and heading/subheading level roam notes.
What is the best way to go about doing that?
adding #+creation: to files? I don’t think that’s good, because the #+properties are filelevel properties that relate to exporting backends, afaik.
adding :CREATION:property to the property drawers of each and every roam node that gets created? This would both include the file level roam nodes and subheading/heading level roam nodes
I guess the easiest way to go about doing that would be changing the org-id-methodto ts value. That way, the UUIDs of ALL your roam nodes (both file level and subheading level) will automatically encode the UUID creation date.
But again, I don’t like changing an orgmode default setting (org-id-method) globally just ‘cuz I am using org-roam.
@ChuckSneed If you prefer to keep org-id default, and you want to avoid the #+ keyword, then… I think you have your own conclusion, don’t you? Use the property drawer.
I agree with you about open exchange in a forum. My opinion about the “best way” is the one you find. If you are seeking others’ opinions, I’d suggest perhaps you could phrase your opening question differently, and directly ask for open opinions as you did now. This is only my view and you can agree or disagree with me.
No worries. I see the “best way” you are asking is one’s own best way (eg nobiot’s best way he has found so far) not a way you ChuckSneed may find best.
My best way so far is:
File nodes only (headings are not nodes)
File name starts with a date stamp (up to minutes) but keep a title in the file name too
Use Org ID as time stamp too (because I find UUID esthetically less appealing than a time stamp)
I also add a file meta data with the time-stamp as described in the forum and Wiki.
There is also another reason why I prefer timestamps to UUID. I can use timestamps in my physical notes to refer to notes (from/to digital ones). It is not easy for my human eyes to use UUID as a reference key.
This might be useful to you. I add it to ALL headings in the org-roam nodes
(defun dmg-org-add-created-to-all-headings (&optional p)
"Add a CREATED property with the current date to every heading without it."
(interactive "P")
(let ((date (if p
(format-time-string "%Y-%m-%d %T" (org-read-date nil t))
(format-time-string "%Y-%m-%d %T"))))
(save-excursion
(goto-char (point-min))
(while (re-search-forward org-heading-regexp nil t)
(unless (org-entry-get nil "CREATED")
(org-entry-put nil "CREATED" date))))))
and this is how I call it. If I want to add it to no-roam files I check DMG-ADD-CREATED property.
the function also adds an ID if the file is in the roam directory and it does not already have at least one ID.
(defun dmg-org-add-properties-before-save ()
"Add CREATED property to headings and ID/TRIGGER to the file before saving.
CREATED is added if org-roam file and not explicitly disabling it
if not org-roam file, then explicitly enabling it
ID gets added if org-roam and first header does not have an id
Any errors encountered are caught and reported, but do not abort the save."
(condition-case err
(let* (
(file-props (dmg-org-roam-file-properties))
(is-org-roam (org-roam-file-p))
(created-prop (dmg-org-roam-file-property "DMG-ADD-CREATED" file-props))
(explicit-add-created (and created-prop
(string= created-prop "yes")))
(add-created (cond
(created-prop explicit-add-created)
(is-org-roam (not created-prop))
))
(id-prop (dmg-org-roam-file-property "ID" file-props))
(first-heading-id (dmg-org-first-heading-get-id))
(add-file-id (and is-org-roam
(not id-prop)
(not first-heading-id)))
)
;;
(when add-created
(dmg-org-add-created-to-all-headings))
(when add-file-id
(dmg-org-file-add-id))
)
(error (message "Error adding properties: %s" (error-message-string err)))))
(add-hook 'before-save-hook 'dmg-org-add-properties-before-save)
I create a lot of headings by hand. BUt I don’t want all headings to be org-roam nodes. It clutters searching for headings.
Usually, when I am editing a roam file, when I am adding heading. if I think I am likely going to visit it directly in the future (e.g. I think I will search for it), I call org-id-get-create manually to add the ID to convert it into an org-roam node.