2
0

🔧 (blog) Fix viewer rewrites for blog styles

This commit is contained in:
Baptiste Arnaud
2024-04-22 17:05:55 +02:00
parent a1da5f2cd4
commit ccc974f5f9

View File

@@ -36,6 +36,7 @@ const landingPagePaths = [
'/terms-of-service', '/terms-of-service',
'/about', '/about',
'/oss-friends', '/oss-friends',
'/blog',
] ]
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
@@ -81,7 +82,6 @@ const nextConfig = {
? landingPagePaths ? landingPagePaths
.map((path) => ({ .map((path) => ({
source: '/_next/static/:static*', source: '/_next/static/:static*',
destination: `${process.env.LANDING_PAGE_URL}/_next/static/:static*`,
has: [ has: [
{ {
type: 'header', type: 'header',
@@ -89,11 +89,11 @@ const nextConfig = {
value: `https://typebot.io${path}`, value: `https://typebot.io${path}`,
}, },
], ],
destination: `${process.env.LANDING_PAGE_URL}/_next/static/:static*`,
})) }))
.concat( .concat(
landingPagePaths.map((path) => ({ landingPagePaths.map((path) => ({
source: '/typebots/:typebot*', source: '/typebots/:typebot*',
destination: `${process.env.LANDING_PAGE_URL}/typebots/:typebot*`,
has: [ has: [
{ {
type: 'header', type: 'header',
@@ -101,12 +101,12 @@ const nextConfig = {
value: `https://typebot.io${path}`, value: `https://typebot.io${path}`,
}, },
], ],
destination: `${process.env.LANDING_PAGE_URL}/typebots/:typebot*`,
})) }))
) )
.concat( .concat(
landingPagePaths.map((path) => ({ landingPagePaths.map((path) => ({
source: '/styles/:style*', source: '/styles/:style*',
destination: `${process.env.LANDING_PAGE_URL}/styles/:style*`,
has: [ has: [
{ {
type: 'header', type: 'header',
@@ -114,28 +114,53 @@ const nextConfig = {
value: `https://typebot.io${path}`, value: `https://typebot.io${path}`,
}, },
], ],
destination: `${process.env.LANDING_PAGE_URL}/styles/:style*`,
})) }))
) )
.concat( .concat(
landingPagePaths.map((path) => ({ landingPagePaths.map((path) => ({
source: path, source: path,
destination: `${process.env.LANDING_PAGE_URL}${path}`,
has: [ has: [
{ {
type: 'host', type: 'host',
value: 'typebot.io', value: 'typebot.io',
}, },
], ],
destination: `${process.env.LANDING_PAGE_URL}${path}`,
})) }))
) )
.concat([ .concat([
{ {
source: '/blog', source: '/blog/:slug',
destination: `${process.env.LANDING_PAGE_URL}/blog`, has: [
{
type: 'host',
value: 'typebot.io',
},
],
destination: `${process.env.LANDING_PAGE_URL}/blog/:slug`,
}, },
{ {
source: '/blog/:slug', source: '/typebots/:typebot*',
destination: `${process.env.LANDING_PAGE_URL}/blog/:slug`, // Matched parameters can be used in the destination has: [
{
type: 'header',
key: 'referer',
value: `https://typebot.io/blog/(?<slug>.*)`,
},
],
destination: `${process.env.LANDING_PAGE_URL}/typebots/:typebot*`,
},
{
source: '/styles/:style*',
has: [
{
type: 'header',
key: 'referer',
value: `https://typebot.io/blog/(?<slug>.*)`,
},
],
destination: `${process.env.LANDING_PAGE_URL}/styles/:style*`,
}, },
]) ])
: [] : []