Unverified Commit a5fe64cd authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Static og and twitter image files as metadata (#45797)

## Feature

Closes NEXT-265
Fixes NEXT-516


- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
parent 8fb2f591
...@@ -61,7 +61,7 @@ import { AppBuildManifestPlugin } from './webpack/plugins/app-build-manifest-plu ...@@ -61,7 +61,7 @@ import { AppBuildManifestPlugin } from './webpack/plugins/app-build-manifest-plu
import { SubresourceIntegrityPlugin } from './webpack/plugins/subresource-integrity-plugin' import { SubresourceIntegrityPlugin } from './webpack/plugins/subresource-integrity-plugin'
import { FontLoaderManifestPlugin } from './webpack/plugins/font-loader-manifest-plugin' import { FontLoaderManifestPlugin } from './webpack/plugins/font-loader-manifest-plugin'
import { getSupportedBrowsers } from './utils' import { getSupportedBrowsers } from './utils'
import { METADATA_IMAGE_RESOURCE_QUERY } from './webpack/loaders/app-dir/metadata' import { METADATA_IMAGE_RESOURCE_QUERY } from './webpack/loaders/metadata/discover'
const EXTERNAL_PACKAGES = require('../lib/server-external-packages.json') const EXTERNAL_PACKAGES = require('../lib/server-external-packages.json')
......
import type webpack from 'webpack' import type webpack from 'webpack'
import type { AppLoaderOptions } from '../next-app-loader' import type { AppLoaderOptions } from '../next-app-loader'
import type { CollectingMetadata } from './types'
import path from 'path' import path from 'path'
import { stringify } from 'querystring' import { stringify } from 'querystring'
type PossibleImageFileNameConvention =
| 'icon'
| 'apple'
| 'favicon'
| 'twitter'
| 'opengraph'
const METADATA_TYPE = 'metadata' const METADATA_TYPE = 'metadata'
export const METADATA_IMAGE_RESOURCE_QUERY = '?__next_metadata' export const METADATA_IMAGE_RESOURCE_QUERY = '?__next_metadata'
...@@ -14,12 +22,20 @@ const staticAssetIconsImage = { ...@@ -14,12 +22,20 @@ const staticAssetIconsImage = {
}, },
apple: { apple: {
filename: 'apple-icon', filename: 'apple-icon',
extensions: ['jpg', 'jpeg', 'png', 'svg'], extensions: ['jpg', 'jpeg', 'png'],
}, },
favicon: { favicon: {
filename: 'favicon', filename: 'favicon',
extensions: ['ico'], extensions: ['ico'],
}, },
opengraph: {
filename: 'opengraph-image',
extensions: ['jpg', 'jpeg', 'png', 'gif'],
},
twitter: {
filename: 'twitter-image',
extensions: ['jpg', 'jpeg', 'png', 'gif'],
},
} }
// Produce all compositions with filename (icon, apple-icon, etc.) with extensions (png, jpg, etc.) // Produce all compositions with filename (icon, apple-icon, etc.) with extensions (png, jpg, etc.)
...@@ -77,12 +93,11 @@ export async function discoverStaticMetadataFiles( ...@@ -77,12 +93,11 @@ export async function discoverStaticMetadataFiles(
} }
) { ) {
let hasStaticMetadataFiles = false let hasStaticMetadataFiles = false
const iconsMetadata: { const staticImagesMetadata: CollectingMetadata = {
icon: string[]
apple: string[]
} = {
icon: [], icon: [],
apple: [], apple: [],
twitter: [],
opengraph: [],
} }
const opts = { const opts = {
...@@ -95,7 +110,9 @@ export async function discoverStaticMetadataFiles( ...@@ -95,7 +110,9 @@ export async function discoverStaticMetadataFiles(
assetPrefix: loaderOptions.assetPrefix, assetPrefix: loaderOptions.assetPrefix,
} }
async function collectIconModuleIfExists(type: 'icon' | 'apple' | 'favicon') { async function collectIconModuleIfExists(
type: PossibleImageFileNameConvention
) {
const resolvedMetadataFiles = await enumMetadataFiles( const resolvedMetadataFiles = await enumMetadataFiles(
resolvedDir, resolvedDir,
staticAssetIconsImage[type].filename, staticAssetIconsImage[type].filename,
...@@ -105,19 +122,21 @@ export async function discoverStaticMetadataFiles( ...@@ -105,19 +122,21 @@ export async function discoverStaticMetadataFiles(
resolvedMetadataFiles resolvedMetadataFiles
.sort((a, b) => a.localeCompare(b)) .sort((a, b) => a.localeCompare(b))
.forEach((filepath) => { .forEach((filepath) => {
const iconModule = `() => import(/* webpackMode: "eager" */ ${JSON.stringify( const imageModule = `() => import(/* webpackMode: "eager" */ ${JSON.stringify(
`next-metadata-image-loader?${stringify( `next-metadata-image-loader?${stringify({
metadataImageLoaderOptions ...metadataImageLoaderOptions,
)}!` + numericSizes:
type === 'twitter' || type === 'opengraph' ? '1' : undefined,
})}!` +
filepath + filepath +
METADATA_IMAGE_RESOURCE_QUERY METADATA_IMAGE_RESOURCE_QUERY
)})` )})`
hasStaticMetadataFiles = true hasStaticMetadataFiles = true
if (type === 'favicon') { if (type === 'favicon') {
iconsMetadata.icon.unshift(iconModule) staticImagesMetadata.icon.unshift(imageModule)
} else { } else {
iconsMetadata[type].push(iconModule) staticImagesMetadata[type].push(imageModule)
} }
}) })
} }
...@@ -125,10 +144,12 @@ export async function discoverStaticMetadataFiles( ...@@ -125,10 +144,12 @@ export async function discoverStaticMetadataFiles(
await Promise.all([ await Promise.all([
collectIconModuleIfExists('icon'), collectIconModuleIfExists('icon'),
collectIconModuleIfExists('apple'), collectIconModuleIfExists('apple'),
collectIconModuleIfExists('opengraph'),
collectIconModuleIfExists('twitter'),
isRootLayer && collectIconModuleIfExists('favicon'), isRootLayer && collectIconModuleIfExists('favicon'),
]) ])
return hasStaticMetadataFiles ? iconsMetadata : null return hasStaticMetadataFiles ? staticImagesMetadata : null
} }
export function buildMetadata( export function buildMetadata(
...@@ -137,7 +158,9 @@ export function buildMetadata( ...@@ -137,7 +158,9 @@ export function buildMetadata(
return metadata return metadata
? `${METADATA_TYPE}: { ? `${METADATA_TYPE}: {
icon: [${metadata.icon.join(',')}], icon: [${metadata.icon.join(',')}],
apple: [${metadata.apple.join(',')}] apple: [${metadata.apple.join(',')}],
opengraph: [${metadata.opengraph.join(',')}],
twitter: [${metadata.twitter.join(',')}],
}` }`
: '' : ''
} }
...@@ -5,7 +5,29 @@ export type ModuleReference = [ ...@@ -5,7 +5,29 @@ export type ModuleReference = [
filePath: string filePath: string
] ]
// Contain the collecting image module paths
export type CollectingMetadata = {
icon: string[]
apple: string[]
twitter: string[]
opengraph: string[]
}
// Contain the collecting evaluated image module
export type CollectedMetadata = { export type CollectedMetadata = {
icon: ComponentModule[] icon: ComponentModule[]
apple: ComponentModule[] apple: ComponentModule[]
twitter: ComponentModule[] | null
opengraph: ComponentModule[] | null
} }
export type MetadataImageModule = {
url: string
type?: string
} & (
| { sizes?: string }
| {
width?: number
height?: number
}
)
import type webpack from 'webpack' import type webpack from 'webpack'
import type { ValueOf } from '../../../shared/lib/constants' import type { ValueOf } from '../../../shared/lib/constants'
import type { ModuleReference, CollectedMetadata } from './app-dir/types' import type { ModuleReference, CollectedMetadata } from './metadata/types'
import path from 'path' import path from 'path'
import chalk from 'next/dist/compiled/chalk' import chalk from 'next/dist/compiled/chalk'
...@@ -9,7 +9,7 @@ import { getModuleBuildInfo } from './get-module-build-info' ...@@ -9,7 +9,7 @@ import { getModuleBuildInfo } from './get-module-build-info'
import { verifyRootLayout } from '../../../lib/verifyRootLayout' import { verifyRootLayout } from '../../../lib/verifyRootLayout'
import * as Log from '../../../build/output/log' import * as Log from '../../../build/output/log'
import { APP_DIR_ALIAS } from '../../../lib/constants' import { APP_DIR_ALIAS } from '../../../lib/constants'
import { buildMetadata, discoverStaticMetadataFiles } from './app-dir/metadata' import { buildMetadata, discoverStaticMetadataFiles } from './metadata/discover'
const isNotResolvedError = (err: any) => err.message.includes("Can't resolve") const isNotResolvedError = (err: any) => err.message.includes("Can't resolve")
......
import type { MetadataImageModule } from './metadata/types'
import loaderUtils from 'next/dist/compiled/loader-utils3' import loaderUtils from 'next/dist/compiled/loader-utils3'
import { getImageSize } from '../../../server/image-optimizer' import { getImageSize } from '../../../server/image-optimizer'
interface Options { interface Options {
isServer: boolean
isDev: boolean isDev: boolean
assetPrefix: string assetPrefix: string
numericSizes: boolean
} }
const mimeTypeMap = { const mimeTypeMap = {
...@@ -12,11 +13,13 @@ const mimeTypeMap = { ...@@ -12,11 +13,13 @@ const mimeTypeMap = {
png: 'image/png', png: 'image/png',
ico: 'image/x-icon', ico: 'image/x-icon',
svg: 'image/svg+xml', svg: 'image/svg+xml',
} as const avif: 'image/avif',
webp: 'image/webp',
}
async function nextMetadataImageLoader(this: any, content: Buffer) { async function nextMetadataImageLoader(this: any, content: Buffer) {
const options: Options = this.getOptions() const options: Options = this.getOptions()
const { assetPrefix, isDev } = options const { assetPrefix, isDev, numericSizes } = options
const context = this.rootContext const context = this.rootContext
const opts = { context, content } const opts = { context, content }
...@@ -41,14 +44,22 @@ async function nextMetadataImageLoader(this: any, content: Buffer) { ...@@ -41,14 +44,22 @@ async function nextMetadataImageLoader(this: any, content: Buffer) {
throw err throw err
} }
const stringifiedData = JSON.stringify({ const imageData: MetadataImageModule = {
url: outputPath, url: outputPath,
...(extension in mimeTypeMap && { ...(extension in mimeTypeMap && {
type: mimeTypeMap[extension as keyof typeof mimeTypeMap], type: mimeTypeMap[extension as keyof typeof mimeTypeMap],
}), }),
...(numericSizes
? { width: imageSize.width as number, height: imageSize.height as number }
: {
sizes: sizes:
extension === 'ico' ? 'any' : `${imageSize.width}x${imageSize.height}`, extension === 'ico'
}) ? 'any'
: `${imageSize.width}x${imageSize.height}`,
}),
}
const stringifiedData = JSON.stringify(imageData)
this.emitFile(`../${isDev ? '' : '../'}${interpolatedName}`, content, null) this.emitFile(`../${isDev ? '' : '../'}${interpolatedName}`, content, null)
......
import React from 'react'
const MetadataContext = (React as any).createServerContext(null)
if (process.env.NODE_ENV !== 'production') {
MetadataContext.displayName = 'MetadataContext'
}
export function useMetadataBase() {
return React.useContext(MetadataContext)
}
export default MetadataContext
...@@ -4,6 +4,7 @@ import type { ...@@ -4,6 +4,7 @@ import type {
ResolvingMetadata, ResolvingMetadata,
} from './types/metadata-interface' } from './types/metadata-interface'
import type { AbsoluteTemplateString } from './types/metadata-types' import type { AbsoluteTemplateString } from './types/metadata-types'
import type { MetadataImageModule } from '../../build/webpack/loaders/metadata/types'
import { createDefaultMetadata } from './default-metadata' import { createDefaultMetadata } from './default-metadata'
import { resolveOpenGraph, resolveTwitter } from './resolvers/resolve-opengraph' import { resolveOpenGraph, resolveTwitter } from './resolvers/resolve-opengraph'
import { mergeTitle } from './resolvers/resolve-title' import { mergeTitle } from './resolvers/resolve-title'
...@@ -25,17 +26,63 @@ import { ...@@ -25,17 +26,63 @@ import {
} from './resolvers/resolve-basics' } from './resolvers/resolve-basics'
import { resolveIcons } from './resolvers/resolve-icons' import { resolveIcons } from './resolvers/resolve-icons'
type StaticMetadata = Awaited<ReturnType<typeof resolveStaticMetadata>>
type MetadataResolver = (
_parent: ResolvingMetadata
) => Metadata | Promise<Metadata>
export type MetadataItems = [
Metadata | MetadataResolver | null,
StaticMetadata
][]
function mergeStaticMetadata(
metadata: ResolvedMetadata,
staticFilesMetadata: StaticMetadata
) {
if (!staticFilesMetadata) return
const { icon, apple, opengraph, twitter } = staticFilesMetadata
if (icon || apple) {
if (!metadata.icons) metadata.icons = { icon: [], apple: [] }
if (icon) metadata.icons.icon.push(...icon)
if (apple) metadata.icons.apple.push(...apple)
}
if (twitter) {
const resolvedTwitter = resolveTwitter(
{
card: 'summary_large_image',
images: twitter,
},
null
)
metadata.twitter = { ...metadata.twitter, ...resolvedTwitter! }
}
if (opengraph) {
const resolvedOg = resolveOpenGraph(
{
images: opengraph,
},
null
)
metadata.openGraph = { ...metadata.openGraph, ...resolvedOg! }
}
return metadata
}
// Merge the source metadata into the resolved target metadata. // Merge the source metadata into the resolved target metadata.
function merge( function merge(
target: ResolvedMetadata, target: ResolvedMetadata,
source: Metadata, source: Metadata | null,
staticFilesMetadata: StaticMetadata,
templateStrings: { templateStrings: {
title: string | null title: string | null
openGraph: string | null openGraph: string | null
twitter: string | null twitter: string | null
} }
) { ) {
const metadataBase = source.metadataBase || null const metadataBase = source?.metadataBase || null
for (const key_ in source) { for (const key_ in source) {
const key = key_ as keyof Metadata const key = key_ as keyof Metadata
...@@ -122,16 +169,9 @@ function merge( ...@@ -122,16 +169,9 @@ function merge(
break break
} }
} }
mergeStaticMetadata(target, staticFilesMetadata)
} }
type MetadataResolver = (
_parent: ResolvingMetadata
) => Metadata | Promise<Metadata>
export type MetadataItems = [
Metadata | MetadataResolver | null,
Metadata | null
][]
async function getDefinedMetadata( async function getDefinedMetadata(
mod: any, mod: any,
props: any props: any
...@@ -156,35 +196,39 @@ async function getDefinedMetadata( ...@@ -156,35 +196,39 @@ async function getDefinedMetadata(
) )
} }
async function collectStaticFsBasedIcons( async function collectStaticImagesFiles(
metadata: ComponentsType['metadata'], metadata: ComponentsType['metadata'],
type: 'icon' | 'apple' type: keyof NonNullable<ComponentsType['metadata']>
) { ) {
if (!metadata?.[type]) return undefined if (!metadata?.[type]) return undefined
const iconPromises = metadata[type].map(
const iconPromises = metadata[type as 'icon' | 'apple'].map(
// TODO-APP: share the typing between next-metadata-image-loader and here // TODO-APP: share the typing between next-metadata-image-loader and here
async (iconResolver) => async (iconResolver: any) =>
interopDefault(await iconResolver()) as { url: string; sizes: string } interopDefault(await iconResolver()) as MetadataImageModule
) )
return iconPromises?.length > 0 ? await Promise.all(iconPromises) : undefined return iconPromises?.length > 0 ? await Promise.all(iconPromises) : undefined
} }
async function resolveStaticMetadata( async function resolveStaticMetadata(components: ComponentsType) {
components: ComponentsType
): Promise<Metadata | null> {
const { metadata } = components const { metadata } = components
if (!metadata) return null if (!metadata) return null
const [icon, apple] = await Promise.all([ const [icon, apple, opengraph, twitter] = await Promise.all([
collectStaticFsBasedIcons(metadata, 'icon'), collectStaticImagesFiles(metadata, 'icon'),
collectStaticFsBasedIcons(metadata, 'apple'), collectStaticImagesFiles(metadata, 'apple'),
collectStaticImagesFiles(metadata, 'opengraph'),
collectStaticImagesFiles(metadata, 'twitter'),
]) ])
const icons: Metadata['icons'] = {} const staticMetadata = {
if (icon) icons.icon = icon icon,
if (apple) icons.apple = apple apple,
opengraph,
twitter,
}
return { icons } return staticMetadata
} }
// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata] // [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata]
...@@ -208,28 +252,22 @@ export async function accumulateMetadata( ...@@ -208,28 +252,22 @@ export async function accumulateMetadata(
for (const item of metadataItems) { for (const item of metadataItems) {
const [metadataExport, staticFilesMetadata] = item const [metadataExport, staticFilesMetadata] = item
const layerMetadataPromise = Promise.resolve( const currentMetadata =
typeof metadataExport === 'function' typeof metadataExport === 'function'
? metadataExport(parentPromise) ? metadataExport(parentPromise)
: metadataExport : metadataExport
) const layerMetadataPromise =
currentMetadata instanceof Promise
? currentMetadata
: Promise.resolve(currentMetadata)
parentPromise = parentPromise.then((resolved) => { parentPromise = parentPromise.then((resolved) => {
return layerMetadataPromise.then((exportedMetadata) => { return layerMetadataPromise.then((metadata) => {
const metadata = exportedMetadata || staticFilesMetadata merge(resolved, metadata, staticFilesMetadata, {
if (metadata) {
// Overriding the metadata if static files metadata is present
merge(
resolved,
{ ...metadata, ...staticFilesMetadata },
{
title: resolved.title?.template || null, title: resolved.title?.template || null,
openGraph: resolved.openGraph?.title?.template || null, openGraph: resolved.openGraph?.title?.template || null,
twitter: resolved.twitter?.title?.template || null, twitter: resolved.twitter?.title?.template || null,
} })
)
}
return resolved return resolved
}) })
......
...@@ -17,7 +17,10 @@ export const resolveIcons: FieldResolver<'icons'> = (icons) => { ...@@ -17,7 +17,10 @@ export const resolveIcons: FieldResolver<'icons'> = (icons) => {
return null return null
} }
const resolved: ResolvedMetadata['icons'] = {} const resolved: ResolvedMetadata['icons'] = {
icon: [],
apple: [],
}
if (Array.isArray(icons)) { if (Array.isArray(icons)) {
resolved.icon = icons.map(resolveIcon).filter(Boolean) resolved.icon = icons.map(resolveIcon).filter(Boolean)
} else if (isStringOrURL(icons)) { } else if (isStringOrURL(icons)) {
......
...@@ -100,11 +100,11 @@ export const resolveTwitter: FieldResolverWithMetadataBase<'twitter'> = ( ...@@ -100,11 +100,11 @@ export const resolveTwitter: FieldResolverWithMetadataBase<'twitter'> = (
resolved.images = resolveAsArrayOrUndefined(twitter.images)?.map((item) => { resolved.images = resolveAsArrayOrUndefined(twitter.images)?.map((item) => {
if (isStringOrURL(item)) if (isStringOrURL(item))
return { return {
url: resolveUrl(item, metadataBase), url: metadataBase ? resolveUrl(item, metadataBase) : item,
} }
else { else {
return { return {
url: resolveUrl(item.url, metadataBase), url: metadataBase ? resolveUrl(item.url, metadataBase) : item.url,
alt: item.alt, alt: item.alt,
} }
} }
......
...@@ -119,8 +119,8 @@ export type ResolvedVerification = { ...@@ -119,8 +119,8 @@ export type ResolvedVerification = {
} }
export type ResolvedIcons = { export type ResolvedIcons = {
icon?: IconDescriptor[] icon: IconDescriptor[]
apple: IconDescriptor[]
shortcut?: IconDescriptor[] shortcut?: IconDescriptor[]
apple?: IconDescriptor[]
other?: IconDescriptor[] other?: IconDescriptor[]
} }
...@@ -34,7 +34,7 @@ type Locale = string ...@@ -34,7 +34,7 @@ type Locale = string
type OpenGraphMetadata = { type OpenGraphMetadata = {
determiner?: 'a' | 'an' | 'the' | 'auto' | '' determiner?: 'a' | 'an' | 'the' | 'auto' | ''
title?: TemplateString title?: string | TemplateString
description?: string description?: string
emails?: string | Array<string> emails?: string | Array<string>
phoneNumbers?: string | Array<string> phoneNumbers?: string | Array<string>
...@@ -174,7 +174,7 @@ type ResolvedOpenGraphMetadata = { ...@@ -174,7 +174,7 @@ type ResolvedOpenGraphMetadata = {
images?: Array<OGImage> images?: Array<OGImage>
audio?: Array<OGAudio> audio?: Array<OGAudio>
videos?: Array<OGVideo> videos?: Array<OGVideo>
url: null | URL url: null | URL | string
countryName?: string countryName?: string
ttl?: number ttl?: number
} }
......
...@@ -64,7 +64,7 @@ type TwitterPlayerDescriptor = { ...@@ -64,7 +64,7 @@ type TwitterPlayerDescriptor = {
} }
type ResolvedTwitterImage = { type ResolvedTwitterImage = {
url: null | URL url: null | URL | string
alt?: string alt?: string
} }
type ResolvedTwitterSummary = { type ResolvedTwitterSummary = {
......
export default function Page() {
return 'opengraph-static'
}
...@@ -407,6 +407,31 @@ createNextDescribe( ...@@ -407,6 +407,31 @@ createNextDescribe(
'author3', 'author3',
]) ])
}) })
it('should pick up opengraph-image and twitter-image as static metadata files', async () => {
const $ = await next.render$('/opengraph/static')
expect($('[property="og:image:url"]').attr('content')).toMatch(
/_next\/static\/media\/metadata\/opengraph-image.\w+.png/
)
expect($('[property="og:image:type"]').attr('content')).toBe(
'image/png'
)
expect($('[property="og:image:width"]').attr('content')).toBe('114')
expect($('[property="og:image:height"]').attr('content')).toBe('114')
expect($('[name="twitter:image"]').attr('content')).toMatch(
/_next\/static\/media\/metadata\/twitter-image.\w+.png/
)
expect($('[name="twitter:card"]').attr('content')).toBe(
'summary_large_image'
)
// favicon shouldn't be overridden
const $icon = $('link[rel="icon"]')
expect($icon.attr('href')).toMatch(
/_next\/static\/media\/metadata\/favicon.\w+.ico/
)
})
}) })
describe('icons', () => { describe('icons', () => {
...@@ -477,7 +502,7 @@ createNextDescribe( ...@@ -477,7 +502,7 @@ createNextDescribe(
it('should render icon and apple touch icon meta if their images are specified', async () => { it('should render icon and apple touch icon meta if their images are specified', async () => {
const $ = await next.render$('/icons/static/nested') const $ = await next.render$('/icons/static/nested')
const $icon = $('head > link[rel="icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
const $appleIcon = $('head > link[rel="apple-touch-icon"]') const $appleIcon = $('head > link[rel="apple-touch-icon"]')
expect($icon.attr('href')).toMatch( expect($icon.attr('href')).toMatch(
...@@ -495,7 +520,7 @@ createNextDescribe( ...@@ -495,7 +520,7 @@ createNextDescribe(
it('should not render if image file is not specified', async () => { it('should not render if image file is not specified', async () => {
const $ = await next.render$('/icons/static') const $ = await next.render$('/icons/static')
const $icon = $('head > link[rel="icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
const $appleIcon = $('head > link[rel="apple-touch-icon"]') const $appleIcon = $('head > link[rel="apple-touch-icon"]')
expect($icon.attr('href')).toMatch( expect($icon.attr('href')).toMatch(
...@@ -515,7 +540,7 @@ createNextDescribe( ...@@ -515,7 +540,7 @@ createNextDescribe(
await check(async () => { await check(async () => {
const $ = await next.render$('/icons/static') const $ = await next.render$('/icons/static')
const $icon = $('head > link[rel="icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
return $icon.attr('href') return $icon.attr('href')
}, /\/_next\/static\/media\/metadata\/icon2\.\w+\.png/) }, /\/_next\/static\/media\/metadata\/icon2\.\w+\.png/)
......
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