How to migrate from a blog template to a blog_listing template
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.
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.
- change the
templateType
toblog_listing
. - 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.
- clone your template.
- Change the
templateType
toblog_listing
. - Set your template's
label
to something easy to differentiate from the old version. - 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.
Thank you for your feedback, it means a lot to us.