Files
M. Abdullah 3ea8310f20 fix(metadata): make formatDetection respect true/false properly (#83924)
### What?

Fixes the `FormatDetectionMeta` function so that it correctly respects
true vs false values.

### Why?

Previously, both true and false values output key=no. According to
Apple’s spec, Safari defaults to enabling detection when the tag is
absent, and only no should be added when explicitly disabled.

### How?

- Now false → outputs key=no
- true → omits the tag (defaults to Safari’s behavior)

### Reference

- [Apple docs on
format-detection](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html#//apple_ref/doc/uid/TP40008193-SW1)

Fixes #83666

---------

Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
2025-09-26 21:25:15 +00:00

55 lines
1.3 KiB
TypeScript

import React from 'react'
import type { Metadata } from 'next'
import Link from 'next/link'
import Client from './client'
export default function Page() {
return (
<div id="basic">
<Link id="to-index" href="/">
to index
</Link>
<br />
<Link href="/title-template/extra/inner" id="to-nested">
to /title-template/extra/inner
</Link>
<Client />
</div>
)
}
export const metadata: Metadata = {
generator: 'next.js',
applicationName: 'test',
referrer: 'origin-when-cross-origin',
keywords: ['next.js', 'react', 'javascript'],
authors: [{ name: 'huozhi' }, { name: 'tree', url: 'https://tree.com' }],
manifest: '/api/manifest',
creator: 'shu',
publisher: 'vercel',
robots: 'index, follow',
alternates: {},
pagination: {
previous: '/basic?page=1',
next: '/basic?page=3',
},
formatDetection: {
email: false,
address: false,
telephone: false,
// Properties set to `true` should not be included in `format-detection` meta tag
url: true,
},
}
export const viewport = {
// viewport meta tag
width: 'device-width',
initialScale: 1,
maximumScale: 1,
interactiveWidget: 'resizes-visual',
// visual meta tags
colorScheme: 'dark',
themeColor: { color: 'cyan', media: '(prefers-color-scheme: dark)' },
}