-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect reexports from metadata API routes
- Loading branch information
Showing
6 changed files
with
137 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
export default function manifest(): MetadataRoute.Manifest { | ||
return { | ||
name: 'Next.js App', | ||
short_name: 'Next.js App', | ||
description: 'Next.js App', | ||
start_url: '/', | ||
display: 'standalone', | ||
background_color: '#fff', | ||
theme_color: '#fff', | ||
icons: [ | ||
{ | ||
src: '/favicon.ico', | ||
sizes: 'any', | ||
type: 'image/x-icon', | ||
}, | ||
], | ||
} | ||
} | ||
|
||
export const revalidate = 5 |
24 changes: 24 additions & 0 deletions
24
test/e2e/app-dir/metadata-revalidate/app/revalidate/og/opengraph-image.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ImageResponse } from 'next/og' | ||
|
||
/* without generateImageMetadata */ | ||
export default function og() { | ||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
width: '100%', | ||
height: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
fontSize: 128, | ||
background: 'lavender', | ||
}} | ||
> | ||
Open Graph | ||
</div> | ||
) | ||
) | ||
} | ||
|
||
export const revalidate = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: '*', | ||
allow: '/', | ||
disallow: '/private/', | ||
}, | ||
sitemap: 'https://acme.com/sitemap.xml', | ||
} | ||
} | ||
|
||
export const revalidate = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default function sitemap() { | ||
return [ | ||
{ | ||
url: 'https://acme.com', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
priority: 1, | ||
}, | ||
] | ||
} | ||
|
||
export const revalidate = 5 |
31 changes: 31 additions & 0 deletions
31
test/e2e/app-dir/metadata-revalidate/metadata-revalidate.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - metadata-revalidate', () => { | ||
const { next, isNextStart } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should contain the routes in prerender manifest', async () => { | ||
if (isNextStart) { | ||
const manifestContent = await next.readFile( | ||
'.next/prerender-manifest.json' | ||
) | ||
const prerenderManifest = JSON.parse(manifestContent) | ||
|
||
expect( | ||
prerenderManifest.routes['/revalidate/og/opengraph-image'] | ||
.initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/manifest.webmanifest'] | ||
.initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/robots.txt'].initialRevalidateSeconds | ||
).toBe(5) | ||
expect( | ||
prerenderManifest.routes['/sitemap.xml'].initialRevalidateSeconds | ||
).toBe(5) | ||
} | ||
}) | ||
}) |