Varia's website, varia.zone or vvvvvvaria.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

syndication.html 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {#This template is for syndicating across the fucked up part of the web. It implements Open Graph and Twitter Card metadata to display links to HBSC well on social media
  2. # This code is mostly taken from Talha Mansoor's Elegant pelican theme https://github.com/talha131/pelican-elegant
  3. #}
  4. {# Thumbnail image to show when homepage is shared on social media. It also
  5. serves as the default image for posts whose featured_image is not set. #}
  6. {% if not FEATURED_IMAGE %}
  7. {% set FEATURED_IMAGE = 'https://varia.zone/images/de_varia.png' %}
  8. {% else %}
  9. {% set FEATURED_IMAGE = FEATURED_IMAGE %}
  10. {% endif %}
  11. {% macro syndication(article) %}
  12. {% if article %}
  13. <meta property="og:title" content="{{ article.title|striptags|e }} {%if article.subtitle %} - {{ article.subtitle|striptags|e }} {% endif %}"/>
  14. <meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
  15. <meta property="og:description" content="{% if article.summary %}{{article.summary|striptags}}{% endif %}" />
  16. <meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
  17. <meta property="og:article:author" content="{{ article.author }}" />
  18. {% if article.date %}
  19. <meta property="og:article:published_time" content="{{ article.date.isoformat() }}" />
  20. {% endif %}
  21. {% if article.locale_modified and article.modified %}
  22. <meta property="" content="{{ article.modified.isoformat() }}" />
  23. {% endif %}
  24. <meta name="twitter:card" content="summary_large_image">
  25. <meta name="twitter:title" content="{{ article.title|striptags|e }} {%if article.subtitle %} - {{ article.subtitle|striptags|e }} {% endif %}">
  26. <meta name="twitter:description" content="{% if article.summary %}{{article.summary|striptags}}{% endif %}">
  27. {% if article.featured_image %}
  28. {% if I18N_SUBSITES %}
  29. {% for lang, url in I18N_SUBSITES.items() %}
  30. {% if lang == 'en' %}
  31. <!-- this is a dirty hack, FIXME -->
  32. <meta property="og:image" content="http://varia.zone{{article.featured_image}}" />
  33. <meta property="og:image:secure_url" content="https://varia.zone{{article.featured_image}}" />
  34. <meta name="twitter:image" content="https://varia.zone{{article.featured_image}}" >
  35. {% endif %}
  36. {% endfor %}
  37. {% endif %}
  38. {% else %}
  39. {% if FEATURED_IMAGE %}
  40. <meta property="og:image" content="{{FEATURED_IMAGE}}" />
  41. <meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
  42. {% endif %}
  43. {% endif %}
  44. {% endif %}
  45. {% if not article %}
  46. <meta property="og:title" content="{{ SITENAME|striptags|e }}"/>
  47. <meta name="twitter:title" content="{{ SITENAME|striptags|e }}">
  48. <meta name="twitter:card" content="summary" />
  49. <meta property="og:url" content="{{ SITEURL }}" />
  50. <meta property="og:description" content="The Center of Everyday Technology is a Rotterdam based initiative that collects, conducts and instigates research into everyday technology.">
  51. <meta property="twitter:description" content="The Center of Everyday Technology is a Rotterdam based initiative that collects, conducts and instigates research into everyday technology.">
  52. <meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
  53. <meta property="og:article:author" content="{{ AUTHOR }}" />
  54. {% if FEATURED_IMAGE %}
  55. <meta property="og:image" content="{{FEATURED_IMAGE}}" />
  56. <meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
  57. {% endif %}
  58. {% endif %}
  59. {% endmacro %}