CMS Development

TakuyaAimi
Contributor

How to use Blog variables {{ content.post_body }} without wrapper

SOLVE

Hello.

 

I want to use {{ content.blog_post }} without wrapper.

 

Now,I make Blog Template with "HTML & HUBL".

 

I write

<div class="News_article">
  {{ content.post_body }}
</div>

Output

<div class="News_article">
<span id="hs_cos_wrapper_post_body" class="hs_cos_wrapper hs_cos_wrapper_meta_field hs_cos_wrapper_type_rich_text" style="" data-hs-cos-general-type="meta_field" data-hs-cos-type="rich_text">
~~~~ Blog Post ~~~~
</span>
</div>

 But I want that likes "no_wrapper=True"

<div class="News_article">
  ~~~~ Blog Post ~~~~
</div>

 

Please help me...

1 Accepted solution
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to use Blog variables {{ content.post_body }} without wrapper

SOLVE

@TakuyaAimi - I think maybe you can do:

{% if request.domain == 'preview.hs-sites.com' %}
    {{ content.post_body }}          
{% else %}
    {{ content.post_body_rss }}
{% endif %}

If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

View solution in original post

3 Replies 3
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to use Blog variables {{ content.post_body }} without wrapper

SOLVE

@TakuyaAimi - I think maybe you can do:

{% if request.domain == 'preview.hs-sites.com' %}
    {{ content.post_body }}          
{% else %}
    {{ content.post_body_rss }}
{% endif %}

If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

TakuyaAimi
Contributor

How to use Blog variables {{ content.post_body }} without wrapper

SOLVE

Thanks to you!

 

I solved!

 

But...

{% if request.domain == 'preview.hs-sites.com' %}
    {{ content.post_body }}          

Why?

 

When I preview with preview.hs-site.com, HTML  has <span>.

I cant hope...

So, I use {{ content.post_body_rss}} only.

 

Please teach me reason that code.

0 Upvotes
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to use Blog variables {{ content.post_body }} without wrapper

SOLVE

@TakuyaAimi - That code is there because you won't be able to edit the blog post in the blog post editor if {{content.post_body}} isn't present. So I used that tag on the content editor only, then on the public facing, you would show the rss version.

0 Upvotes