- the module registers seo-sitemap-<locale> at seo.htmlSitemap.paths (defaults pl /mapa-strony, en /sitemap) and seo-sitemap-group-<locale> at <path>/:group (plus <path>/:group/<segment>/:page in the path form); a path an app page already has stays the app's - SeoHtmlSitemapPage (global, overridable): H1, an H2 per non-empty group, categories nested, a large group's link to its group page, sitemap.empty; group pages with a built trail, page suffix and <SeoPagination>; 404 for an unknown group or a page past the last, 301 for ?page=1, 503 when the sitemap API fails - GET /api/__seo__/sitemap proxies the sitemap plugin's HTML API (only while the CMS has the HTML sitemap on for the locale) - <SeoSitemapLink>: the footer link while the HTML sitemap is on - L3 default styles
27 lines
1.2 KiB
Vue
27 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
// The footer link to the HTML sitemap of the page's locale (UI-SPEC L4,
|
|
// D-34): rendered only while the CMS has the HTML sitemap on for that
|
|
// locale and the layer serves it (seo.htmlSitemap). No style of its own
|
|
// beyond the inherited link colour.
|
|
const props = withDefaults(defineProps<{ locale?: string }>(), { locale: '' })
|
|
|
|
const config = useRuntimeConfig()
|
|
const answer = useSeoAnswer()
|
|
const { data: site } = await useSeoSite()
|
|
const primary = (code: string | undefined | null) => (code ?? '').toLowerCase().split(/[-_]/)[0] ?? ''
|
|
|
|
const locale = computed(() => props.locale || answer.value?.locale || primary(answer.value?.html_lang) || site.value?.default_locale || '')
|
|
const labels = useSeoLabels(locale)
|
|
const href = computed(() => {
|
|
const html = site.value?.html_sitemap
|
|
if (!html || html.enabled !== true || !html.paths || !html.paths[locale.value]) return ''
|
|
const own = (config.public.seo as { htmlSitemap?: { paths?: Record<string, string> } | false } | undefined)?.htmlSitemap
|
|
if (!own || typeof own !== 'object') return ''
|
|
return own.paths?.[locale.value] ?? ''
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<NuxtLink v-if="href" class="seo-sitemap-link" :to="href">{{ labels.sitemapLink }}</NuxtLink>
|
|
</template>
|