NextJS 13 应用目录 |生成的静态 html 中不包含元标记。爬虫找不到opengraph

问题描述 投票:0回答:0

我遇到了 nextjs 13.2.4 元标记的问题。我遵循了 https://beta.nextjs.org/docs/api-reference/metadata 上的官方文档。 无论我使用

export const metadata = { ... }
还是
export async function generateMetadata
,meta 标签都不包含在静态 html 代码中。相反,它包含在开放图形爬虫找不到的
self.__next_f.push(
中。 我尝试将
export metadata
语句放在 layout.tsx、page.tsx 中,但似乎没有任何效果。

例如 facebook 共享调试器不会显示 opengraph 预览。 它显示 html 如下所示:

<!DOCTYPE html>
<html id="__next_error__">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" nomodule=""></script>
</head>
...

og元数据标签在里面

<script>(self.__next_f=self.__next_f||[]).push([0]) ... 

有人有想法吗?

next.js facebook-opengraph meta-tags nextjs13
© www.soinside.com 2019 - 2024. All rights reserved.