Skip to content

Commit

Permalink
Display the new changelog page (#528)
Browse files Browse the repository at this point in the history
This PR updates the middleware rules so it fetches the new changelog
page hosted on Webflow when user goes to `https://e2b.dev/changelog`.
  • Loading branch information
mlejva authored Jan 7, 2025
2 parents 084eae9 + e7940c0 commit 52a004b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
13 changes: 4 additions & 9 deletions apps/web/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
landingPageHostname,
landingPageFramerHostname,
blogFramerHostname,
changelogFramerHostname,
} from '@/app/hostnames'

export async function middleware(req: NextRequest): Promise<NextResponse> {
Expand Down Expand Up @@ -39,6 +38,10 @@ export async function middleware(req: NextRequest): Promise<NextResponse> {
url.hostname = landingPageHostname
}

if (url.pathname.startsWith('/changelog')) {
url.hostname = landingPageHostname
}

// TODO: Not on the new landing page hosting yet
if (url.pathname.startsWith('/ai-agents')) {
url.hostname = landingPageFramerHostname
Expand All @@ -52,14 +55,6 @@ export async function middleware(req: NextRequest): Promise<NextResponse> {
url.hostname = blogFramerHostname
}

if (url.pathname === '/changelog' || url.pathname === '/changelog/') {
url.pathname = '/'
url.hostname = changelogFramerHostname
}
if (url.pathname.startsWith('/changelog')) {
url.hostname = changelogFramerHostname
}

const res = await fetch(url.toString(), { ...req })

const htmlBody = await res.text()
Expand Down
9 changes: 0 additions & 9 deletions apps/web/src/utils/replaceUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
landingPageHostname,
landingPageFramerHostname,
blogFramerHostname,
changelogFramerHostname,
} from '@/app/hostnames'

export function replaceUrls(text: string, urlPathName: string, prefix: string = '', suffix: string = ''): string {
Expand All @@ -28,12 +27,4 @@ export function replaceUrls(text: string, urlPathName: string, prefix: string =
? `${prefix}https://e2b.dev/blog`
: `${prefix}https://e2b.dev`
)
.replaceAll(
`${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 === '/'
? `${prefix}https://e2b.dev/changelog`
: `${prefix}https://e2b.dev`
)
}

0 comments on commit 52a004b

Please sign in to comment.