HubSpot CMS to Next.js Migration: How to Move and Keep Your Rankings
How to move a HubSpot CMS website to Next.js while keeping HubSpot CRM, forms and tracking, and without losing rankings: URL inventory, redirects and testing.
Most marketing teams that leave HubSpot Content Hub are not leaving HubSpot. They want a faster site and more control, but the CRM, lead routing and email workflows are working fine. The good news is that you can split the two. The risk sits almost entirely in the URLs and redirects, not in the CRM.
What a HubSpot CMS to Next.js migration is
You rebuild the public website (pages, blog, templates, metadata) as a Next.js app on new hosting and point your domain at it. HubSpot stays as the CRM. Forms keep submitting to HubSpot, the tracking code keeps recording visits, and workflows keep running. What changes is who serves the pages and who handles redirects.
What moves off HubSpot and what stays?
Draw this line before anyone writes code. It decides the scope, the budget and who has to sign off. Here is the split we use on HubSpot projects.
| Item | Moves to Next.js | Stays in HubSpot |
|---|---|---|
| Website pages and templates | Yes, rebuilt as components | Old pages unpublished after cutover |
| Blog posts, tags, authors | Yes, content exported and remapped | No |
| URL redirects | Yes, rebuilt in Next.js or the host | Stop working once the domain moves |
| Titles, meta descriptions, schema | Yes, carried over per URL | No |
| Forms and submissions | Rendered on the new site | Form definitions, submissions, notifications |
| Contacts, deals, workflows, email | No | Yes, unchanged |
| Tracking and attribution | Tracking code installed in the new layout | Reporting stays in HubSpot |
| Landing pages for campaigns | Optional, case by case | Can stay on a HubSpot subdomain |
Landing pages are the main judgment call. Some teams keep campaign pages on a HubSpot-hosted subdomain so marketers can still build them in the drag-and-drop editor. Others move everything so the whole site shares one design system and one performance budget.
Can you keep HubSpot CRM and forms on a Next.js site?
Yes. HubSpot supports forms on sites it does not host. There are three ways to connect them, and the choice affects page speed, design control and attribution.
| Method | How it works | Trade-off |
|---|---|---|
| HubSpot embed code | Paste the form's embed script into a client component | Fastest to set up; loads HubSpot's script and styling |
| Forms API submission | Your own form posts to the v3 submit endpoint with portal ID and form GUID | Full design control; you build validation and pass the hutk cookie |
| Non-HubSpot forms tool | HubSpot's tracking code captures plain HTML form submissions | Little code, but depends on the tracking code and field mapping |
With the embed route, HubSpot notes that the page's domain must be added as a site domain to be treated as trusted. It also says form analytics need the tracking code on the same page. Miss either step and forms may still submit, but reporting gets patchy.
With the API route, your form posts to the authenticated submit endpoint. Pass the hutk visitor cookie and the pageUri in the context object. Without them, the contact is created but loses the page-view history that sales teams rely on.
For tracking, HubSpot says externally hosted pages need the tracking code installed manually. In Next.js, load it once in the root layout with the Script component. Client-side route changes do not reload the page, so also send a page view through the _hsq queue (setPath, then trackPageView) on each navigation.
Why HubSpot redirects stop working the day you switch DNS
This is the step teams miss most often. HubSpot's documentation is direct: URL redirects only work for domains connected to and hosted in HubSpot. Once your domain points at the new host, every redirect in the HubSpot URL Redirects tab stops resolving.
Many HubSpot sites have more redirects than anyone remembers. HubSpot automatically creates a redirect whenever someone changes the URL of a published page or blog post. Years of slug edits can leave hundreds of rules that still carry backlinks and rankings.
Export before you cut over
Export the full list from Settings > Website > Domains & URLs > URL Redirects, or pull it through HubSpot's URL redirects API. Rebuild each rule on the new site, pointing straight at the final destination. If an old rule points to a URL that is also changing, update it so it does not create a chain.
Which HubSpot URL patterns need a mapping?
Your visible pages are only part of the inventory. HubSpot generates several URL types automatically, and each needs a decision: keep, redirect, or retire.
- Blog posts: usually /blog/post-slug. Keep the same path in Next.js where possible, which means no redirect at all.
- Tag listing pages: HubSpot creates /blog/tag/tag-name for each tag. Keep the ones with traffic, and redirect the thin ones to the closest topic hub.
- Author pages: /blog/author/name. Rebuild them as real author pages if they rank or support expertise signals.
- Paginated listings: /blog/page/2 and beyond. Match the pattern or redirect to the new listing.
- Blog RSS feed: subscribers and some tools still request it. Keep a feed at the same path or redirect it.
- File manager URLs: PDFs and images uploaded to HubSpot and linked from your pages. Download and rehost the ones that rank or earn links.
- Landing and thank-you pages: decide which move and which stay on a HubSpot subdomain.
- Old redirect sources: every source path in the exported redirect list.
Tag pages are where HubSpot sites differ most from WordPress sites. If you are coming from WordPress instead, our WordPress to Next.js migration checklist covers that platform's patterns.
The URL inventory and redirect testing we run
Google's site move guidance starts with the same thing: prepare a URL mapping from current URLs to new ones. Here is how we build and test that map on a HubSpot CMS to Next.js migration.
- 1
Collect every URL
Merge a full crawl, the XML sitemap, the HubSpot redirect export, Search Console Performance pages from the last 16 months and top pages from Semrush or Ahrefs. Deduplicate.
- 2
Attach the data
For each URL, record clicks, impressions, ranking keywords, backlinks, title, meta description and any structured data. This tells you which URLs carry real value.
- 3
Map each URL
Assign one outcome: same path, new path with a permanent redirect, or retire with a 410 or 404 if nothing relevant replaces it. Do not send old URLs to the homepage.
- 4
Carry over the on-page signals
Copy titles, metadata and schema into the new templates. Add a self-referencing canonical to each new URL, as Google recommends.
- 5
Test on staging
Run every old path against the staging site with a script. Each must return 200 or a single permanent redirect that lands on a 200. Flag chains, loops and redirects to 404s.
- 6
Cut over and re-test
Switch DNS, then run the same script against production within the hour. Submit the new sitemap in Search Console the same day.
One detail surprises people. The redirects option in next.config.js returns 308 for permanent redirects, not 301. That is fine for search. Google's redirect documentation lists both 301 and 308 as permanent server-side redirects. For very large redirect lists, the Next.js docs include a section on managing redirects at scale with middleware.
Avoid soft 404s
Google warns against redirecting many old URLs to one irrelevant page. A tag page redirected to the homepage often gets treated as a soft 404, so its signals are lost anyway. Redirect to the closest equivalent, or retire the URL honestly.
What to watch in Search Console after launch
The first weeks tell you whether the map held. We check Search Console daily for 60 days. These are the reports that matter most.
- Page indexing report: watch "Not found (404)", "Soft 404" and "Page with redirect". A spike in 404s usually means a missed URL pattern.
- Performance report: compare clicks and impressions by page against the month before launch. Filter for old URLs that still show impressions.
- Sitemaps report: confirm the new sitemap was read and its URL count matches the site.
- URL Inspection: spot-check high-value old URLs to confirm Google sees the redirect and the new canonical.
Also check HubSpot. Submit a test on every form, confirm the contact appears with the right source and page history, and check that workflows triggered by those forms still fire.
HubSpot CMS vs Next.js for a B2B site: when is moving worth it?
Moving is not always the right call. The honest comparison depends on who edits the site and what you need it to do.
| Factor | HubSpot CMS | Custom Next.js |
|---|---|---|
| Editing | Drag-and-drop editor for marketers | Depends on the CMS or editing workflow you pair with it |
| Performance control | Limited by HubSpot themes and modules | Full control over scripts, images and rendering |
| Structured data | Added per module or in header HTML | Generated per template from your content |
| Custom tools (calculators, catalogs) | Possible, but constrained | Built as normal app routes |
| CRM integration | Native | Via embed code, Forms API and tracking code |
| Redirects | Managed in HubSpot settings | Managed in code or at the host |
Stay on HubSpot CMS if your team builds many campaign pages weekly without developer help and the site already performs well. Move if speed, custom tools or AI search visibility are holding back the site that drives your leads. Server-rendered pages with schema on every template, covered in our guide to schema that moves the needle, are easier to keep consistent in code.
What one migration looked like
ebb Logistics, a parcel contract consulting firm, moved about 400 URLs, ten calculators and 330+ articles to a custom Next.js site in early October 2026. Every old URL resolved to a live page or a 301 redirect on launch day, and 0 rankings were lost at cutover (Google Search Console, checked daily).
Ranking keywords went from about 475 at migration to 958 on Dec 1, 2026 (Semrush, US, top 100). Google impressions rose 800% in the first month versus the month before (Google Search Console). That is one site's result, not a forecast for yours. The full story is in the ebb Logistics case study.
Planning to leave HubSpot CMS but keep the CRM?
We will review your HubSpot URL patterns, redirect list and form setup on a 30-minute call, then send a fixed proposal.
Book a discovery call →Sources
- Create and manage URL redirects (HubSpot Knowledge Base)
- Change content URLs (HubSpot Knowledge Base)
- Install the HubSpot tracking code (HubSpot Knowledge Base)
- Set up and style a legacy form on an external site (HubSpot Knowledge Base)
- Use non-HubSpot forms (HubSpot Knowledge Base)
- Submit data to a form (supporting authentication) (HubSpot Developers)
- Site moves and migrations: move a site with URL changes (Google Search Central)
- Redirects and Google Search (Google Search Central)
- next.config.js: redirects (Next.js)
- How to handle redirects in Next.js (Next.js)
Frequently Asked Questions
Will we lose Google rankings if we move from HubSpot CMS to Next.js?▼
Can we keep using HubSpot CRM after leaving HubSpot CMS?▼
Do HubSpot URL redirects keep working after migration?▼
Is a 308 redirect from Next.js as good as a 301 for SEO?▼
Should we keep HubSpot blog tag pages?▼
Can our marketing team still build landing pages without developers?▼
Want a site built to be cited in AI search, without losing your rankings?
We redesign and migrate established websites with every URL and redirect accounted for, structure them for Google AI Overviews, ChatGPT and Perplexity, then build in a content engine that drafts pages like this one for your editor to approve.
