Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An option to customize the note id #74

Closed
gambhiro opened this issue Feb 3, 2023 · 3 comments
Closed

An option to customize the note id #74

gambhiro opened this issue Feb 3, 2023 · 3 comments

Comments

@gambhiro
Copy link

gambhiro commented Feb 3, 2023

May I ask if we could customize how the note id is generated?

Org-roam generates them with org-id-get-create. I couldn't find out how to change this for new md-roam notes, so I have been creating an id manually in the scratch buffer and copying it back to the capture buffer.

In md-roam:

---
title: that's a new note
id: 2023-02-03-070000
aliases: []
---

In org-roam:

:PROPERTIES:
:ID:       bd62c1eb-7dfa-4ffa-9329-5454f17c702d
:END:
#+TITLE: that's a new note
#+FILETAGS:  
@nobiot
Copy link
Owner

nobiot commented Feb 3, 2023

If you are Org version 9.5, you can customize org-id-method to time stamp.

I do this: org-id-method' is set to 'ts (time stamp). And use org-roam-capture-templates like this:

          ("p" "personal Markdown" plain ""
           :target
           (file+head "personal/${id}.md"
                      "---\ntitle: ${title}\nid: ${id}\ncategory: %^{Category|#reference|#creation|#index|#meeting}\nmodified: <>\n---\n")
           :unnarrowed t)

ID is just a plain text, so if you are not on version 9.5, you can use format-time-string. I think in this case you might like to also add something in capture-finalize hook to call org-id-add-location for the ID and markdown file.

@nobiot
Copy link
Owner

nobiot commented Feb 3, 2023

If this is unclear let me know

@gambhiro
Copy link
Author

gambhiro commented Feb 3, 2023

Ah brilliant. I didn't realize I can put id: ${id} in the capture template, I was stuck on thinking in terms of the % syntax.

@gambhiro gambhiro closed this as completed Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants