fix(export/share): favicon working only on top-level

This commit is contained in:
Elian Doran
2025-10-28 18:23:11 +02:00
parent 2a1ecdbdca
commit 88d90fdedd
2 changed files with 5 additions and 2 deletions

View File

@@ -81,6 +81,7 @@ export function renderNoteForExport(note: BNote, parentBranch: BBranch, basePath
`${basePath}assets/scripts.js` `${basePath}assets/scripts.js`
], ],
logoUrl: `${basePath}icon-color.svg`, logoUrl: `${basePath}icon-color.svg`,
faviconUrl: `${basePath}favicon.ico`,
ancestors, ancestors,
isStatic: true isStatic: true
}); });
@@ -128,7 +129,8 @@ export function renderNoteContent(note: SNote) {
jsToLoad, jsToLoad,
logoUrl, logoUrl,
ancestors, ancestors,
isStatic: false isStatic: false,
faviconUrl: note.hasRelation("shareFavicon") ? `api/notes/${note.getRelationValue("shareFavicon")}/download` : `../favicon.ico`
}); });
} }
@@ -140,6 +142,7 @@ interface RenderArgs {
logoUrl: string; logoUrl: string;
ancestors: string[]; ancestors: string[];
isStatic: boolean; isStatic: boolean;
faviconUrl: string;
} }
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) { function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {

View File

@@ -29,7 +29,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>"> <link rel="shortcut icon" href="<%= faviconUrl %>">
<% for (const url of cssToLoad) { %> <% for (const url of cssToLoad) { %>
<link href="<%= url %>" rel="stylesheet"> <link href="<%= url %>" rel="stylesheet">
<% } %> <% } %>