api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>"> <% if (!isDev && !note.isLabelTruthy("shareOmitDefaultCss")) { %> <% } %> <% for (const cssRelation of note.getRelations("shareCss")) { %> <% } %> <% for (const jsRelation of note.getRelations("shareJs")) { %> <% } %> <% if (note.hasLabel("shareDisallowRobotIndexing")) { %> <% } %> <% const pageTitle = `${note.title}${note.noteId !== subRoot.note.noteId ? ` - ${subRoot.note.title}` : ""}`; // Setup some key OpenGraph variables const openGraphColor = subRoot.note.getLabelValue("shareOpenGraphColor"); const openGraphURL = subRoot.note.getLabelValue("shareOpenGraphURL"); const openGraphDomain = subRoot.note.getLabelValue("shareOpenGraphDomain"); let openGraphImage = subRoot.note.getLabelValue("shareOpenGraphImage"); // Relation takes priority and requires some altering if (subRoot.note.hasRelation("shareOpenGraphImage")) { openGraphImage = `api/images/${subRoot.note.getRelation("shareOpenGraphImage").value}/image.png`; } %> <%= pageTitle %> "> "> "> <% const customLogoId = subRoot.note.getRelation("shareLogo")?.value; const logoUrl = customLogoId ? `api/images/${customLogoId}/image.png` : `../${assetUrlFragment}/images/icon-color.svg`; const logoWidth = subRoot.note.getLabelValue("shareLogoWidth") ?? 53; const logoHeight = subRoot.note.getLabelValue("shareLogoHeight") ?? 40; const mobileLogoHeight = logoHeight && logoWidth ? 32 / (logoWidth / logoHeight) : ""; const shareRootLink = subRoot.note.hasLabel("shareRootLink") ? subRoot.note.getLabelValue("shareRootLink") : `./${subRoot.note.noteId}`; const currentTheme = note.getLabel("shareTheme") === "light" ? "light" : "dark"; const themeClass = currentTheme === "light" ? " theme-light" : " theme-dark"; const headingRe = /()(.+?)(<\/h[1-6]>)/g; const headingMatches = [...content.matchAll(headingRe)]; const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-"); const hasTree = subRoot.note.hasVisibleChildren(); content = content.replaceAll(headingRe, (...match) => { match[0] = match[0].replace(match[3], `#${match[3]}`); return match[0]; }); %>
Logo <%= subRoot.note.title %>
ck-content<% } %><% if (isEmpty) { %> no-content<% } %>">

<%= note.title %>

<% if (isEmpty && (!note.hasVisibleChildren() && note.type !== "book")) { %>

This note has no content.

<% } else { %> <% content = content.replace(/${t( <%- content %> <% } %>
<% if (note.hasVisibleChildren() || note.type === "book") { %> <% } %>
<% if (!isEmpty) { %>
<% const lastUpdated = new Date(note.utcDateModified); %> <%- t("share_theme.last-updated", { date: ``}) %>
<% } %> <% if (hasTree) { %> <%- include("prev_next", { note: note, subRoot: subRoot }) %> <% } %>
<% if (headingMatches.length > 1) { const level = (m) => parseInt(m[1].replace(/[]+/g, "")); const toc = [ { level: level(headingMatches[0]), name: headingMatches[0][2], children: [] } ]; const last = (arr = toc) => arr[arr.length - 1]; const makeEntry = (m) => ({level: level(m), name: m[2], children: []}); const getLevelArr = (lvl, arr = toc) => { if (arr[0].level === lvl) return arr; const top = last(arr); return top.children.length ? getLevelArr(lvl, top.children) : top.children; }; for (let m = 1; m < headingMatches.length; m++) { const target = getLevelArr(level(headingMatches[m])); target.push(makeEntry(headingMatches[m])); } %>

<%= t("share_theme.on-this-page") %>

    <% for (const entry of toc) { %> <%- include("toc_item", {entry}) %> <% } %>
<% } %>