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