diff --git a/config.toml b/config.toml index cae54bf9bb47dff1de7e776cd2a18b03c93d0823..693e2d92bf26e6390fd8d2aa1119996788c8cbe4 100644 --- a/config.toml +++ b/config.toml @@ -41,6 +41,10 @@ include_content = true index_format = "elasticlunr_json" +#[extra.og.image] +#url = +#alt = + [extra.footer] address = "Kennedyallee 18<br/>53175 Bonn" bank = "<b>IBAN:</b> DE31 3705 0198 1933 0485 46<br/><b>BIC:</b> COLSDE33XXX<br/>Sparkasse KoelnBonn" diff --git a/templates/base.html b/templates/base.html index fe3718cd4f6e88faf8d0f59ab10682552220ab74..193a2e615cd597cc420d3f59ae945e5e96dbd334 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,3 +1,8 @@ +{% if page -%} +{% set thing = page -%} +{% else -%} +{% set thing = section -%} +{% endif -%} <!DOCTYPE html> <html lang="{{ lang }}"> <head> @@ -5,15 +10,30 @@ <meta name="viewport" content="width=device-width, initial-scale=1" /> {% block meta %} - {% if config.description %}<meta name="description" content="{{ config.description }}" />{% endif %} - <link rel="alternate" type="application/atom+xml" href="{{ get_url(path="atom.xml", trailing_slash=false) }}" /> + <meta name="description" content="{{ thing.description | default(value=config.description) }}" /> + <link rel="alternate" type="application/atom+xml" href="{{ get_url(path="atom.xml", trailing_slash=false) }}" /> + {% endblock %} + + {% block og %} + <meta property="og:site_name" content="{{ config.title }}" /> + <meta property="og:title" content="{% block og_title %}{{ thing.title | default(value=config.title) }}{% endblock og_title %}" /> + <meta property="og:description" content="{{ thing.description | default(value=config.description) }}" /> + <meta property="og:type" content="{% block og_type %}{{ thing.extra.og.type | default(value='article') }}{% endblock og_type %}" /> + <meta property="og:url" content="{% block og_url %}{{ thing.permalink | safe }}{% endblock og_url %}" /> + {% if thing.extra.depiction %} + <meta property="og:image" content="{{ get_url(path="@/" ~ thing.relative_path, trailing_slash=true) }}{{ thing.extra.depiction.image | safe }}" /> + <meta property="og:image:alt" content="{{ thing.extra.depiction.alt }}" /> + {% elif config.extra.og.image %} + <meta property="og:image" content="{{ get_url(path=config.extra.og.image.url) }}" /> + <meta property="og:image:alt" content="{{ config.extra.og.image.alt }}" /> + {% endif %} {% endblock %} <link rel="stylesheet" href="{{ get_url(path="fonts/roboto/index.css") }}" /> <link rel="stylesheet" href="{{ get_url(path="fonts/font-awesome/css/all.css") }}" /> <link rel="stylesheet" href="{{ get_url(path="style.css") }}" /> - <title>{% block title %}{{ config.title }}{% endblock %}</title> + <title>{% block title %}{{ thing.title }}{% endblock %}</title> </head> <body class="has-navbar-fixed-top"> diff --git a/templates/blog/overview.html b/templates/blog/overview.html index a859d5f9a5cd29818ed30c5602e71148cea593b7..f28434e661705988d0793be145c30146c34a9895 100644 --- a/templates/blog/overview.html +++ b/templates/blog/overview.html @@ -1,17 +1,5 @@ {% extends "base.html" %} -{% block meta %} - {% if section.description %} - <meta name="description" content="{{ page.description }}" /> - {% elif config.description %} - <meta name="description" content="{{ config.description }}" /> - {% endif %} -{% endblock %} - -{% block title %} - {{ section.title }} -{% endblock %} - {% block main %} <div class="my-4"> <div class="section"> diff --git a/templates/blog/post.html b/templates/blog/post.html index 68242d692d4b0070f11e6481e1451914a775e90e..6131ecd6d7057a9eb17bd1a768b353b332d7ca70 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -1,17 +1,5 @@ {% extends "base.html" %} -{% block meta %} - {% if page.description %} - <meta name="description" content="{{ page.description }}" /> - {% elif config.description %} - <meta name="description" content="{{ config.description }}" /> - {% endif %} -{% endblock %} - -{% block title %} - {{ page.title }} -{% endblock %} - {% block main %} <h1>{{ page.title }}</h1> <div class="my-4"> diff --git a/templates/index.html b/templates/index.html index 636e355d239b73eaedc5fcb830d4890ac581c3bf..07e3d36780178ad286e2ae2cde79c2a1241312b0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block og_type %}website{% endblock %} + {% block main %} {% include "frontpage/blocks/claim.html" %} {% include "frontpage/blocks/projects.html" %} diff --git a/templates/page.html b/templates/page.html index 36983fcd9da1d67355f49aeb8a0a0ab05cb43f08..c30179b5be2ed3fe4abdec2d8583b4615487fa5d 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,17 +1,5 @@ {% extends "base.html" %} -{% block meta %} - {% if page.description %} - <meta name="description" content="{{ page.description }}" /> - {% elif config.description %} - <meta name="description" content="{{ config.description }}" /> - {% endif %} -{% endblock %} - -{% block title %} - {{ page.title }} -{% endblock %} - {% block main %} {% include "pages/heading.html" %} <div class="my-4">