CMS Development

RikinShah
Member

Adding custom fields to blog post

SOLVE

Hi

 

Is there any way to add more text fields to blogpost than just body content? I would like to add few more text field and then reference it in template. Example would be pull quote, more images which are not in body content etc. 

 

Also apart from topics is there any way to add another list reference whcih I can use to filter blog post?

1 Accepted solution
relabidin
Solution
HubSpot Alumni
HubSpot Alumni

Adding custom fields to blog post

SOLVE

 

Hi @RikinShah,

 

You can add extra modules to your blog post template by using HubL modules, which will render the module on the post. Please refer to this documentation on how to create a Rich Text module using a snippet of HubL Code: http://designers.hubspot.com/docs/hubl/hubl-supported-modules#rich-text

 

The only drawback here is that modules that you add to your post template can only be added before or after the post body, not directly within it. Here is a screenshot showing my blog post template, where I have added the HubL code that generates a Rich Text module below the post body.

 

2017-02-21_1259.png

 

Rami 

View solution in original post

4 Replies 4
relabidin
Solution
HubSpot Alumni
HubSpot Alumni

Adding custom fields to blog post

SOLVE

 

Hi @RikinShah,

 

You can add extra modules to your blog post template by using HubL modules, which will render the module on the post. Please refer to this documentation on how to create a Rich Text module using a snippet of HubL Code: http://designers.hubspot.com/docs/hubl/hubl-supported-modules#rich-text

 

The only drawback here is that modules that you add to your post template can only be added before or after the post body, not directly within it. Here is a screenshot showing my blog post template, where I have added the HubL code that generates a Rich Text module below the post body.

 

2017-02-21_1259.png

 

Rami 

swarming
Member

Adding custom fields to blog post

SOLVE

 Hi @relabidin,

I had followed your exact steps and had added the following code to the Blog Post section.

{% rich_text "rich_text" %}
{% rich_text "left_column" label="Enter HTML here" html='<div>My rich text default content</div>' %}

The text does display when I am creating a new blog post, however it is appearing as a label and I cannot edit it on each of the blog post. All blog post show the same text. 


Has something changed in HubSpot since your reply to this issue?

Thanks in advance.

- Pradeep.

DomP
Member

Adding custom fields to blog post

SOLVE

Hi, hope this topic is still open for debate.

 

We'd like to do what the OP suggested and have another field on our blog posts, specifically to add another image which is separate from both the body of the post and the featured image.

 

On our homepage currently, the latest blog posts are listed, using the featured image. As we use quite strong quality for these images, the files are rather large, >120k easily, so when these images are being pulled in on mobile, not only are they large, they are poorly cropped.

 

Is there anyway to add a new field into the posting template, not the post template or the listing template? And then call this image as a variable in HubL for our homepage?

tragicrich
Member

Adding custom fields to blog post

SOLVE

I was running into a somewhat similar issue as DomP. We wanted a custom image for our listing posts vs our detail posts. Support helped me to work around this issue. You can add a custom image module to your blog post template, update your blog post template to use that as its featured image, and then use the standard featured image as your blog listing image for your list or recent post templates.

 

{% image "custom_image_module" widget_name='Faux Featured Image', label='Image to add for posts' %}

or

{% image_src 'custom_listing_image' widget_name='Custom Listing Image', no_wrapper=True %}

 

I hope this helps somebody else in the future!