Drafts Used for a Zettelkasten

You raise a valid concern. I use an action that, when invoked, prompts for a new title for the current draft. After you provide the new title, the action updates the title of the current draft and searches the workspace updating links that depended upon the old title.

I use this action often (1) to clarify a title, (2) when I decide to split or merge drafts, or (3) simply to fix a typo in the title.

As I understand it, the same problem in The Archive is solved by making links dependent upon 12 digit UIDs in the form yyyymmddhhmm. But, other than date created, UIDs don’t convey useful information, so a link based upon a UID must be further explained - else who knows what it is a link to? Linking with titles, assuming that you have a way of updating links based on title names when a title is changed seems more efficient to me.

1 Like

That sounds like a useful action! Have you shared it?

I just shared it to the Actions Directory under the title “Title and Links.” No guarantees re the quality of the code.

1 Like

Sorry to be a bother–I don’t see that when searching the directory. Maybe it’s unlisted? Any chance you could link to it here?

I think you should be able to find it now. Missed the “unlisted” option. Thanks for pointing that out.

1 Like

Hey, that’s a great script. I made a small change, so that the script counts the drafts that were changed as well, giving the total of drafts changed AND the total of drafts evaluated. Just a small sanity check for my use!

Here’s the change:

//This scripts prompts for a new title and then replaces the old title with it.// 
//The script also searches the current workspace to locate links based on the old title, and updates them.//


// prompt for new title.// 
let p = Prompt.create();
p.title = "New Title";
p.message = "Enter the new title. The old title and all links using that title will be replaced by the new title.";

p.addTextField("newTitle", "New Title", "", {
    "placeholder": " ",
    "autocorrect": false,
    "autocapitalization": "none",
    "wantsFocus": true
});

p.addButton("Replace");

if (p.show()) {
    //Establish variables for the old and new titles and the old and new links.//
    let oldTitle = draft.displayTitle;
    let oldLink = `[[${oldTitle}]]`;
    let newTitle = p.fieldValues["newTitle"];
    let newLink = `[[${newTitle}]]`;

    //Search the current workspace looking for links based on the old title and update them.
    let count = 0
    let cCount = 0
    var drafts = app.currentWorkspace.query("all");

    for (let d of drafts) {
        if (d.uuid != draft.uuid) {
        		if (d.content.includes(oldLink)){
            	d.content = d.content.replaceAll(oldLink, newLink);
            	d.update();
            	cCount++
            }
           count++
           
        }
    }

    editor.setText(editor.getText().replace(oldTitle, newTitle))
    alert(cCount + " changed in " + count + " drafts evaluated.");
}
6 Likes

Thank you. Very useful change.

Would you be willing to publish all Zettelkasten scripts in an action group? Or post them somewhere else?

I think you will have better luck starting with the group that @agiletortoise provided in the Action Directory when Version 20 was released. It is called “Examples: Cross-linking” and has actions for:

Insert Link to Draft
Back Links
Open Last Draft
New Linked Draft (which I renamed to New from Structure Note)

The one additional action I think you’ll need is “Title and Links” which I shared to the Directory yesterday. It changes the title of a draft and also updates any links dependent upon the new title.

I use Bear and wanted somewhere to store other file types. So I added a single step text action where the clipboard holds the title of a Bear note.

[[bear:[[clipboard]]]]

I added “Markdown Link” – also provided by @agiletortoise to this action group.

You may want to modify the template used by “New Linked Draft” or duplicate that action to provide more than one template option. I provided an example of how to do that earlier in this thread.

3 Likes

Ok, found it.
Thanks

I have been waiting and watching until i finally found a good use case for Drafts. This might do the trick! Great information

1 Like

and now I am on the Pro trial…going down the rabbit hole…

I would love to know more. Is this the best source to learn from? I note some of the reviews are not the best…

Here’s a good detailed review: https://fortelabs.co/blog/how-to-take-smart-notes/

1 Like

Do you mean the reviews of the book?

I can guess why this is. The reading is nevertheless worthwhile.

Please ignore the bashing of GTD-guru David Allen in the first chapters. He acknowledges his work later on implicitly and explicitly.

And I do not agree with his software advice. (Drafts is a better choice)

Do not forget that paper is still a competition to software.

I love that - you can see why but would still recommend it! I will give it a go… thank you very much.

1 Like

“The Archive” is a software product designed from the start for use with a ZK. The developers run a site devoted to ZK use. You can learn from some of the discussions, but you can also get lost in what seem to me to be theoretical distinctions of no great importance.

I first experimented with a ZK using The Archive. But, with Version 20, Drafts emerged with much more ZK-related functionality. At this point, The Archive’s functionality is a sub-set of what Drafts offers, both for ZK purposes and for a lot of other things.

On the other hand, The Archive developers are good sources for improving your understanding of how a ZK is supposed to work – particularly if you are an academic.

1 Like

thanks for that context. that is often a great misunderstanding. as a software engineer with a documentation stream and a dad of four / philosopher / soul pilgrim at night my Zettelkasten requirements are very different then those of a academic scholar (is scholar the right word?)

I am working with a mixed system (drafts and paper) - we will see how this works out.

I would just love to have a system

Thank you for this. I would love to see someone’s system!