article.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {% extends "base.html" %}
  2. {% block html_lang %}{{ article.lang }}{% endblock %}
  3. {% block head %}
  4. {% block title %}
  5. <title>{{ article.title }} - {{SITENAME}}</title>
  6. {% endblock %}
  7. {{ super() }}
  8. {% import 'translations.html' as translations with context %}
  9. {% if translations.entry_hreflang(article) %}
  10. {{ translations.entry_hreflang(article) }}
  11. {% endif %}
  12. {% if article.styles %}
  13. {% for style in article.styles %}
  14. {{ style|format(SITEURL) }}
  15. {% endfor %}
  16. {% endif %}
  17. {% if article.js %}
  18. {% for script in article.js %}
  19. {% if 'top' in script[-7:] %}
  20. {{ script[:-5]|format(SITEURL) }}
  21. {% endif %}
  22. {% endfor %}
  23. {% endif %}
  24. {% block seo %}
  25. {% set seo_description = article.summary|striptags %}
  26. {% set SEO_DESC_LENGTH = 175 %}
  27. {% if seo_description|length >= SEO_DESC_LENGTH %}
  28. {# Quita la última palabra para no dejarla incompleta #}
  29. {% set seo_description = seo_description[:SEO_DESC_LENGTH].split(' ')[:-1]|join(' ') %}
  30. {% if not seo_description[-1] in ['.', '?', ':', '!'] %}
  31. {% set seo_more = seo_description + '…' %}
  32. {% set seo_description = seo_more|replace('"','') %}
  33. {% endif %}
  34. {% endif %}
  35. <!-- Meta Article -->
  36. <meta name="author" content="{{ article.author.name }}"/>
  37. <meta name="description" content="{{ seo_description|striptags }}"/>
  38. <meta name="keywords" content="{{ article.tags|join(', ') }}"/>
  39. <meta property="article:author" content="{{ article.author }}"/>
  40. <meta property="article:section" content="{{ article.category }}"/>
  41. <meta property="article:published_time" content="{{ article.date.strftime("%Y-%m-%d-T%H-%M-%S") }}"/>
  42. {% if article.modified %}
  43. <meta property="article:modified_time" content="{{ article.modified.isoformat() }}"/>
  44. {% endif %}
  45. <!-- OpenGraph -->
  46. <meta property="og:type" content="article"/>
  47. <meta property="og:tag" content="{{ article.tags|join(',')|escape }}"/>
  48. <meta property="og:title" content="{{ article.title }} - {{ SITENAME }}"/>
  49. <meta property="og:description" content="{{ seo_description|striptags }}"/>
  50. <meta property="og:site_name" content="{{ SITENAME }}"/>
  51. <meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
  52. <meta property="og:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}"/>
  53. <!-- Twitter -->
  54. <meta name="twitter:card" content="summary"/>
  55. <meta name="twitter:title" content="{{ article.title }} - {{ SITENAME }}"/>
  56. <meta name="twitter:description" content="{{ seo_description|striptags }}"/>
  57. <meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}"/>
  58. <meta name="twitter:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}"/>
  59. {% endblock %}
  60. {% endblock %}
  61. {% block content %}
  62. <div class="container">
  63. <!-- start of posts -->
  64. <div class="columns is-multiline is-centered">
  65. <!-- start of post -->
  66. <article class="column is-10" itemscope itemtype="https://schema.org/CreativeWork">
  67. <div class="card">
  68. <!-- post header -->
  69. <div class="card-content-header">
  70. <h2 class="title is-4 has-text-centered" id="titulo" itemprop="name">{{ article.title }}</h2>
  71. </div>
  72. <!-- end of post header -->
  73. <!-- post content -->
  74. <div class="card-content">
  75. <div class="content">
  76. <div class="card-inner-wrapper">
  77. <!-- post text -->
  78. <div class="card-content-text has-text-justified" itemprop="text">
  79. {% if article.toc %}
  80. <nav class="toc">
  81. {{ article.toc }}
  82. </nav>
  83. {% endif %}
  84. {{ article.content }}
  85. </div>
  86. <!-- end of post text -->
  87. <!-- post footer -->
  88. <div class="card-content-footer-small">
  89. <div class="navbar is-social-center">
  90. <a class="navbar-item" {% if article.gnusocial %}href="{{ article.gnusocial }}" rel="me noopener noreferrer" target="_blank" {% else %}href="#"{% endif %}>
  91. <span class="soumaicon">
  92. <svg>
  93. <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#gnusocial" />
  94. <title>GNUSocial</title>
  95. </svg>
  96. </span>
  97. </a>
  98. <a class="navbar-item" {% if article.diaspora %}href="{{ article.diaspora }}" rel="me noopener noreferrer" target="_blank" {% else %}href="#"{% endif %}>
  99. <span class="soumaicon">
  100. <svg>
  101. <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#diaspora" />
  102. <title>Diaspora</title>
  103. </svg>
  104. </span>
  105. </a>
  106. <a class="navbar-item" {% if article.mastodom %}href="{{ article.mastodom }}" rel="me noopener noreferrer" target="_blank" {% else %}href="#"{% endif %}>
  107. <span class="soumaicon">
  108. <svg>
  109. <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#mastodon" />
  110. <title>Mastodon</title>
  111. </svg>
  112. </span>
  113. </a>
  114. </div>
  115. <!-- post footer nav -->
  116. {% include 'article_info.html' %}
  117. <!-- end of post footer nav -->
  118. </div>
  119. <!-- end of post footer -->
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <!-- end of post content -->
  125. <!-- post comments -->
  126. {% include 'comments.html' %}
  127. <!-- end of comments -->
  128. </article>
  129. <!-- end of post -->
  130. </div>
  131. <!-- end of post column -->
  132. </div>
  133. {% endblock %}