How do I clone an entire website page (not just the template) to another account?

SOLVE
Highlighted
Occasional Contributor

As an experienced development shop, we want to manage our hubspot webpage using GIT. I went through this tutorial: https://developers.hubspot.com/docs/cms/guides/getting-started-with-local-development

 

However, once I created the sandbox account and transferred all our files, the website pages  didn't get transferred. Neither did the blog posts.

 

I can create a new website-page from our templates, but the default web-page looks nothing like our production website-page. The production page has been heavily customized with the hubspot webpage editor. 

 

We need to be able to test our changes in our staging "sandbox" against the real, production website-pages, not just the initial stub website-pages generated from templates.

 

Within one account we can "clone" a website page. How do we "clone" a website page to our staging "sandbox" account?

 

Ideally, I'd like to export the website-page to a JSON (or equivelant) file which fully encodes everything needed to import that website-page exactly into another account. This would allow us to version control website pages in Git just like everything else.

 

Thank you!
(edit: spelling)

1 Accepted solution

Accepted Solutions
Highlighted
Occasional Contributor

The best solution I've found so far is using the hubspot API:

 

First, you can list all your website pages as an array of JSON objects:

  • GET /content/api/v2/pages

Then you can PUT individual pages to another account:

  • PUT /content/api/v2/pages/[page_id]

This basically does exactly what I wanted, except on each account, the ID of the pages will be different. As such, it looks like we'll need some way to map IDs. If we ensure the "internal page name" is unique, we can use that as a key to solve the problem.

 

We are also refactoring how our templates work. We are decreasing the number of customizable fields to a minimum, and we are creating reasonable defaults for each template. All together, we hope to engineer a solution where creating a blank page from a template on a sandbox account is a reasonable approximation of the production web site.

 

All together, we'll have two options for staging: We'll be able to create an approximation of the site directly from the templates, and we'll be able to create an exact clone for accurate staging.

 

Reference links:

https://legacydocs.hubspot.com/docs/methods/pages/get_pages

https://legacydocs.hubspot.com/docs/methods/pages/put_pages_page_id

5 Replies 5
Highlighted
Community Manager

Hey @shanebdavis 

 

Thank you for the information provided. I'll tag a few of our experts that can share their thoughts with you.  

 

Hey @Kevin-C @amwilie  could you please advise @shanebdavis ?   

 

Thank you

Sharon


Did my post help answer your query? Help the Community by marking it as a solution
Highlighted
Regular Advisor

Hi @shanebdavis ,

 

In my experience with HubSpot, it is not possible to clone a page between accounts. The correct way is to clone the template, and then create a page from the template.

 

As for questions in the SandBox, wait for someone with experience to answer, but about pages cloned between accounts, or what are the references above. The correct thing is to clone the template for NO HUBSPOT to create a page from the template.

 

Hope this helps.

 

Did this post help solve your problem? If so, please mark it as a solution.

Best regards! Smiley Happy

Highlighted
Occasional Contributor

Thanks, Daniel!

 

I think I found a way. Whomever did the import of our site into hubspot did it in a way that when you create new pages directly from the templates they are completely broken. Clearly the best path is as you recommend: we need to fix our broken templates so that new pages based on the template are "good enough" for everyday development.

 

Still, I'm shocked Hubspot doesn't have true staging capabilities - the ability to stage the entire site, webpages and templates, as a unit. It makes big changes really hard to do - even if they are only behind the scenes refactors.

Highlighted
Occasional Contributor

The best solution I've found so far is using the hubspot API:

 

First, you can list all your website pages as an array of JSON objects:

  • GET /content/api/v2/pages

Then you can PUT individual pages to another account:

  • PUT /content/api/v2/pages/[page_id]

This basically does exactly what I wanted, except on each account, the ID of the pages will be different. As such, it looks like we'll need some way to map IDs. If we ensure the "internal page name" is unique, we can use that as a key to solve the problem.

 

We are also refactoring how our templates work. We are decreasing the number of customizable fields to a minimum, and we are creating reasonable defaults for each template. All together, we hope to engineer a solution where creating a blank page from a template on a sandbox account is a reasonable approximation of the production web site.

 

All together, we'll have two options for staging: We'll be able to create an approximation of the site directly from the templates, and we'll be able to create an exact clone for accurate staging.

 

Reference links:

https://legacydocs.hubspot.com/docs/methods/pages/get_pages

https://legacydocs.hubspot.com/docs/methods/pages/put_pages_page_id

Highlighted
Regular Advisor

I'm glad you managed to find a solution.

 

About the broken models, I'm sad about that. HubSpot is a wonderful tool. I always make a library of modules for working companies, all 100% functional and using the marketing team to create different landing pages from that library. When done right, you don't need to edit code to customize the module and with that, you won't have any chance of breaking it.

 

I am very happy even if you have found a solution to your problem.

The HubSpot CMS is very good!

 

In case your team hasn't done it yet, HubSpot training with or Jeff offered me many good things: https://academy.hubspot.com/courses/cms-for-developers

 

Best regards! Smiley Happy