Instead of displaying the first few lines of the actual post, is it possible to create a separate blog post excerpt that can be used on the blog listing template?
We are migrating a client to CMS from Squarespace and the Squarespace blog has its own excerpt field.
I haven’t been able to find any possible solutions yet. Would it need to be a custom module on the post template?
Thanks,
Terry
Yes, you could create a custom field for it in the post template if you wanted. A lot of the time I’ll just use the post meta description. But if that differs from the excerpt you want it has to be a custom field.
Barry Grennan
Freelance HubSpot CMS Developer
Website | Contact
@BarryGrennan
Great idea on the meta description! I was able to test both scenarios and will check with the team to see what they want to go with.
Just in case others are curious, here is the code I used for both options
Meta Description:
To access a post’s meta description - {{ content.meta_description }}
Custom Module:
Created a custom module with one text field for the excerpt and added the module to the blog post template.
I had a little trouble finding the right module id so I used the following to get the correct one-
{{ content.widgets|pprint }}
To add the excerpt text to the blog listing template I used the following code-
{% set blog_excerpt = content.widgets.module_<module_id> %}
{{ blog_excerpt.body.excerpt }}
I believe the following would also work-
{{ content.widgets.module_<module_id>.body.excerpt }}