fix: meta tags, robots.txt, and sitemap.xml
This commit is contained in:
parent
0a32380c4c
commit
91a250b1e1
1
env
1
env
@ -14,3 +14,4 @@ S3_SECRET_ACCESS_KEY=9b4e412850582aab32ffdadbe23bb7ea972b39aaf79c34da0c19d3fcafe
|
|||||||
S3_REGION=ap-southeast-1
|
S3_REGION=ap-southeast-1
|
||||||
S3_ENDPOINT=https://jswmbraeandqttpcdfmj.supabase.co/storage/v1/s3
|
S3_ENDPOINT=https://jswmbraeandqttpcdfmj.supabase.co/storage/v1/s3
|
||||||
NEXT_PUBLIC_PAYLOAD_URL=http://localhost:3000
|
NEXT_PUBLIC_PAYLOAD_URL=http://localhost:3000
|
||||||
|
SITE_URL=http://localhost:3000
|
||||||
|
@ -53,13 +53,13 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||||||
defaultMetadata.openGraph.type = "article";
|
defaultMetadata.openGraph.type = "article";
|
||||||
defaultMetadata.openGraph.title = title;
|
defaultMetadata.openGraph.title = title;
|
||||||
defaultMetadata.openGraph.description = description;
|
defaultMetadata.openGraph.description = description;
|
||||||
defaultMetadata.openGraph.images = !!imgUrl ? { url: imgUrl } : undefined;
|
defaultMetadata.openGraph.images = !!imgUrl ? [imgUrl] : undefined;
|
||||||
}
|
}
|
||||||
defaultMetadata.twitter = {
|
defaultMetadata.twitter = {
|
||||||
card: "summary_large_image",
|
card: "summary_large_image",
|
||||||
title: title,
|
title: title,
|
||||||
description: description,
|
description: description,
|
||||||
images: !!imgUrl ? { url: imgUrl } : undefined,
|
images: !!imgUrl ? [imgUrl] : undefined,
|
||||||
};
|
};
|
||||||
defaultMetadata.other = {
|
defaultMetadata.other = {
|
||||||
"article:published_time": publishedAt,
|
"article:published_time": publishedAt,
|
||||||
|
13
src/app/robots.ts
Normal file
13
src/app/robots.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
|
export default function robots(): MetadataRoute.Robots {
|
||||||
|
const siteUrl = process.env.SITE_URL || "http://localhost:3000";
|
||||||
|
|
||||||
|
return {
|
||||||
|
rules: {
|
||||||
|
userAgent: "*",
|
||||||
|
allow: "/",
|
||||||
|
},
|
||||||
|
sitemap: `${siteUrl}/sitemap.xml`,
|
||||||
|
};
|
||||||
|
}
|
18
src/app/sitemap.ts
Normal file
18
src/app/sitemap.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
|
export default function sitemap(): MetadataRoute.Sitemap {
|
||||||
|
const siteUrl = process.env.SITE_URL || "http://localhost:3000";
|
||||||
|
|
||||||
|
// Define your static routes
|
||||||
|
const routes: string[] = ["", "/blog"];
|
||||||
|
|
||||||
|
// Create sitemap entries for static routes
|
||||||
|
const staticRoutesSitemap = routes.map((route) => ({
|
||||||
|
url: `${siteUrl}${route}`,
|
||||||
|
lastModified: new Date(),
|
||||||
|
changeFrequency: "weekly" as const,
|
||||||
|
priority: route === "" ? 1 : 0.8,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [...staticRoutesSitemap];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user