feat: page title
This commit is contained in:
@@ -2,20 +2,22 @@
|
||||
import { ref, onBeforeMount } from 'vue'
|
||||
import { listArticles } from '@lib/articles'
|
||||
import type { ArticleMetadata } from '@interfaces'
|
||||
import { simpleDateFormat } from '@/lib/dates'
|
||||
import { simpleDateFormat } from '@lib/dates'
|
||||
import { TITLE } from '@lib/meta'
|
||||
import PageFooter from '@components/PageFooter.vue'
|
||||
|
||||
const articles = ref<ArticleMetadata[]>([])
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const newArticles = await listArticles()
|
||||
console.log(newArticles)
|
||||
articles.value.splice(0, articles.value.length, ...newArticles)
|
||||
window.document.title = TITLE + ' — Home'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main>
|
||||
<h1 class="title">Articles</h1>
|
||||
<h1 class="title">{{ TITLE }}</h1>
|
||||
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
||||
<div v-if="!metadata.draft && metadata.path" class="article">
|
||||
<RouterLink :to="metadata.path">
|
||||
@@ -27,5 +29,6 @@ onBeforeMount(async () => {
|
||||
</RouterLink>
|
||||
</div>
|
||||
</template>
|
||||
<PageFooter />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user