How to migrate from a blog template to a blog_listing template

Last updated:

While blog templates do support the same functionality as a blog_listing template, they can provide a more confusing experience for both developers and content creators. Using explicit blog_listing and blog_post templates causes them to be listed appropriately in the blog settings, and makes the markup easier to maintain as a developer.

How to migrate

Migration to the new template type is easy. First determine if your existing blog template is currently being used for both the listing and post detail template, or just the listing template.

If you have a blog template that is intended solely for creating a listing view.

  1. change the templateType to blog_listing.
  2. Verify under blog settings that the correct blog template is selected.

If your blog template is a shared template for both your blog listing and blog post views.

  1. clone your template.
  2. Change the templateType to blog_listing.
  3. Set your template's label to something easy to differentiate from the old version.
  4. Change the selected template under settings for your listing view to be your newly created template.

You could do the same for the blog_post template. But changing templateType to blog_post.

To make your code simpler and easier to read you can remove the if is_listing_view statement and leave only your listing code in your listing template, and only your post code in your post template.


Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.