File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
app/[locale]/blog/[...path] Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ export const generateViewport = basePage.generateViewport;
1515
1616// This generates each page's HTML Metadata
1717// @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
18- export const generateMetadata = basePage . generateMetadata ;
18+ export const generateMetadata = ( { params } : PageParams ) =>
19+ basePage . generateMetadata ( { params, prefix : 'blog' } ) ;
1920
2021// Generates all possible static paths based on the locales and environment configuration
2122// - Returns an empty array if static export is disabled (`ENABLE_STATIC_EXPORT` is false)
Original file line number Diff line number Diff line change 1+ import { join } from 'node:path' ;
2+
13import { notFound , redirect } from 'next/navigation' ;
24import { setRequestLocale } from 'next-intl/server' ;
35
@@ -23,15 +25,19 @@ export const generateViewport = () => ({ ...PAGE_VIEWPORT });
2325 *
2426 * @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
2527 *
26- * @param {{ params: Promise<{ path: Array<string>; locale: string }> } } props
28+ * @param {{ params: Promise<{ path: Array<string>; locale: string }>, prefix?: string } } props
2729 * @returns {Promise<import('next').Metadata> } the metadata for the page
2830 */
29- export const generateMetadata = async props => {
30- const { path = [ ] , locale = defaultLocale . code } = await props . params ;
31+ export const generateMetadata = async ( { params , prefix } ) => {
32+ const { path = [ ] , locale = defaultLocale . code } = await params ;
3133
3234 const pathname = dynamicRouter . getPathname ( path ) ;
3335
34- return dynamicRouter . getPageMetadata ( locale , pathname ) ;
36+ return dynamicRouter . getPageMetadata (
37+ locale ,
38+ // If there's a prefix, `join` it with the pathname
39+ prefix ? join ( prefix , pathname ) : pathname
40+ ) ;
3541} ;
3642
3743/**
You can’t perform that action at this time.
0 commit comments