Skip to content

Commit 8f04fb1

Browse files
author
luginf
committed
precision about wiki links.
Fix subfolders link generation
1 parent 5c2e7f9 commit 8f04fb1

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

zettelkasten/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A QOwnNotes script that adds [Zettelkasten](https://en.wikipedia.org/wiki/Zettel
66

77
In the Zettelkasten method, each note carries a **permanent unique ID** embedded in its content or filename. Links between notes are based on this ID, not on the filename. This means a note can be renamed freely without breaking any link pointing to it.
88

9-
This script implements that principle inside QOwnNotes using the native `[[filename|id]]` wiki-link format.
9+
This script implements that principle inside QOwnNotes using the native `[[filename|id]]` wiki-link format. You will need to activate Settings>Interface>Editor>'Enable wiki-style link support [[note name]]'.
1010

1111
## Usage
1212

@@ -22,7 +22,7 @@ You can also link those actions to a custom shortcut.
2222
[[MyNote|20260430143012]]
2323
```
2424

25-
- The left part (`MyNote`) is what QOwnNotes uses to resolve the link (Ctrl+click to open).
25+
- The left part (`MyNote`) is what QOwnNotes uses to resolve the link (Ctrl+click to open). Only the note name is used — subfolder paths are never included, because QOwnNotes resolves wiki-links by filename regardless of the folder the note is in.
2626
- The right part (`20260430143012`) is the permanent ZK ID, used by this script to repair links when the filename changes.
2727

2828
## Actions

zettelkasten/zettelkasten.qml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,12 @@ Script {
9292
}
9393

9494
// Returns the link target string for [[target|id]] given a note object.
95+
// QOwnNotes resolves wiki-links by filename only, regardless of subfolder,
96+
// so we never include the relative directory path.
9597
function noteLinkTarget(note) {
9698
var name = note && note.name ? note.name : "";
97-
if (name) {
98-
var relativeDir = note.relativeNoteFileDirPath || "";
99-
if (relativeDir) {
100-
relativeDir = relativeDir.replace(/[\/\\]+$/, "");
101-
return relativeDir ? relativeDir + "/" + name : name;
102-
}
99+
if (name)
103100
return name;
104-
}
105-
106101
return /\.txt$/i.test(note.fileName) ? note.fileName.slice(0, note.fileName.length - 4) : note.fileName;
107102
}
108103

0 commit comments

Comments
 (0)