Strony artykułów, sitemap, GA4, polityka prywatności
- Klikalne kafelki i slideshow → /blog/[slug] - Strona artykułu: cover fullwidth z parallax, tytuł nad obrazkiem - Schema.org BlogPosting na stronach postów - Dynamiczny sitemap.xml (artykuły + produkty z Directus, revalidate=0) - Google Analytics GA4 (G-7067BL7TDN) - Polityka prywatności /polityka-prywatnosci - CookieBanner z linkiem do polityki - Footer: działający link do polityki prywatności Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
export const revalidate = 0
|
||||
|
||||
const BASE_URL = 'https://labai.pro'
|
||||
const DIRECTUS = 'https://cms.dexterlab.pl'
|
||||
|
||||
async function fetchSlugs() {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${DIRECTUS}/items/LabAI?filter[status][_eq]=published&fields=Slug,date_updated&limit=-1`
|
||||
)
|
||||
return res.ok ? (await res.json()).data ?? [] : []
|
||||
} catch { return [] }
|
||||
}
|
||||
|
||||
async function fetchProducts() {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${DIRECTUS}/items/products?filter[site][_eq]=labai.pro&filter[status][_eq]=published&fields=id,date_updated&limit=-1`
|
||||
)
|
||||
return res.ok ? (await res.json()).data ?? [] : []
|
||||
} catch { return [] }
|
||||
}
|
||||
|
||||
export default async function sitemap() {
|
||||
const [articles, products] = await Promise.all([fetchSlugs(), fetchProducts()])
|
||||
|
||||
const static_pages = [
|
||||
{ url: `${BASE_URL}/`, lastModified: new Date(), changeFrequency: 'daily', priority: 1 },
|
||||
{ url: `${BASE_URL}/produkty`, lastModified: new Date(), changeFrequency: 'weekly', priority: 0.8 },
|
||||
{ url: `${BASE_URL}/kontakt`, lastModified: new Date(), changeFrequency: 'monthly', priority: 0.5 },
|
||||
]
|
||||
|
||||
const article_pages = articles
|
||||
.filter(a => a.Slug)
|
||||
.map(a => ({
|
||||
url: `${BASE_URL}/blog/${a.Slug}`,
|
||||
lastModified: a.date_updated ? new Date(a.date_updated) : new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.7,
|
||||
}))
|
||||
|
||||
const product_pages = products.map(p => ({
|
||||
url: `${BASE_URL}/produkty#${p.id}`,
|
||||
lastModified: p.date_updated ? new Date(p.date_updated) : new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.6,
|
||||
}))
|
||||
|
||||
return [...static_pages, ...article_pages, ...product_pages]
|
||||
}
|
||||
Reference in New Issue
Block a user