support internal links with vue-router outside vue context

This commit is contained in:
lightling 2024-05-16 18:09:12 -04:00
parent 10dc4372c0
commit af5ec7a9dc
5 changed files with 30 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import hljs from 'highlight.js'
import { marked } from 'marked'
import { markedHighlight } from 'marked-highlight'
import type { RoutedWindow } from '@goldenwere/static-web-templates-types'
import { registerLinkEmbed } from '@goldenwere/static-web-templates-embeds'
import main from './main.vue'
@ -12,6 +13,8 @@ import './main.sass'
import { createRoutes, initializeRouteStore } from './routes'
import { headingSectionsExtension } from './utilities/marked'
declare const window: RoutedWindow
marked
.use(headingSectionsExtension() as any)
.use(markedHighlight({
@ -30,7 +33,7 @@ export const createApp = ViteSSG(
// function to have custom setups
({ app, router, routes, isClient, initialState }) => {
registerLinkEmbed()
window.router = router
app.use(createPinia())
initializeRouteStore(routes)
},

View file

@ -52,6 +52,7 @@ onMounted(async () => {
title.value = getTitleFromEntryOrId(entry.value, id.value)
document.title = routeSubConfig.fullTitle?.replace('$ENTRY', title.value)
routeStore.setBreadcrumbs(currentRoute, title.value)
window.routeConfig = {...routeConfig}
window.routeSubConfig = {...routeSubConfig}
window.routeContentConfig = {...entry.value}

View file

@ -34,6 +34,7 @@ onMounted(async () => {
content.value = md
document.title = routeSubConfig.fullTitle?.replace('$PROJECT', info.value.title)
routeStore.setBreadcrumbs(currentRoute, info.value.title)
window.routeConfig = {...routeConfig}
window.routeSubConfig = {...routeSubConfig}
window.routeContentConfig = {...info.value}