Skip to content

Build your personal knowledge base with Trilium Notes

feat(export/zip): basic tree navigation

Elian Dorand8958adea5c1
diff --git a/apps/server/src/services/export/zip.ts b/apps/server/src/services/export/zip.ts
index 8d8d2de074..bb3e382be0 100644
--- a/apps/server/src/services/export/zip.ts
+++ b/apps/server/src/services/export/zip.ts
@@ -333,6 +333,9 @@ async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "h
if (note) {
content = renderNoteForExport(note, branch, basePath);
+
+ // TODO: Fix double rewrite.
+ content = rewriteFn(content, noteMeta);
} else {
const cssUrl = basePath + "style.css";
// <base> element will make sure external links are openable - https://github.com/zadam/trilium/issues/1289#issuecomment-704066809
diff --git a/packages/share-theme/src/templates/tree_item.ejs b/packages/share-theme/src/templates/tree_item.ejs
index b033ad2bc1..99da978fa6 100644
--- a/packages/share-theme/src/templates/tree_item.ejs
+++ b/packages/share-theme/src/templates/tree_item.ejs
@@ -1,7 +1,16 @@
<%
const linkClass = `type-${note.type}` + (activeNote.noteId === note.noteId ? " active" : "");
const isExternalLink = note.hasLabel("shareExternal");
-const linkHref = isExternalLink ? note.getLabelValue("shareExternal") : `./${note.shareId}`;
+let linkHref;
+
+if (isExternalLink) {
+ linkHref = note.getLabelValue("shareExternal");
+} else if (note.shareId) {
+ linkHref = `./${note.shareId}`;
+} else {
+ linkHref = `#${note.getBestNotePath().join("/")}`;
+}
+
const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : "";
%>