Add SEO foundation: robots, sitemap, JSON-LD, OG/Twitter cards, per-page metadata
- src/lib/site.ts: single source for site name/url/description (rename via env only) - src/app/robots.ts: allow all, disallow /api /files, explicit Googlebot/Bingbot/DuckDuckBot/Bravebot/Applebot - src/app/sitemap.ts: static pages + routes/check/stops from backend, falls back to static when API is down - src/components/JsonLd.tsx: WebSite + Organization + SearchAction, BreadcrumbList, BusStop, Service - layout.tsx: metadataBase, canonical, keywords, robots, openGraph, twitter - generateMetadata for /stops/[code], /routes/[routeId], /check/[routeId] - canonical + description on /stops /routes /blog /about /credits - public/og-image.png 1200x630
This commit is contained in:
1 parent
7ac7bf5878
commit
2fa73f43d9
27 files changed
+850
-68
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
import { SITE_URL, DISALLOW_PATHS } from "@/lib/site";
|
||||
|
||||
/**
|
||||
* robots.txt — บอกบอท Google / Bing / Brave / DuckDuckGo ว่าอะไรเก็บได้
|
||||
*
|
||||
* หมายเหตุ: DuckDuckGo ใช้ index ของ Bing เป็นหลัก, Brave ใช้ index ของตัวเอง
|
||||
* ทั้งคู่เคารพ robots.txt มาตรฐานเดียวกัน
|
||||
*/
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return {
|
||||
rules: [
|
||||
{
|
||||
userAgent: "*",
|
||||
allow: "/",
|
||||
disallow: DISALLOW_PATHS,
|
||||
},
|
||||
/* บอทสำคัญ — อนุญาตชัดเจน */
|
||||
{ userAgent: ["Googlebot", "Bingbot", "DuckDuckBot", "Bravebot", "Applebot"], allow: "/", disallow: DISALLOW_PATHS },
|
||||
],
|
||||
sitemap: `${SITE_URL}/sitemap.xml`,
|
||||
host: SITE_URL,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user