feat: page title

This commit is contained in:
2026-04-24 23:43:08 +02:00
parent 8bec21c12d
commit 9bae3a813d
11 changed files with 50 additions and 24 deletions
+6 -16
View File
@@ -5,10 +5,11 @@ import { loadArticle } from '@lib/articles'
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
import NotFoundView from './NotFoundView.vue'
import { dateFromParts, simpleDateFormat } from '@lib/dates'
import { NAME, REPOSITORY, VERSION } from '@lib/meta'
import { SIGNATURE, TITLE } from '@lib/meta'
import PageFooter from '@components/PageFooter.vue'
const article = ref<Article | null>(null)
const loading = ref<Boolean>(true)
const loading = ref<boolean>(true)
const route = useRoute()
async function loadPage(target: RouteLocation) {
@@ -20,13 +21,10 @@ async function loadPage(target: RouteLocation) {
target.params.day as string,
),
)
window.document.title = TITLE + ' — ' + (article.value?.metadata.title ?? 'Not Found')
loading.value = false
}
function scrollTop() {
window.scrollTo(0, 0)
}
onBeforeMount(() => loadPage(route))
onBeforeRouteUpdate(loadPage)
</script>
@@ -50,17 +48,9 @@ onBeforeRouteUpdate(loadPage)
</div>
<img id="thumbnail" :src="article.metadata.thumbnail" alt="thumbnail" />
<div id="text" v-html="article.html"></div>
<div id="signature">TODO signature</div>
<div id="signature" v-html="SIGNATURE"></div>
<br />
<a @click.prevent="scrollTop" href="#">Go to top</a> -
<RouterLink to="/">Back to home</RouterLink>
<hr />
<footer>
<small>
{{ new Date().getFullYear() }} - Made with <a :href="REPOSITORY">{{ NAME }}</a>
{{ VERSION }}
</small>
</footer>
<PageFooter />
</main>
</template>
</template>