Dolphin-PC / Commerce

전자기기 구매 E-Commerce프로젝트
https://banana-shop-chi.vercel.app
0 stars 0 forks source link

SEO 개선하기 React #48

Closed Dolphin-PC closed 3 weeks ago

Dolphin-PC commented 3 weeks ago
Dolphin-PC commented 3 weeks ago

📏 Lighthouse 성능 측정

image
Dolphin-PC commented 3 weeks ago

⁉️ 사이트맵이란

Dolphin-PC commented 3 weeks ago

✅ Sitemap 작성하기

전체 코드 ```javascript import fs from "fs"; const ROUTES = { HOME: { loc: "/", changefreq: "daily", priority: 1.0 }, SIGNIN: { loc: "/sign-in", changefreq: "monthly", priority: 0.8 }, SIGNUP: { loc: "/sign-up", changefreq: "monthly", priority: 0.8 }, SIGNUP__OAUTH: { loc: "/sign-up/oauth", changefreq: "monthly", priority: 0.8 }, PRODUCTS: { loc: "/products", changefreq: "daily", priority: 0.9 }, MY: { loc: "/my", changefreq: "daily", priority: 0.9 }, DASHBOARD: { loc: "/dashboard", changefreq: "daily", priority: 0.9 }, DASHBOARD__PRODUCTS: { loc: "/dashboard/products", changefreq: "daily", priority: 0.9 }, }; const DOMAIN = process.env.VITE_DOMAIN_URL; function generateSitemap() { let sitemap = ` \n `; // Iterate over the routes and generate sitemap entries for (const [key, route] of Object.entries(ROUTES)) { const { loc, changefreq, priority } = route; const url = `${DOMAIN}${loc}`; const lastModified = new Date().toISOString(); sitemap += ` ${url} ${lastModified} ${changefreq} ${priority} \n`; } sitemap += ``; // Write the sitemap to a file // Replace 'sitemap.xml' with the desired filename and path fs.writeFileSync("./public/sitemap.xml", sitemap); console.log("Sitemap generated successfully!"); } generateSitemap(); ```

사이트맵을 만들고나니, lighthouse에는 변화가 없었다.

Dolphin-PC commented 3 weeks ago

✅ robots.txt 적용


<img width="563" alt="image" src="https://github.com/user-attachments/assets/c902a99d-26dd-48ac-8966-1dc615f946d7">