seo_metadata.html 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. {% macro seo_metadata(article) %}
  2. <meta property="og:title" content="{{ article.title|striptags }} {%if article.subtitle %} - {{ article.subtitle }} {% endif %}"/>
  3. <meta property="og:type" content="article" />
  4. <meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
  5. <meta property="og:description" content="{{article.summary|striptags}}" />
  6. <meta property="og:site_name" content="{{ SITENAME|striptags }}" />
  7. <meta property="og:article:author" content="{{ article.author }}" />
  8. {% if article.date %}
  9. <meta property="og:article:published_time" content="{{ article.date.isoformat() }}" />
  10. {% endif %}
  11. {% if article.locale_modified and article.modified %}
  12. <meta property="" content="{{ article.modified.isoformat() }}" />
  13. {% endif %}
  14. <meta name="twitter:card" content="summary">
  15. {% from '_includes/_defaults.html' import TWITTER_USERNAME with context %}
  16. {%if TWITTER_USERNAME %}
  17. <meta name="twitter:creator" content="@{{TWITTER_USERNAME}}">
  18. {% endif %}
  19. <meta name="twitter:title" content="{{ article.title|striptags }} {%if article.subtitle %} - {{ article.subtitle }} {% endif %}">
  20. <meta name="twitter:description" content="{{article.summary|striptags}}">
  21. {% if article.featured_image %}
  22. <meta property="og:image" content="{{article.featured_image}}" />
  23. <meta name="twitter:image" content="{{article.featured_image}}" >
  24. {% else %}
  25. {% from '_includes/_defaults.html' import FEATURED_IMAGE with context %}
  26. {% if FEATURED_IMAGE %}
  27. <meta property="og:image" content="{{FEATURED_IMAGE}}" />
  28. <meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
  29. {% endif %}
  30. {% endif %}
  31. {% endmacro %}