Unverified Commit 2a5c5589 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Skip favicon.js for metadata (#47790)

For backward compatibility, we only handle `favicon.ico` file to
generate `/favicon.ico` route and link tag. If you want to use other
extension such as `png`, use `icon(\d)?.[ext]`
parent 57d51b0e
......@@ -86,7 +86,10 @@ export async function createStaticMetadataFromRoute(
const resolvedMetadataFiles = await enumMetadataFiles(
resolvedDir,
STATIC_METADATA_IMAGES[type].filename,
pageExtensions.concat(STATIC_METADATA_IMAGES[type].extensions),
[
...STATIC_METADATA_IMAGES[type].extensions,
...(type === 'favicon' ? [] : pageExtensions),
],
opts
)
resolvedMetadataFiles
......
// This file should be ignored
import { ImageResponse } from 'next/server'
export default function favicon() {
return new ImageResponse(
(
<div
style={{
width: '100%',
height: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 88,
background: '#fff',
color: '#000',
}}
>
Favicon
</div>
)
)
}
......@@ -155,6 +155,8 @@ createNextDescribe(
'content'
)
expect($('link[rel="favicon"]')).toHaveLength(0)
// non absolute urls
expect($icon.attr('href')).toContain('/icon')
expect($icon.attr('href')).toMatch(hashRegex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment