Skip to content

Instantly share code, notes, and snippets.

@jenlampton
Last active December 17, 2015 17:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenlampton/5647420 to your computer and use it in GitHub Desktop.
Save jenlampton/5647420 to your computer and use it in GitHub Desktop.
New node template (and variables) for Twig in D8
<article id="node-{{ nid }}" class="clearfix {{ attributes.class }}"{{ attributes }}>
{{ title.prefix }}
{% if not page %}
<h2{{ title.attributes }}><a href="{{ url }}" rel="bookmark">{{ title.label }}</a></h2>
{% endif %}
{{ title.suffix }}
{% if display_submitted %}
<footer>
{{ author }}
<p class="submitted">
{% trans %}
Submitted by {{ author.name }} on {{ published_date|format_date('medium') }}
{% endtrans %}
</p>
</footer>
{% endif %}
<div{{ content.attributes }}>
{# We hide the comments and links now so that we can render them later. #}
{{ content.field_x }}
{{ content.inner }}
</div>
{{ links }}
{{ comments }}
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment