Add OpenGraph and Twitter metadata to posts

This commit is contained in:
Wesley Moore 2020-09-14 10:53:19 +10:00
parent a05086f29e
commit a17d8bc9fa
No known key found for this signature in database
GPG key ID: BF67766C0BC2D0EE
3 changed files with 12 additions and 0 deletions

View file

@ -21,3 +21,4 @@ build_search_index = false
[extra] [extra]
author = "Wesley Moore" author = "Wesley Moore"
email = "wes@wezm.net" email = "wes@wezm.net"
twitter_name = "@wezm"

View file

@ -6,6 +6,7 @@
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{{ config.base_url }}/screen.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="{{ config.base_url }}/screen.css" type="text/css" charset="utf-8" />
<link rel="alternate" type="application/rss+xml" href="{{ config.base_url }}/rss.xml" title="Wesley Moore" /> <link rel="alternate" type="application/rss+xml" href="{{ config.base_url }}/rss.xml" title="Wesley Moore" />
{% block metadata %}{% endblock %}
</head> </head>
<body class="{{ section.extra.body_class | default(value="") }}"> <body class="{{ section.extra.body_class | default(value="") }}">
{% block body %}{% endblock %} {% block body %}{% endblock %}

View file

@ -2,6 +2,16 @@
{% block title %}{{ page.title }} - {{ config.title }}{% endblock %} {% block title %}{{ page.title }} - {{ config.title }}{% endblock %}
{% block metadata %}
<meta property="og:url" content="{{ page.permalink }}" />
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:description" content="{{ page.summary | default(value="") | striptags }}" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en_AU" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="{{ config.extra.twitter_name }}" />
{% endblock %}
{% block body %} {% block body %}
<h1 class="logo"><a href="{{ config.base_url }}/" class="no-border hover-underline">👨‍💻 {{ config.title }}</a></h1> <h1 class="logo"><a href="{{ config.base_url }}/" class="no-border hover-underline">👨‍💻 {{ config.title }}</a></h1>