Files
vue-seo-layer/app/components/Seo/SitemapList.vue
Jakub Zych aee6957bd6 feat: HTML sitemap pages and footer link
- 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
2026-11-04 12:00:00 +01:00

25 lines
1.0 KiB
Vue

<script setup lang="ts">
// One list of the HTML sitemap (UI-SPEC L3): an entry per link, children
// (the category tree) nested as a list inside their parent's item, no
// headings below the group's H2.
import { seoSitePath } from '../../utils/sitePath.ts'
import type { SeoSitemapEntry } from '../../utils/types.ts'
const props = defineProps<{ entries: SeoSitemapEntry[]; origin?: string }>()
const rows = computed(() =>
(Array.isArray(props.entries) ? props.entries : [])
.filter((e) => e && typeof e.title === 'string' && e.title !== '')
.map((e) => ({ title: e.title, to: seoSitePath(e.url, props.origin), children: Array.isArray(e.children) ? e.children : [] })),
)
</script>
<template>
<ul v-if="rows.length > 0" class="seo-sitemap__list">
<li v-for="(row, i) in rows" :key="i" class="seo-sitemap__item">
<NuxtLink v-if="row.to" :to="row.to">{{ row.title }}</NuxtLink>
<span v-else>{{ row.title }}</span>
<SitemapList v-if="row.children.length > 0" :entries="row.children" :origin="origin" />
</li>
</ul>
</template>