Add basic opengraph support

This commit is contained in:
Matthias Portzel 2022-05-19 13:44:02 -07:00
parent 7ad6f21f66
commit c28a51bf13
3 changed files with 35 additions and 7 deletions

View File

@ -9,6 +9,15 @@
{% endif %}
{% endblock %}
{% block head %}
<meta name="twitter:card" content="summary">
<meta content="About" property="og:title">
<meta content="About" name="twitter:title">
<meta content="This is a website that I created to document my thoughts..." property="og:description">
<meta content="This is a website that I created to document my thoughts..." name="twitter:description">
{% endblock %}
{% block main %}
<h1>Welcome!</h1>

View File

@ -11,14 +11,31 @@
{% endblock %}
{% block head %}
<link rel="alternate" href="/feed" type="application/rss+xml" title="RSS">
{% if not first_page %}
<link rel="canonical" href="/?page={{ current_page_slug }}">
{% else %}
<link rel="canonical" href="/">
{% endif %}
<link rel="alternate" href="/feed" type="application/rss+xml" title="RSS">
{% if not first_page %}
<link rel="canonical" href="/?page={{ current_page_slug }}">
{% else %}
<link rel="canonical" href="/">
{% endif %}
<link href="{% static 'thoughts/codehighlight.css' %}" rel="stylesheet">
<link href="{% static 'thoughts/codehighlight.css' %}" rel="stylesheet">
<!-- Open Graph + Twitter card -->
<meta name="twitter:card" content="summary">
<meta content="Thoughts" property="og:title">
<meta content="Thoughts" name="twitter:title">
{% for thought in thoughts %}
{% if thought.uuid == highlighted %}
<meta content="{{ thought.text }}" property="og:description">
<meta content="{{ thought.text }}" name="twitter:description">
{% if thought.get_media_type == "png" or thought.get_media_type == "jpeg" %}
<meta content="{{ thought.media.url }}" property="og:image">
<meta content="{{ thought.media.url }}" name="twitter:image">
{% endif %}
{% endif %}
{% endfor %}
{% endblock %}
{% block main %}

View File

@ -7,6 +7,8 @@
{% load static %}
<link href="{% static 'thoughts/main.css' %}" rel="stylesheet">
<meta content="thoughts.learnerpages.com" property="og:site_name">
{% block head %}{% endblock %}
<link rel="icon" sizes="192x192" href="{% static 'images/favicon-192x192.png'%}">