feat: add title for pages

This commit is contained in:
三咲智子 2022-11-25 19:48:48 +08:00
parent dfdf95da61
commit f54e135848
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
10 changed files with 39 additions and 2 deletions

View file

@ -2,7 +2,7 @@
import { APP_NAME } from './constants' import { APP_NAME } from './constants'
useHead({ useHead({
title: APP_NAME, titleTemplate: title => `${title ? `${title} | ` : ''}${APP_NAME}${import.meta.env.DEV ? ' (dev)' : ''}`,
link: [ link: [
{ {
rel: 'icon', type: 'image/svg+png', href: '/favicon.png', rel: 'icon', type: 'image/svg+png', href: '/favicon.png',

View file

@ -3,6 +3,12 @@ const params = useRoute().params
const accountName = $computed(() => params.account as string) const accountName = $computed(() => params.account as string)
const account = await fetchAccountByName(accountName).catch(() => null) const account = await fetchAccountByName(accountName).catch(() => null)
if (account) {
useHead({
title: `${account.displayName} (@${account.acct})`,
})
}
</script> </script>
<template> <template>

View file

@ -4,6 +4,10 @@ definePageMeta({
}) })
const paginator = masto.bookmarks.getIterator() const paginator = masto.bookmarks.getIterator()
useHead({
title: 'Bookmarks',
})
</script> </script>
<template> <template>

View file

@ -4,6 +4,10 @@ definePageMeta({
}) })
const paginator = masto.conversations.getIterator() const paginator = masto.conversations.getIterator()
useHead({
title: 'Conversations',
})
</script> </script>
<template> <template>

View file

@ -1,5 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
const paginator = masto.trends.getStatuses() const paginator = masto.trends.getStatuses()
useHead({
title: 'Explore',
})
</script> </script>
<template> <template>

View file

@ -4,6 +4,10 @@ definePageMeta({
}) })
const paginator = masto.favourites.getIterator() const paginator = masto.favourites.getIterator()
useHead({
title: 'Favourites',
})
</script> </script>
<template> <template>

View file

@ -11,6 +11,10 @@ const tab = $(useLocalStorage<typeof tabNames[number]>(STORAGE_KEY_NOTIFY_TAB, '
const paginator = $computed(() => { const paginator = $computed(() => {
return masto.notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] }) return masto.notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] })
}) })
useHead({
title: 'Notifications',
})
</script> </script>
<template> <template>

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
const paginator = masto.timelines.getPublicIterable() const paginator = masto.timelines.getPublicIterable()
useHead({
title: 'Federated'
})
</script> </script>
<template> <template>

View file

@ -1,5 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
const { data: timelines } = await useAsyncData('timelines-home', () => masto.timelines.fetchPublic({ local: true }).then(r => r.value)) const { data: timelines } = await useAsyncData('timelines-home', () => masto.timelines.fetchPublic({ local: true }).then(r => r.value))
useHead({
title: 'Local'
})
</script> </script>
<template> <template>

View file

@ -3,6 +3,10 @@ const params = useRoute().params
const tag = $computed(() => params.tag as string) const tag = $computed(() => params.tag as string)
const paginator = masto.timelines.getHashtagIterable(tag) const paginator = masto.timelines.getHashtagIterable(tag)
useHead({
title: `#${tag}`,
})
</script> </script>
<template> <template>