datatracker/ietf/templates/doc/opengraph.html
Lars Eggert e94614e0a8
feat: Add opengraph information to document pages (#4207)
* feat: Add opengraph information to document pages

* Apply suggestions from code review

Co-authored-by: Mark Nottingham <mnot@mnot.net>

* Add IRTF and IAB logo and make card PNGs for all

* Use the cards and restore stuff that somehow got dropped

* Try and make Twitter use the "large image" card format

Co-authored-by: Mark Nottingham <mnot@mnot.net>
2022-07-23 12:07:04 -05:00

42 lines
2.6 KiB
HTML

{# Copyright The IETF Trust 2016-2020, All Rights Reserved #}
{% load origin %}
{% load static %}
{% load ietf_filters %}
{% origin %}
<meta property="og:title" content="{% if doc.get_state_slug == 'rfc' and not snapshot %}RFC {{ rfc_number }}: {% endif %}{{ doc.title }}">
<meta property="og:url" content="{{ settings.IDTRACKER_BASE_URL }}{{ request.path }}">
<link rel="canonical" href="{{ settings.IDTRACKER_BASE_URL }}{{ request.path }}">
<meta property="og:site_name" content="IETF Datatracker">
<meta property="og:description" content="{{ doc.abstract|clean_whitespace }}">
<meta property="og:type" content="article">
{% if doc.stream.slug == "ietf" or doc.name|startswith:"draft-ietf" %}
<meta property="og:image" content="{{ settings.IDTRACKER_BASE_URL }}{% static 'ietf/images/ietf-logo-card.png' %}">
<meta property="og:image:alt" content="Logo of the IETF">
<meta property="article:section" content="IETF - Internet Engineering Task Force">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
{% elif doc.stream.slug == "irtf" or doc.name|startswith:"draft-irtf" %}
<meta property="og:image" content="{{ settings.IDTRACKER_BASE_URL }}{% static 'ietf/images/irtf-logo-card.png' %}">
<meta property="og:image:alt" content="Logo of the IRTF">
<meta property="article:section" content="IRTF - Internet Research Task Force">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
{% elif doc.stream.slug == "iab" or doc.name|startswith:"draft-iab" %}
<meta property="og:image" content="{{ settings.IDTRACKER_BASE_URL }}{% static 'ietf/images/iab-logo-card.png' %}">
<meta property="og:image:alt" content="Logo of the IAB">
<meta property="article:section" content="IRTF - Internet Architecture Board">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
{% else %}{# TODO: We need a card image for individual I-Ds. #}
<meta property="article:section" content="Individual Internet-Draft">
{% endif %}
{% for author in doc.documentauthor_set.all %}<meta property="article:author" content="{{ author.person.name}}">
{% endfor %}
{% if published %}<meta property="article:published_time" content="{{ published.time|date:'Y-m-d' }}">{% endif %}
{% if expires %}<meta property="article:expiration_time" content="{{ expires.time|date:'Y-m-d' }}">{% endif %}