mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
chore(share): use rendered template (missing include)
This commit is contained in:
parent
2d3265136d
commit
d6bb790e26
@ -17,10 +17,7 @@ import type SAttachment from "./shaca/entities/sattachment.js";
|
||||
import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
|
||||
import options from "../services/options.js";
|
||||
import { t } from "i18next";
|
||||
import shareThemeRoot from "@triliumnext/share-theme/templates/page.ejs";
|
||||
import shareThemeTreeItem from "@triliumnext/share-theme/templates/tree_item.ejs";
|
||||
import shareThemeTocItem from "@triliumnext/share-theme/templates/toc_item.ejs";
|
||||
import shareThemeCss from "@triliumnext/share-theme/styles.css";
|
||||
import shareTheme from "@triliumnext/share-theme/templates.js";
|
||||
import ejs from "ejs";
|
||||
|
||||
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
|
||||
@ -214,22 +211,8 @@ function register(router: Router) {
|
||||
}
|
||||
|
||||
if (useDefaultView) {
|
||||
const ejsResult = ejs.render(shareThemeRoot, {
|
||||
shareThemeCss,
|
||||
...opts
|
||||
}, {
|
||||
includer(originalPath, parsedPath: string) {
|
||||
switch (originalPath) {
|
||||
case "tree_item":
|
||||
return { template: shareThemeTreeItem };
|
||||
case "toc_item":
|
||||
return { template: shareThemeTocItem };
|
||||
default:
|
||||
throw new Error(`Unable to find template for ${originalPath}`);
|
||||
}
|
||||
}
|
||||
})
|
||||
res.send(ejsResult);
|
||||
const result = shareTheme(opts);
|
||||
res.send(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<%
|
||||
const { note, subRoot, assetPath, appPath } = locals;
|
||||
let content = locals.content;
|
||||
%>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
@ -56,9 +60,6 @@ const customServerYml = `- url: "{protocol}://{domain}:{port}/etapi"
|
||||
<% if (note.hasLabel("shareDisallowRobotIndexing")) { %>
|
||||
<meta name="robots" content="noindex,follow" />
|
||||
<% } %>
|
||||
<style>
|
||||
<%- shareThemeCss %>
|
||||
</style>
|
||||
|
||||
<%
|
||||
const pageTitle = `${note.title}${note.noteId !== subRoot.note.noteId ? ` - ${subRoot.note.title}` : ""}`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user