Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Modular page outputs plain html code instead of a rendered data

Solved by 01K View solution

Started by 01K 6 years ago · 1 replies · 987 views
6 years ago

Hi there!
I'm facing strange problem.
I had a working website with modular overriden templates.
As a next step I decided to rebuild it with a Gantry 5 framework.
Well, the home page does work, but strange thing happen with other pages.

For instance, I have a Main services page. Page template is set to Modular.
And it have some of code:

YAML
---
title: Test
content:
    items: '@self.modular'
    order:
        by: default
        dir: asc
body_classes: services
menu: Test
slug: test
process:
    markdown: true
    twig: true
onpage_menu: false
background: test.jpg
---

{% set image = theme_url ~ '/images/' ~ page.header.background %}
<div class="static_header" style="background-image: url('{{ image }}'); background-position: 0% 40%" >                                           
    <div class="overlay"> 
    </div>
</div>

This piece of code renders perfectly.

Next child modular page _intro:

HTML
---
title: Services
published: true
menu: MenuName
image_align: left
---

<section class="service-container container-fluid">
    <div class="row no-gutters">
    {% for image in page.media.images %}
        <div class="col-sm-12 col-md-12 col-lg-6 col-xl-3 py-2">        
            <div class="card card-body h-100">
                <div class="service-feature-box">
                    <div class="service-media">
                        {{ image.cropResize(806,582).html }}                        
                    </div>              
                   <div class="service-body">
                     <div class="custom-heading centered">
                       <h4>{{ image.meta.heading[grav.language.getLanguage] }}</h4>            
                     </div> 
                    <p class="text-justify">{{ image.meta.description[grav.language.getLanguage] }}</p>                  
                   </div>
                </div>
            </div>      
        </div>
        {% endfor %}
    </div>
</section>

and it features custom page template, called services.html.twig.
here is a code:

HTML
<section class="container-fluid">
   <div class="row no-gutters">
       <div class="col-md-12"> 
           <div id="content-slide">
          <div class="slideme">

         <div class="showcase-inner">
              {{ content }}
         </div>

            </div>
        </div>
    </div>
</div>

</section>

As a result the modular child page outputs plain html. Do I'm missing something?

6 years ago Solution

|raw have to be place on every output

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 85 13 hours ago
General · by pamtbaau, 18 hours ago
1 60 18 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 350 5 days ago
General · by Duc , 6 days ago
3 44 5 days ago