Import WordPress or Squarespace blogs with XML files
Last updated: July 17, 2023
You can import your WordPress or Squarespace blog in into HubSpot using an XML file.
Please note: if your blog is hosted on WordPress, we recommend trying the WordPress Connect blog import feature first, which can import all your blog content based on the URL of your blog's homepage. Learn more about how to choose the best method to import your blog content into HubSpot.
Before you get started
- The components of your blog that will be imported into HubSpot are: title, post body (including inline images), URL, publish date, author, tags/categories, status, meta description, featured images.
- PDF files linked in your posts and images in gallery tags will not be included in an XML import.
- Before importing your blog, review all internal links and images to confirm they include the absolute URL instead of a relative URL. This will prevent links and images from breaking in your imported posts.
Export your blog posts
Before you can import your blog posts to HubSpot, you will need to export them into an XML file from WordPress or Squarespace.
Export blog posts from WordPress
Sign in to your WordPress website as a WordPress Admin and navigate to Tools > Export to select your blog posts for export.
- If you're using WordPress.com, you can follow the steps in this WordPress documentation about how to export your posts from WordPress.com.
- If you're using a custom WordPress website, you can follow this WordPress documentation about how to export your posts from your custom WordPress website.
Export blog posts from Squarespace
Sign into Squarespace and access the Import & export content panel to select your blog posts for export. Follow the steps in this Squarespace documentation to export your blog posts.
Import XML files into HubSpot
After you've exported your WordPress or Squarespace posts, sign in to your HubSpot account.
- In your HubSpot account, click the settings settings icon in the main navigation bar.
- In the sidebar menu, navigate to CMS > Blog.
- In the Current view section, click the first dropdown menu and select Import blog.
- On the import overview page, click Import new blog in the top right. If you've already imported a blog, click the Start new import dropdown menu instead and select Blog posts.
- Select the XML file upload option, then click Next.
- In the top right of the blog importer overview, click Import posts.
- In the dialog box, click select a file and upload an XML file. By default the Remove shortcodes from imported posts is checked, which will delete shortcodes from WordPress or Squarespace blog posts. To include raw code in your posts, clear the checkbox.
- Click Upload to finish the import.
Once your blog posts have been uploaded to the dashboard, you can import your posts into your HubSpot blog:
- Hover over the file you've imported, then click Import posts. You'll see a list of all posts from your blog included in the import. Use the checkboxes next to each post to eliminate any posts that you don't want to import, or use the checkbox at the top of the column to check all posts for import.
- Click Import posts.
- Set the Publishing status for the posts using the dropdown menu:
- Keep existing status - This option will preserve the publish status from your WordPress blog and keep any draft posts as drafts, and any published posts as published.
- Change all to draft - This option will override the publish status from your WordPress blog and automatically save any imported posts as draft blog posts.
- Click the Import blog tags checkbox to import your blog tags into HubSpot.
- Click the Overwrite any existing blog posts with imported posts to replace any posts in your current blog that have the same URL.
- Click Import. You'll receive an email notification and a message in your blog importer dashboard once your import is complete.
To export any redirects for your WordPress or Squarespace posts:
- Navigate back to your blog importer dashboard, then click on the File Name of your recent import. Here you'll see details about any errors or a notification that your posts have been successfully imported.
- Click Export redirects.
- Select a Format for the redirects and enter an Email where you'd like the file to be delivered, then click Export. You'll receive an email shortly with your file.
The way you set up your blog redirects depends on how much of your website is now hosted on HubSpot:
- If your entire website, including the domain for your former WordPress blog, is now hosted on HubSpot, you can set up redirects in your website settings.
- If the domain of your old WordPress blog is still hosted on WordPress, you'll set up your redirects in WordPress. The Redirection plugin may be useful in implementing bulk redirects in WordPress.
Troubleshoot common errors
If you encounter any issues during the blog import process, review how to troubleshoot the following errors.
Content missing from an import
If something you were expecting to import did not show up in your blog, check to make sure the desired imported content is in the expected XML tags. If the content you were expecting to import is not in the XML file, check out WordPress support documentation to confirm that all content was selected and exported correctly.
The file for this import is invalidly formatted
This error means the XML file you tried to import was malformed or has syntax errors which are preventing our blog importer from reading the XML file. We will provide as much detail in the error as possible, and it is possible after correcting the mentioned error, more will arise. This is because the XML parser will stop running after finding an error.
You will see these same errors if you open the XML file in another XML parser, such as Google Chrome. For help resolving the XML errors, refer to the provider of the XML file (WordPress or Squarespace).
Retrieval of asset at URL failed
This means your XML file referenced an asset (usually an image) that did not lead to an asset. For example, if you see an error like the following:
Retrieval of asset at URL `https://www.image.com/image.jpg` failed. This asset was not uploaded to the file manager.
If you click on the mentioned URL and also confirm that it does not lead to an image, you will need to correct this image URL in the XML file and re-import the posts that were affected. You can also upload the image file to your file manager, and add the images to your post in HubSpot.