feat: add generateStaticParams in docs page
- Added generateStaticParams function in page.tsx to support dynamic locale and slug parameters for improved routing. - Included console logging in the search API route for better debugging and visibility of search index data.
This commit is contained in:
parent
83f5760126
commit
4fe8d78099
@ -10,6 +10,20 @@ import {
|
||||
import type { Metadata } from 'next';
|
||||
import { Locale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { LOCALES } from '@/i18n/routing';
|
||||
|
||||
export function generateStaticParams() {
|
||||
const locales = LOCALES;
|
||||
const slugParams = source.generateParams();
|
||||
const params = locales.flatMap(locale =>
|
||||
slugParams.map(param => ({
|
||||
locale,
|
||||
slug: param.slug
|
||||
}))
|
||||
);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
|
@ -19,6 +19,9 @@ export const { GET } = createI18nSearchAPI('advanced', {
|
||||
// Get all pages from all languages and map them to search indexes
|
||||
indexes: source.getLanguages().flatMap(({ language, pages }) =>
|
||||
pages.map((page) => {
|
||||
console.log('--------------------------------');
|
||||
console.log('search index', language, page.data.title, page.url);
|
||||
console.log('--------------------------------');
|
||||
return {
|
||||
title: page.data.title,
|
||||
description: page.data.description,
|
||||
|
Loading…
Reference in New Issue
Block a user