diff --git a/templates/404.html b/templates/404.html
new file mode 100644
index 0000000000000000000000000000000000000000..5e5f90f7704f3f17c3dbbc42cf228c99d6ae5003
--- /dev/null
+++ b/templates/404.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block main %}
+  <section class="section">
+    <div class="container">
+      <div class="message is-danger">
+        <div class="message-header">
+          <p>Seite nicht gefunden (404)</p>
+          <a class="button delete" href="{{ get_url(path="@/_index.md") }}"></a>
+        </div>
+        <div class="message-body">
+          Die gesuchte Seite wurde leider nicht gefunden.
+        </div>
+      </div>
+    </div>
+  </section>
+{% endblock %}
diff --git a/templates/base.html b/templates/base.html
index bc7cea51429b991645b2dc411b348ee94db92d16..a04dc57ce0039b201d1153df5755c361638f7386 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,6 +1,6 @@
 {% if page -%}
 {% set thing = page -%}
-{% else -%}
+{% elif section -%}
 {% set thing = section -%}
 {% endif -%}
 <!DOCTYPE html>
@@ -16,16 +16,17 @@
 
         {% 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 }}" />
+          {% if thing %}
+            <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 %}
           {% endif %}
         {% endblock %}