Skip to content

Commit

Permalink
feat: add usePage in wildcard page (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothejoubert authored Oct 22, 2024
1 parent 892dede commit 190fd86
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pages/[...slug].vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts">
<script lang="ts" setup>
import type { RoadizNodesSources } from '@roadiz/types'
import { getBlockCollection } from '~/utils/roadiz/block'
import { isPageEntity } from '~/utils/roadiz/entity'
Expand Down Expand Up @@ -50,6 +50,16 @@ if (item?.url && item.url !== route.path) {
await navigateTo({ path: item?.url }, { redirectCode: 301 })
}
const nodeTitle = computed(() => {
return webResponse?.head.metaTitle || (item as { name?: string })?.name || item?.title
})
usePage({
webResponse,
alternateLinks,
title: nodeTitle.value,
})
// Get blocks from web response
const blocks = computed(() => (webResponse?.blocks && getBlockCollection(webResponse.blocks)) || [])
Expand Down

0 comments on commit 190fd86

Please sign in to comment.