node.html.twig 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {# Create classes array. The 'node' class is required for contextual edit links. #}
  2. {% set classes = [
  3. 'node'
  4. ] %}
  5. {# BEM inspired class syntax: https://en.bem.info/
  6. Enable this code if you would like node classes like "article article--layout-teaser", where article is the content type and teaser is the view mode.
  7. {% set classes = classes|merge([
  8. node.bundle|clean_class,
  9. view_mode ? node.bundle|clean_class ~ '--layout-' ~ view_mode|clean_class
  10. ]) %}
  11. {% set title_classes = [
  12. node.bundle|clean_class ~ '__title'
  13. ] %}
  14. #}
  15. <article{{ attributes.addClass(classes) }}>
  16. {% if title_prefix or title_suffix or display_submitted or unpublished or page is empty and label %}
  17. <header>
  18. {{ title_prefix }}
  19. {% if not page and label %}
  20. <h2{{ title_attributes.addClass(title_classes) }}>
  21. <a href="{{ url }}" rel="bookmark">{{ label }}</a>
  22. </h2>
  23. {% endif %}
  24. {{ title_suffix }}
  25. {% if display_submitted %}
  26. <div class="submitted">
  27. {{ author_picture }}
  28. {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
  29. {{ metadata }}
  30. </div>
  31. {% endif %}
  32. {% if not node.published %}
  33. <p class="node--unpublished">{{ 'Unpublished'|t }}</p>
  34. {% endif %}
  35. </header>
  36. {% endif %}
  37. <div{{ content_attributes.addClass('content') }}>
  38. {{ content|without('links') }}
  39. </div><!-- /.content -->
  40. {% if content.links %}
  41. <div class="links">
  42. {{ content.links }}
  43. </div><!-- /.links -->
  44. {% endif %}
  45. </article><!-- /.node -->