标题未在nextjs,tailwind css应用程序中更新

46qrfjad  于 2023-05-17  发布在  其他
关注(0)|答案(1)|浏览(153)

基本上,我的网站标题不会更新,即使我使用next/Head,并有标题标签包括在内。

"use client";
import Head from 'next/head';

import { BsFillMoonStarsFill } from 'react-icons/bs'
import {AiFillTwitterCircle, AiFillLinkedin, AiFillInstagram, AiFillGithub} from 'react-icons/ai'
import Image from "next/image";
import intro from "../public/intro.png";
import { useState } from 'react';
import design from "../public/design.png"

export default function Home() {
  const[darkMode, setDarkMode] = useState(false); 
  return (
    <div className={darkMode ? "dark": ""}>
      <Head>
        <title>{"Alexander Zhao"}</title>
        <link rel="icon" href="/favion.ico" />
      </Head>
       <main></main>

    </div>
  );
}
u0sqgete

u0sqgete1#

From docs
在Next.js 13.2中,我们宣布了一个新的元数据API,允许您定义元数据(例如HTML head元素中的title、 meta和link标记)。

// this is for typescript
import type { Metadata } from 'next'

export const metadata: Metadata = {
  title: "Alexander Zhao",
}

相关问题