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.

1
  • Educated guess, when using Show: Content, try {{ content.body }}
    – No Sssweat
    Commented Aug 9, 2017 at 23:39

1 Answer 1

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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