@symbo.ls/smbls-utils 3.8.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/metadata.js +3 -24
package/package.json
CHANGED
package/src/metadata.js
CHANGED
|
@@ -19,31 +19,10 @@ const buildAttrs = (obj) =>
|
|
|
19
19
|
* Works on both server (SSR head injection) and client (dynamic meta updates).
|
|
20
20
|
*/
|
|
21
21
|
export const generateMetaTags = (metadata, isProduction) => {
|
|
22
|
+
// For non-production (preview/staging), inject noindex into metadata
|
|
23
|
+
// but still generate full OG/Twitter tags for sharing previews
|
|
22
24
|
if (!isProduction) {
|
|
23
|
-
|
|
24
|
-
const fv = metadata?.favicon || metadata?.favicons
|
|
25
|
-
if (!fv) return '<link rel="icon" href="/favicon.ico">'
|
|
26
|
-
if (typeof fv === 'string') return `<link rel="icon" href="${escapeHtml(fv)}">`
|
|
27
|
-
if (Array.isArray(fv)) {
|
|
28
|
-
return fv
|
|
29
|
-
.map((item) =>
|
|
30
|
-
typeof item === 'string'
|
|
31
|
-
? `<link rel="icon" href="${escapeHtml(item)}">`
|
|
32
|
-
: `<link ${buildAttrs({ rel: 'icon', ...item })}>`
|
|
33
|
-
)
|
|
34
|
-
.join('\n')
|
|
35
|
-
}
|
|
36
|
-
return `<link ${buildAttrs({ rel: 'icon', ...fv })}>`
|
|
37
|
-
})()
|
|
38
|
-
|
|
39
|
-
return [
|
|
40
|
-
'<meta charset="UTF-8">',
|
|
41
|
-
`<title>${escapeHtml(metadata.title || 'Test')}</title>`,
|
|
42
|
-
'<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">',
|
|
43
|
-
'<meta name="robots" content="noindex">',
|
|
44
|
-
'<meta name="apple-mobile-web-app-capable" content="yes">',
|
|
45
|
-
faviconTag
|
|
46
|
-
].join('\n')
|
|
25
|
+
metadata = { ...metadata, robots: 'noindex' }
|
|
47
26
|
}
|
|
48
27
|
|
|
49
28
|
const tags = Object.entries(metadata).reduce(
|