iT邦幫忙

2023 iThome 鐵人賽

DAY 17
0

app\page.jsx

import Link from "next/link"
import Heading from "@/components/Heading"
import { getFeatureReview } from "@/lib/reviews"

export const metadata = {
    title: "Indie Gamer",
    description: "Only the best indie games, reviewed for you.",
}

async function HomePage() {
    const review = await getFeatureReview()
    return (
        <div>
            <Heading>Indie Gamer</Heading>
            <p className="pb-3">
                Only the best indie games, reviewed for you.
            </p>
            <div className="border  bg-white w-80 sm:w-full shadow hover:shadow-xl">
                <Link className="flex   flex-col sm:flex-row" href={`/reviews/${review.slug}`}>
                    <img src={review.image} alt="" width="320" height="180"
                        className="rounded-t sm:rounded-l sm:rounded-r-none" />
                    <h2 className="text-center py-1 font-orbitron font-semibold sm:px-2">{review.title}</h2>
                </Link>
            </div>
        </div>
    )
}

export default HomePage


metadate 的模板

app\layout.jsx

export const metadata = {
    title: {
        default: "Indie Gamer",
        template: "%s | Indie Gamer",
    }
}

其他頁面

export const metadata = {
    title: "About",
}

結果 : 標題 About | Indie Gamer


大叔的鐵人賽第十七天結束 :)


上一篇
DAY16 - 增加排序功能
下一篇
DAY18 - 線上部署
系列文
中年大叔(40+)前端自學筆記30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言