add titles to routes
This commit is contained in:
parent
33bf0ee1cd
commit
42d679b17b
4 changed files with 6 additions and 1 deletions
1
src/content-env.d.ts
vendored
1
src/content-env.d.ts
vendored
|
@ -14,6 +14,7 @@ declare module 'content/routes.js' {
|
||||||
id: string
|
id: string
|
||||||
stylesheetUrls: string[]
|
stylesheetUrls: string[]
|
||||||
template: Template
|
template: Template
|
||||||
|
title: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,7 @@ const routeConfig = routeStore._routes[currentRoute.path] as MarkdownDefinition
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
content.value = await fetchAndParseMarkdown(routeConfig.content)
|
content.value = await fetchAndParseMarkdown(routeConfig.content)
|
||||||
|
document.title = routeConfig.title
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ onMounted(async () => {
|
||||||
const id = projectIds.value[i]
|
const id = projectIds.value[i]
|
||||||
projects.value[id] = await fetchAndParseYaml(config.projects[id].config)
|
projects.value[id] = await fetchAndParseYaml(config.projects[id].config)
|
||||||
}
|
}
|
||||||
|
document.title = routeConfig.title
|
||||||
ready.value = true
|
ready.value = true
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
|
||||||
import type { ProjectList } from 'src/types/projects/projectList'
|
import type { ProjectList } from 'src/types/projects/projectList'
|
||||||
import { type ProjectListDefinition } from 'content/routes.js'
|
import { type ProjectListDefinition } from 'content/routes.js'
|
||||||
|
@ -21,12 +21,14 @@ const content = ref('')
|
||||||
const currentRoute = getCurrentRoute()
|
const currentRoute = getCurrentRoute()
|
||||||
const routeStore = useRouteStore()
|
const routeStore = useRouteStore()
|
||||||
const routeConfig = routeStore._routes[currentRoute.path.substring(0, currentRoute.path.length - 5)] as ProjectListDefinition
|
const routeConfig = routeStore._routes[currentRoute.path.substring(0, currentRoute.path.length - 5)] as ProjectListDefinition
|
||||||
|
const routeSubConfig = routeStore._routes[currentRoute.path]
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const config = await fetchAndParseYaml<ProjectList>(routeConfig.config)
|
const config = await fetchAndParseYaml<ProjectList>(routeConfig.config)
|
||||||
info.value = await fetchAndParseYaml<ProjectListingInfo>(config.projects[props.id].config)
|
info.value = await fetchAndParseYaml<ProjectListingInfo>(config.projects[props.id].config)
|
||||||
const md = await fetchAndParseMarkdown(config.projects[props.id].content)
|
const md = await fetchAndParseMarkdown(config.projects[props.id].content)
|
||||||
content.value = md.replace('$PERIOD', getFormattedPeriod(info.value.period!))
|
content.value = md.replace('$PERIOD', getFormattedPeriod(info.value.period!))
|
||||||
|
document.title = routeSubConfig.title.replace('$PROJECT', info.value.title)
|
||||||
|
|
||||||
ready.value = true
|
ready.value = true
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue