Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Redirect landing page to new webflow hosting

Vasek Mlejnskyff8f0abf9e4f
diff --git a/apps/web/src/app/hostnames.ts b/apps/web/src/app/hostnames.ts
new file mode 100644
index 000000000..133e76861
--- /dev/null
+++ b/apps/web/src/app/hostnames.ts
@@ -0,0 +1,5 @@
+// We are in the process of migrating to the new landing page hosting.
+export const landingPageWebflowHostname = 'e2b-dev.webflow.io'
+export const landingPageFramerHostname = 'e2b-landing-page.framer.website'
+export const blogFramerHostname = 'e2b-blog.framer.website'
+export const changelogFramerHostname = 'e2b-changelog.framer.website'
diff --git a/apps/web/src/app/sitemap.ts b/apps/web/src/app/sitemap.ts
index 175fcf817..38cbc4b48 100644
--- a/apps/web/src/app/sitemap.ts
+++ b/apps/web/src/app/sitemap.ts
@@ -1,7 +1,7 @@
import { MetadataRoute } from 'next'
import { XMLParser } from 'fast-xml-parser'
-import { replaceUrls } from '@/utils/replaceUrls'
import path from 'path'
+import { replaceUrls } from '@/utils/replaceUrls'
import { getPageForSitemap } from '@/utils/sitemap'
type ChangeFrequency =
@@ -57,7 +57,7 @@ async function getXmlData(url: string): Promise<Sitemap> {
const response = await fetch(url, { cache: 'no-cache' })
if (!response.ok) {
- return { urlset: { url: [] }}
+ return { urlset: { url: [] } }
}
const text = await response.text()
@@ -99,7 +99,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const dashboardPath = path.join(process.cwd(), 'src', 'app', '(dashboard)', 'dashboard')
- const dashboardPages = getPageForSitemap(dashboardPath, 'https://e2b.dev/dashboard/', 0.5)
+ const dashboardPages = getPageForSitemap(dashboardPath, 'https://e2b.dev/dashboard/', 0.5)
const docsDirectory = path.join(process.cwd(), 'src', 'app', '(docs)', 'docs')
const docsPages = getPageForSitemap(docsDirectory, 'https://e2b.dev/docs/', 0.5).filter(
diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts
index b9b8f317d..3abf3ef1c 100644
--- a/apps/web/src/middleware.ts
+++ b/apps/web/src/middleware.ts
@@ -1,5 +1,11 @@
import { NextRequest, NextResponse } from 'next/server'
import { replaceUrls } from '@/utils/replaceUrls'
+import {
+ landingPageWebflowHostname,
+ landingPageFramerHostname,
+ blogFramerHostname,
+ changelogFramerHostname,
+} from '@/app/hostnames'
export async function middleware(req: NextRequest): Promise<NextResponse> {
if (req.method !== 'GET') return NextResponse.next()
@@ -11,43 +17,43 @@ export async function middleware(req: NextRequest): Promise<NextResponse> {
if (url.pathname === '' || url.pathname === '/') {
if (process.env.NODE_ENV === 'production') {
- url.hostname = 'e2b-landing-page.framer.website'
+ url.hostname = landingPageWebflowHostname
} else {
return NextResponse.redirect(new URL('/dashboard', req.url))
}
}
if (url.pathname.startsWith('/terms')) {
- url.hostname = 'e2b-landing-page.framer.website'
+ url.hostname = landingPageWebflowHostname
}
if (url.pathname.startsWith('/privacy')) {
- url.hostname = 'e2b-landing-page.framer.website'
+ url.hostname = landingPageWebflowHostname
}
if (url.pathname.startsWith('/pricing')) {
- url.hostname = 'e2b-landing-page.framer.website'
+ url.hostname = landingPageWebflowHostname
}
+ // TODO: Not on the new landing page hosting yet
if (url.pathname.startsWith('/ai-agents')) {
- url.hostname = 'e2b-landing-page.framer.website'
+ url.hostname = landingPageFramerHostname
}
if (url.pathname === '/blog' || url.pathname === '/blog/') {
url.pathname = '/'
- url.hostname = 'e2b-blog.framer.website'
+ url.hostname = blogFramerHostname
}
-
if (url.pathname.startsWith('/blog')) {
- url.hostname = 'e2b-blog.framer.website'
+ url.hostname = blogFramerHostname
}
if (url.pathname === '/changelog' || url.pathname === '/changelog/') {
url.pathname = '/'
- url.hostname = 'e2b-changelog.framer.website'
+ url.hostname = changelogFramerHostname
}
if (url.pathname.startsWith('/changelog')) {
- url.hostname = 'e2b-changelog.framer.website'
+ url.hostname = changelogFramerHostname
}
const res = await fetch(url.toString(), { ...req })
diff --git a/apps/web/src/utils/replaceUrls.ts b/apps/web/src/utils/replaceUrls.ts
index a89f21eea..4cb337b8a 100644
--- a/apps/web/src/utils/replaceUrls.ts
+++ b/apps/web/src/utils/replaceUrls.ts
@@ -1,16 +1,27 @@
+import {
+ landingPageWebflowHostname,
+ landingPageFramerHostname,
+ blogFramerHostname,
+ changelogFramerHostname,
+} from '@/app/hostnames'
+
export function replaceUrls(text: string, urlPathName: string, prefix: string = '', suffix: string = ''): string {
const pattern = suffix ? `(?<url>${prefix}https://e2b-[^${suffix}]*)/${suffix}` : `(?<url>${prefix}https://e2b-.*)/$`
return text.replaceAll(
- new RegExp(pattern, 'g'),
+ new RegExp(pattern, 'g'),
(_, url) => url + suffix,
+ )
+ .replaceAll(
+ `${prefix}${landingPageWebflowHostname}`,
+ `${prefix}https://e2b.dev`
)
.replaceAll(
- `${prefix}https://e2b-landing-page.framer.website`,
+ `${prefix}${landingPageFramerHostname}`,
`${prefix}https://e2b.dev`
)
.replaceAll(
- `${prefix}https://e2b-blog.framer.website`,
+ `${prefix}${blogFramerHostname}`,
// The default url on framer does not have /blog in the path but the custom domain does,
// so we need to handle this explicitly.
urlPathName === '/'
@@ -18,7 +29,7 @@ export function replaceUrls(text: string, urlPathName: string, prefix: string =
: `${prefix}https://e2b.dev`
)
.replaceAll(
- `${prefix}https://e2b-changelog.framer.website`,
+ `${prefix}${changelogFramerHostname}`,
// The default url on framer does not have /changelog in the path but the custom domain does,
// so we need to handle this explicitly.
urlPathName === '/'