Skip to content

Commit 3d63fd6

Browse files
committed
feat: breadcrumbs
1 parent 5e1507b commit 3d63fd6

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

app/pages/people/[slug].vue

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<LazyPeopleAddModal />
1111
</template>
1212
</UDashboardNavbar>
13+
14+
<UDashboardToolbar>
15+
<UBreadcrumb :items="breadcrumbs" />
16+
</UDashboardToolbar>
1317
</template>
1418
<template #body>
1519
<div v-if="person">
@@ -29,7 +33,8 @@
2933
<script setup lang="ts">
3034
import { useRouteParams } from '@vueuse/router'
3135
32-
const { locale } = useI18n()
36+
const { locale, t } = useI18n()
37+
const localePath = useLocalePath()
3338
const i18nStore = useI18nStore()
3439
const supabase = useSupabaseClient()
3540
const slug = useRouteParams<string>('slug')
@@ -39,8 +44,37 @@ const { data: person } = await useAsyncData(`person-${slug.value}`, async () =>
3944
return data
4045
})
4146
47+
const name = computed(() =>
48+
person.value ? i18nStore.translate(person.value.name) : 'Page not found'
49+
)
50+
51+
const breadcrumbs = computed(() => [
52+
{
53+
icon: 'i-lucide-home',
54+
label: t('home.title'),
55+
to: localePath('/')
56+
},
57+
{
58+
icon: 'i-lucide-users',
59+
label: t('people.title'),
60+
to: localePath('/people')
61+
},
62+
{
63+
icon: 'i-lucide-user',
64+
label: name.value,
65+
to: localePath(`/people/${slug.value}`)
66+
}
67+
])
68+
69+
useSchemaOrg([
70+
defineWebPage({ '@type': 'ItemPage' }),
71+
defineBreadcrumb({
72+
itemListElement: breadcrumbs.value.map((b) => ({ item: b.to, name: b.label }))
73+
})
74+
])
75+
4276
useSeoMeta({
4377
description: person.value?.description?.[locale.value] || undefined,
44-
title: person.value ? i18nStore.translate(person.value.name) : undefined
78+
title: name.value
4579
})
4680
</script>

app/pages/people/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const { t } = useI18n()
4646
const supabase = useSupabaseClient()
4747
const dataTable = useTemplateRef('table')
4848
49+
useSchemaOrg([defineWebPage({ '@type': 'CollectionPage' })])
50+
4951
useSeoMeta({
5052
description: t('people.description'),
5153
title: t('people.title')
@@ -108,7 +110,7 @@ const columns = computed((): TableColumn<Tables<'people'>>[] => [
108110
cell: ({ row }) =>
109111
actionCell([
110112
{ label: t('general.actions'), type: 'label' },
111-
{ icon: 'i-lucide-list', label: t('person.view'), to: `/people/${row.original.id}` },
113+
{ icon: 'i-lucide-list', label: t('person.view'), to: `/people/${row.original.slug}` },
112114
{ icon: 'i-lucide-edit', label: t('person.edit') },
113115
{ type: 'separator' },
114116
{

nuxt.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { LocaleObject } from '@nuxtjs/i18n'
22

33
import { fileURLToPath } from 'node:url'
4+
import { defineOrganization } from 'nuxt-schema-org/schema'
45

56
import type { AppLocale } from './shared/types/general.types'
67

@@ -62,6 +63,10 @@ export default defineNuxtConfig({
6263
}
6364
},
6465

66+
schemaOrg: {
67+
identity: defineOrganization({ name: process.env.NUXT_SITE_NAME || 'BibleTime' })
68+
},
69+
6570
seo: { fallbackTitle: false },
6671

6772
sitemap: {

0 commit comments

Comments
 (0)