File tree Expand file tree Collapse file tree 5 files changed +10
-19
lines changed
content/en/patterns/navigation Expand file tree Collapse file tree 5 files changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ export const size = {
10
10
11
11
export async function GET ( req : NextRequest ) {
12
12
try {
13
- // Get the language from the URL
14
- const lang = req . nextUrl . pathname . split ( '/' ) [ 1 ] || 'en'
15
-
16
13
// Get the base URL from the request
17
14
const protocol = req . headers . get ( 'x-forwarded-proto' ) || 'http'
18
15
const host = req . headers . get ( 'host' ) || 'localhost:3000'
@@ -45,6 +42,7 @@ export async function GET(req: NextRequest) {
45
42
backgroundColor : '#000' ,
46
43
} }
47
44
>
45
+ { /* eslint-disable-next-line @next/next/no-img-element */ }
48
46
< img
49
47
src = { dataUrl }
50
48
alt = ""
Original file line number Diff line number Diff line change @@ -13,9 +13,15 @@ export async function generateMetadata() {
13
13
export const Blog : FC < { lang : string } > = async ( { lang } ) => {
14
14
const pageMap = ( await getPageMap ( `/${ lang } /blog` ) ) as unknown as MdxFile [ ]
15
15
16
- return pageMap . map ( page => {
17
- if ( page . name === 'index' ) return
16
+ const sortedPages = pageMap
17
+ . filter ( page => page . name !== 'index' )
18
+ . sort ( ( a , b ) => {
19
+ const dateA = new Date ( a . frontMatter ?. date ) . getTime ( )
20
+ const dateB = new Date ( b . frontMatter ?. date ) . getTime ( )
21
+ return dateB - dateA
22
+ } )
18
23
24
+ return sortedPages . map ( page => {
19
25
const { title, description, date } = page . frontMatter !
20
26
21
27
return (
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export async function GET(req: NextRequest) {
49
49
backgroundColor : '#000' ,
50
50
} }
51
51
>
52
+ { /* eslint-disable-next-line @next/next/no-img-element */ }
52
53
< img
53
54
src = { dataUrl }
54
55
alt = ""
Load Diff This file was deleted.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments