CMS Development

Larsc
Participant

Get blog's post_body without summary?

SOLVE

Hi!

 

In my design, it is necessary to show the blog summary in a different DIV then the main body.

Therefore I'm looking for a way to get a blog's body without the summary. is this even possible? It seems like there is no default HubL tag for this.

 

I allready tried the following tags, without success:

{{ content.post_body|cut(content.post_summary) }}
{{ content.post_body|replace(content.post_summary, '') }}

 

Is there any way to achieve this? Any help would be greatly appreciated!

 

Kind regards,

Lars Claus

1 Accepted solution
ndwilliams3
Solution
Key Advisor

Get blog's post_body without summary?

SOLVE

if you need to place the summary and remaining body in specific places, you can use this.

 

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

<div class="this_is_the_summary">
{{  sections[0] }}
</div>

<div>
This is other content between the two.
</div>

<div class="this_is_the_remaining_body">
{{  sections[1] }}
</div>

View solution in original post

0 Upvotes
3 Replies 3
ndwilliams3
Key Advisor

Get blog's post_body without summary?

SOLVE

try this

{% set sections = content.post_body|split('<!--more-->', 2) %}
{% for section in sections %}
<div class="content-section content-section-{{loop.index}}">{{ section }}</div>
{% endfor %}
                
0 Upvotes
ndwilliams3
Solution
Key Advisor

Get blog's post_body without summary?

SOLVE

if you need to place the summary and remaining body in specific places, you can use this.

 

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

<div class="this_is_the_summary">
{{  sections[0] }}
</div>

<div>
This is other content between the two.
</div>

<div class="this_is_the_remaining_body">
{{  sections[1] }}
</div>
0 Upvotes
Larsc
Participant

Get blog's post_body without summary?

SOLVE

Works perfectly, thanks!

0 Upvotes