-
Notifications
You must be signed in to change notification settings - Fork 0
chore: schema on breadcrumbs #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -53,7 +53,7 @@ function updateData() { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const mainCategory = computed(() => page.value?.categories[0]?.category) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| useBreadcrumb().setItems([ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const breadcrumbItems = computed(() => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| label: 'Главная', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| icon: 'i-lucide-house', | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -71,6 +71,20 @@ useBreadcrumb().setItems([ | |||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| useBreadcrumb().setItems(breadcrumbItems.value) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| useSchemaOrg([ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| defineBreadcrumb({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| '@type': 'BreadcrumbList', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'itemListElement': breadcrumbItems.value.map((item, index) => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| '@type': 'ListItem', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'position': index + 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'name': item.label, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'item': item.to ?? undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| })), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+76
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Schema.org requires absolute URLs for breadcrumb items. The Consider constructing absolute URLs using the app configuration: +const { app } = useAppConfig()
+
useSchemaOrg([
defineBreadcrumb({
'@type': 'BreadcrumbList',
'itemListElement': breadcrumbItems.value.map((item, index) => ({
'@type': 'ListItem',
'position': index + 1,
'name': item.label,
- 'item': item.to ?? undefined,
+ 'item': item.to ? `${app.url}${item.to}` : undefined,
})),
}),
])Alternatively, omit the useSchemaOrg([
defineBreadcrumb({
'@type': 'BreadcrumbList',
'itemListElement': breadcrumbItems.value.map((item, index) => ({
'@type': 'ListItem',
'position': index + 1,
'name': item.label,
- 'item': item.to ?? undefined,
+ ...(item.to && { 'item': `${app.url}${item.to}` }),
})),
}),
])📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| useHead({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| title: `Отзывы «${page.value?.title}»`, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The
computed()property's reactivity is not being used.breadcrumbItems.valueis read once during setup, so changes topageormainCategorywon't update the breadcrumbs. Consider usingwatchorwatchEffectif reactivity is needed, or removecomputed()if it's not.Prompt for AI agents