CMS Development

Majkrzakamil
Member

Custom rich text field exact as blog content field

SOLVE

Hi, I'm working on the blog post template and modules. I'd love to have a big rich text field (exacly as the default Blog content field). Can I somehow insert such a field inside a module so it'll be available for blog post?

This is how I want the rich text field to display for content editing:
https://knowledge.hubspot.com/cos-pages-editor/how-to-use-the-rich-text-module

Unfortunately I couldn't find anything that would allow me to create custom field that acts this way. All I found is for editing in the left side panel.

0 Upvotes
1 Accepted solution
jonchim
Solution
Guide | Diamond Partner
Guide | Diamond Partner

Custom rich text field exact as blog content field

SOLVE

Hey @Majkrzakamil,

Got it, thank you for the clarification.

So inside the default HubSpot "Blog Content" We've used  the following code to break up sections of blog content. It's a bit buggy but it does work. When I say buggy it repeats the second section of blog content underneath the entire post. But the blog should be editable in just the one big section. Not ideal but not sure if there's a workaround

{% set sections = content.post_body|split('<!--more-->', 2) %}

 

<!-- first section of blog copy copy -->

<div class="first-section"> 
{{ sections[0] }}
</div>

 

<!-- This will be your custom module that you grab from the custom module snippet on the bottom right when you edit the moduel  -->

<div> 
{% module "module_number" path="/path-to-module", label="label of custom module" %}
</div>

 

<!-- second section of blog copy -->

<div class="second-section"> 
{{ sections[1] }}
</div>






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution

View solution in original post

5 Replies 5
jonchim
Solution
Guide | Diamond Partner
Guide | Diamond Partner

Custom rich text field exact as blog content field

SOLVE

Hey @Majkrzakamil,

Got it, thank you for the clarification.

So inside the default HubSpot "Blog Content" We've used  the following code to break up sections of blog content. It's a bit buggy but it does work. When I say buggy it repeats the second section of blog content underneath the entire post. But the blog should be editable in just the one big section. Not ideal but not sure if there's a workaround

{% set sections = content.post_body|split('<!--more-->', 2) %}

 

<!-- first section of blog copy copy -->

<div class="first-section"> 
{{ sections[0] }}
</div>

 

<!-- This will be your custom module that you grab from the custom module snippet on the bottom right when you edit the moduel  -->

<div> 
{% module "module_number" path="/path-to-module", label="label of custom module" %}
</div>

 

<!-- second section of blog copy -->

<div class="second-section"> 
{{ sections[1] }}
</div>






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution
jonchim
Guide | Diamond Partner
Guide | Diamond Partner

Custom rich text field exact as blog content field

SOLVE

Hey @Majkrzakamil,

 

When adding a RTE field to a module, from the left side there should be a button that will allow you open to expand the field and on the right side it will be bigger for a big block of text. Still maybe not as ideal as the blog content module. What would be the purpose of this rich text module be in the blog template? I think you should be able to take the blog content module and add another one to the template. 


Screen Shot 2020-12-15 at 11.24.24 AM.pngScreen Shot 2020-12-15 at 11.24.47 AM.png

 






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution
Majkrzakamil
Member

Custom rich text field exact as blog content field

SOLVE

Hi @jonchim thx for your answer,
Well answering your question, what is the purpose. We're redesigning current blogposts and this redesign includes custom modules between big sections of text. Well it's easy to achieve using repeater and rich text fields, although our content editors aren't really fans of this field (due to the inconvenience working with a lot of text as well as it's not WYSIWYG). Therefore we want to use this field 'blog content'. It's just way better to work with and it's important to have it.
You said you think it's possible to add another blog content field. Do you have any information how to do so? It would be a game changing feature for us.

Thanks,
Kamil

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Custom rich text field exact as blog content field

SOLVE

Hello @Majkrzakamil !

Welcome to the Community!

You can totally insert a RTE field in a module.  For your reference, here is the field listed in the documentation.

Are you creating the module in the Design Manager or using the CLI? 

@jonchim  is aces with the CMS and can probably guide you forward if you need more help!  I would also suggest taking a look at the CMS Certification on the Academy

Majkrzakamil
Member

Custom rich text field exact as blog content field

SOLVE

Hi @dennisedson thanks for your answer!
Unfortunately this field is just a classic rich text field. What I'm looking for is here.
See the problem with rich text is that it's just to narrow (edit field in left sidebar) and inconvenient for a big block of text. But this one "Edit content in a rich text module" is perfect. I want to have this field inside a custom module - not only default one as it is now in blog post.
Is there any way to achive this? Can I just create this somehow with hubl power?

Thanks,
Kamil

0 Upvotes