1

I have a view called customfeedview showing contents of a content type viz. customfeeds. View Setting are given in the picture below: View Settings I created views-view--customfeedview.html.twig to customize the view. Code of the file is given here under.

        <div class="box prog">
            <div class="col-md-3"><img src="{{directory}}/images/2000px-Lotus_position.svg.png" ></div>
            <div class="col-md-9">
                    <h3><b>{{ fields.title.content }} </b></h3>
                        <p>{{ fields.body.content }} </p>
            </div>
      </div>

But {{ fields.body.content }} & {{ fields.title.content }} does not render title and body of the contents of type customfeed.

Please help me in this issue as I am totally a beginner in drupal 8. Thank you...

N.B.: Here I am using show-type content instead of fields as only show-type content only give read-more option in the view page. Using show-type fields {{ fields.body.content }} is working fine but whenever I changed it to content {{ fields.body.content }} is not rendering the values.

  • Educated guess, when using Show: Content, try {{ content.body }} – No Sssweat Aug 9 '17 at 23:39
0

You can call the node field in the view template

 node.field_(your-field).value 

This will print the html tags as well, If the node field has the html structure.

node.field_(your-field).value | raw (or) node.field_(your-field).value |render|striptags

This will clean the html structure and useful to print the node value inside the view.template

NOTE: using node. instead of content. , because content. will be used only the node.html.twig

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.