Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

use 301 redirect status code

Steven Teyadd8ff93b0b1
diff --git a/app/dub.co/(blog-post)/blog/[slug]/page.tsx b/app/dub.co/(blog-post)/blog/[slug]/page.tsx
index c38eea4f19..d0a297feee 100644
--- a/app/dub.co/(blog-post)/blog/[slug]/page.tsx
+++ b/app/dub.co/(blog-post)/blog/[slug]/page.tsx
@@ -27,11 +27,11 @@ export async function generateMetadata({
return;
}
- const { title, summary, image } = post;
+ const { title, seoTitle, summary, seoDescription, image } = post;
return constructMetadata({
- title: `${title} – Dub Blog`,
- description: summary,
+ title: `${seoTitle || title} – Dub`,
+ description: seoDescription || summary,
image,
});
}
diff --git a/app/robots.ts b/app/robots.ts
index 38d07f5fa6..bb1ab6297e 100644
--- a/app/robots.ts
+++ b/app/robots.ts
@@ -10,7 +10,7 @@ export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
- disallow: "/api/",
+ disallow: ["/api/", "/_next/"],
allow: "/api/og/",
},
sitemap: `https://${domain}/sitemap.xml`,
diff --git a/contentlayer.config.ts b/contentlayer.config.ts
index 0bcfb1a321..9cc4bb3a17 100644
--- a/contentlayer.config.ts
+++ b/contentlayer.config.ts
@@ -15,6 +15,9 @@ export const BlogPost = defineDocumentType(() => ({
type: "string",
required: true,
},
+ seoTitle: {
+ type: "string",
+ },
publishedAt: {
type: "string",
required: true,
@@ -23,6 +26,9 @@ export const BlogPost = defineDocumentType(() => ({
type: "string",
required: true,
},
+ seoDescription: {
+ type: "string",
+ },
image: {
type: "string",
required: true,
diff --git a/next.config.js b/next.config.js
index 06786ff7c8..df84f178f3 100644
--- a/next.config.js
+++ b/next.config.js
@@ -64,6 +64,7 @@ const nextConfig = {
],
destination: "https://app.dub.co",
permanent: true,
+ statusCode: 301,
},
{
source: "/:path*",
@@ -75,6 +76,7 @@ const nextConfig = {
],
destination: "https://app.dub.co/:path*",
permanent: true,
+ statusCode: 301,
},
{
source: "/",
@@ -86,6 +88,7 @@ const nextConfig = {
],
destination: "https://dub.co",
permanent: true,
+ statusCode: 301,
},
...REDIRECT_SEGMENTS.map(
(segment) => (
@@ -99,6 +102,7 @@ const nextConfig = {
],
destination: `https://dub.co/${segment}`,
permanent: true,
+ statusCode: 301,
},
{
source: `/${segment}/:path*`,
@@ -110,6 +114,7 @@ const nextConfig = {
],
destination: `https://dub.co/${segment}/:path*`,
permanent: true,
+ statusCode: 301,
}
),
),
@@ -123,6 +128,7 @@ const nextConfig = {
],
destination: "https://dub.co/tools/metatags",
permanent: true,
+ statusCode: 301,
},
{
source: "/metatags",
@@ -134,6 +140,7 @@ const nextConfig = {
],
destination: "/tools/metatags",
permanent: true,
+ statusCode: 301,
},
{
source: "/",
@@ -145,6 +152,7 @@ const nextConfig = {
],
destination: "https://preview.dub.co",
permanent: true,
+ statusCode: 301,
},
{
source: "/",
@@ -156,6 +164,7 @@ const nextConfig = {
],
destination: "https://admin.dub.co",
permanent: true,
+ statusCode: 301,
},
];
},