How to use Twig expression in content fields and render? How to use twig expression in Drupal 8 content field and render. If I embed following twig expression in field value 

{% if variable == 1 %} 
   you are logged in
{% endif %} 


When I render the field template I want to print "you are logged in".

Right now it renders as:

{% if variable == 1 %} 
  you are logged in
{% endif %} 


Though views allow Twig expression. Can we achieve same in content fields?
You cannot use Twig code as field value. You have to put that code in a template file. Or you can use Twig code in Views field value rewriting (but not as field value). 2nd is limited to variables of the view that are before to rewritten field. The function can be found in Views UI by clicking on the field name in the "Fields" section.