cfg: make SPA optional
This commit is contained in:
parent
fc89ff2680
commit
24d08d580d
@ -35,6 +35,7 @@ const removeMarkdown = (
|
||||
.replace(/<[^>]*>/g, '')
|
||||
.replace(/^[=\-]{2,}\s*$/g, '')
|
||||
.replace(/\[\^.+?\](\: .*?$)?/g, '')
|
||||
.replace(/(#{1,6})\s+(.+)\1?/g, '<b>$2</b>')
|
||||
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
|
||||
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? '$1' : '')
|
||||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
||||
@ -143,7 +144,7 @@ const removeMarkdown = (
|
||||
// SPA navigation
|
||||
window.navigate(
|
||||
new URL(
|
||||
`${BASE_URL.slice(0, -1)}${id}#:~:text=${encodeURIComponent(term)}/`
|
||||
`${BASE_URL}${id}#:~:text=${encodeURIComponent(term)}/`
|
||||
),
|
||||
'.singlePage'
|
||||
)
|
||||
|
@ -3,6 +3,7 @@ enableToc: true
|
||||
openToc: false
|
||||
enableLinkPreview: true
|
||||
enableLatex: true
|
||||
enableSPA: false
|
||||
description:
|
||||
Host your second brain and digital garden for free. Quartz features extremely fast full-text search,
|
||||
Wikilink support, backlinks, local graph, tags, and link previews.
|
||||
|
@ -10,6 +10,7 @@
|
||||
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
|
||||
{{- range $cleanedInbound | uniq -}}
|
||||
{{$l := printf "%s%s/" $host .}}
|
||||
{{$l = cond (eq $l "//") "/" $l}}
|
||||
{{with (index $contentTable .)}}
|
||||
<li>
|
||||
<a href="{{$l}}">{{index (index . "title")}}</a>
|
||||
|
@ -16,3 +16,14 @@
|
||||
</style>
|
||||
{{ $js := resources.Get "js/graph.js" | resources.Fingerprint "md5" }}
|
||||
<script src="{{ $js.Permalink }}"></script>
|
||||
<script>
|
||||
drawGraph(
|
||||
{{strings.TrimRight "/" .Page.Permalink}},
|
||||
{{strings.TrimRight "/" .Site.BaseURL}},
|
||||
{{$.Site.Data.graphConfig.paths}},
|
||||
{{$.Site.Data.graphConfig.depth}},
|
||||
{{$.Site.Data.graphConfig.enableDrag}},
|
||||
{{$.Site.Data.graphConfig.enableLegend}},
|
||||
{{$.Site.Data.graphConfig.enableZoom}}
|
||||
);
|
||||
</script>
|
||||
|
@ -58,6 +58,7 @@
|
||||
content,
|
||||
}))
|
||||
</script>
|
||||
{{if $.Site.Data.config.enableSPA}}
|
||||
<script type="module">
|
||||
import { router, navigate } from "https://unpkg.com/million/dist/router.mjs";
|
||||
// SPA navigation for access later
|
||||
@ -89,5 +90,8 @@
|
||||
window.addEventListener("million:navigate", callback);
|
||||
window.addEventListener("DOMContentLoaded", callback);
|
||||
</script>
|
||||
{{else}}
|
||||
<script>window.navigate = (url) => window.location.href = url</script>
|
||||
{{end}}
|
||||
</head>
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
|
Loading…
Reference in New Issue
Block a user