目標:希望在google 搜尋我的名字時,可以出現我的作品集網站。
<h1> ~ <h6>)。<title>)、描述(<meta name="description">)要精準。alt 屬性,幫助搜尋引擎理解內容。nuxt.config.ts 裡統一設定 SEO + OG:export default defineNuxtConfig({
  app: {
    head: {
      title: '我的網站', // 顯示在瀏覽器頁籤上的文字
      meta: [
	      // 基本SEO
        { name: 'description', content: '這是我的網站介紹' },
        // Open Graph
        { property: 'og:title', content: '我的網站' },
        { property: 'og:description', content: '分享用的網站描述' },
        { property: 'og:image', content: '/og-image.png' },
      ],
      link: [
        // 顯示在瀏覽器頁籤上的icon,放在/public/favicon.ico 中
        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      ]
    }
  }
})
useHead 動態設定:useHead({
  title: '文章標題',
  meta: [
    { name: 'description', content: '文章簡介' },
    { property: 'og:title', content: '文章標題' },
    { property: 'og:description', content: '文章簡介' },
    { property: 'og:image', content: '/article.png' }
  ]
})

檢查網頁原始碼打開,有出現設定的 <title> 和 <meta description>就有了!日後網站上線後,可以透過瀏覽器內建檢查、Google Search Console(GSC)、Google Analytics (GA4)來觀測搜尋成效、行爲分析。
