You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Next.js 13.4.3网站在Google搜索中元数据不显示问题求助

问题描述

使用Next.js 13.4.3开发的网站,在Google搜索结果中标题显示为「Untitled」,描述为「要使用本网站的全部功能,必须启用JavaScript。以下是在浏览器中启用JavaScript的说明」。

已在layout.tsx中配置了metadata,也尝试用旧版next/head方式在page.tsx中设置,但均无效。

Google搜索结果截图说明:搜索结果里网站标题为「Untitled」,描述为上述启用JavaScript的提示文本。

附layout.tsx代码:

import "../styles/globals.css";
import "react-toastify/dist/ReactToastify.css";

import { Inter } from "next/font/google";
import Head from "next/head";

import Footer from "@/components/footer";
import Navbar from "@/components/navbar";
const inter = Inter({ subsets: ["latin"] });

export const metadata = {
  title: "MHMA Web Design Company",
  description: "Transforming your digital presence with innovative web design solutions. We craft stunning and user-friendly websites that captivate your audience and drive results. Contact us to elevate your online brand today.",
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body className={inter.className}>
        <Navbar />
        {children}
        <Footer />
      </body>
    </html>
  );
}
解决方法
  • 检查Metadata实际输出:打开浏览器开发者工具(F12),查看页面<head>标签下的<title>和<meta name="description">是否与配置的metadata一致。若不一致,排查子页面是否存在metadata覆盖根布局配置,或代码中存在拼写错误。
  • 更新Google索引:登录Google Search Console,提交网站域名,请求重新抓取并索引页面。Google可能展示的是旧缓存内容,重新索引后会更新搜索结果。
  • 移除旧版next/head代码:Next.js 13.4+的App Router推荐使用metadata配置,旧版next/head会与新系统冲突,删除所有页面中导入和使用next/head的代码。
  • 排查第三方脚本干扰:检查网站引入的第三方脚本(如安全插件、广告代码等)是否修改了页面<head>内容,暂时禁用这类脚本后测试meta标签是否正常。
  • 验证页面渲染模式:确保页面为静态生成(SSG)或服务器端渲染(SSR),若为纯客户端渲染(CSR),Google爬虫可能无法正确抓取meta内容。可在next.config.js中配置output: 'export',或确保页面使用服务器组件。

内容的提问来源于stack exchange,提问作者Marwan Abdou

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 09:50:13