diff --git a/templates/404.html b/templates/404.html
new file mode 100644
index 0000000..871583d
--- /dev/null
+++ b/templates/404.html
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block content %}
+
+ The page you were looking for isn't here …
+ You may have been interested in …
+
+
+{% endblock %}
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..9ddea4e
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,42 @@
+{% import "helpers.html" as helper %}
+
+
+
+
+ {% block title %}{{ extra[view].title | default(value="…") }}{% endblock %} | {{extra.site_name|default(value="echoip")}}
+
+
+ {% block metadata %}
+
+
+
+
+ {% set og_image = extra.og_image | default(value="") %}
+ {% set og_image = extra[view].og_image | default(value=og_image) %}
+ {% if og_image %}{%endif%}
+ {% endblock %}
+
+
+ {% if extra.stylesheet %}{% endif %}
+ {% if extra.favicon %}{% endif %}
+
+
+
+
+ {% block h1 %}{{ extra[view].title | default(value="…") }}{% endblock %}
+ {% block content %}
+ If you see this the templating is broken. Greetings from the base template.
+ {% endblock %}
+
+
+
diff --git a/templates/dig.html b/templates/dig.html
index b731446..acac17b 100644
--- a/templates/dig.html
+++ b/templates/dig.html
@@ -1,17 +1,34 @@
-
-{% set r = data.result %}
-{% set q = data.query %}
-
-
- Dig: {{ q.name }}
-
-
- Lookup for: {{ q.name }}
+{% extends "base.html" %}
+{% import "helpers.html" as helper %}
+
+{% block title %}dig {{ data.query }}{% endblock %}
+{% block og_title %}dig {{ data.query }}{% endblock %}
+{% block h1 %}dig {{ data.query }}
{% endblock %}
+
+{% block og_path %}/dig/{{ data.query | urlencode_strict }}{% endblock %}
+
+{% block content %}
+{% if data.result.idn %}
+{% set idn = data.result.idn %}
+
+ Internationalized Domain Names
+ Because of some limitations the DNS has, Unicode caracters need a special encoding.
+ {% if idn.original_was == "unicode" %}
+ Your Unicode query has been encoded as the IDN {{ idn.idn }}
to generate the results below.
+ {% else %}
+ Your IDN would decode to {{ idn.unicode }}
.
+ {% endif %}
+
+{% endif %}
+
+{% set r = data.result.records %}
+
+ DNS Records
{% if r.a %}
- A
(IPv4) records:
-
+{% endblock %}
diff --git a/templates/extra.toml b/templates/extra.toml
index 09c2a13..a84326f 100644
--- a/templates/extra.toml
+++ b/templates/extra.toml
@@ -1 +1,13 @@
site_name="echoip-slatecave"
+base_url="http://localhost:3000"
+
+# Url to the deafult opengraph preview image
+# og_image=""
+
+# Url to your stylesheet
+stylesheet = "https://slatecave.net/assets/site_slatecave/slatecave_v3.css"
+
+#Url to and mimetype of your favicon
+# favicon = ""
+# favicon_mimetype = "image/png"
+# favicon_mimetype = "image/jpeg"
diff --git a/templates/helpers.html b/templates/helpers.html
index d568d7b..826f846 100644
--- a/templates/helpers.html
+++ b/templates/helpers.html
@@ -5,3 +5,15 @@
{% endif %}
{% endmacro place_dl %}
+{% macro dig_link(extra, name) %}
+{{ extra.base_url }}/dig/{{ name | trim_end_matches(pat=".") | urlencode_strict | replace(from="%2e", to=".") | safe }}
+{% endmacro dig_link %}
+
+{% macro dig(extra, name, fqdn=false, prefix="") %}
+{% if prefix %}{{ prefix }} {% endif %}{% if fqdn or name=="." %}{{ name }}{% else %}{{ name | trim_end_matches(pat=".") }}{% endif %}
+{% endmacro dig %}
+
+{% macro ip(extra, ip) %}
+{{ ip }}
+{% endmacro dig %}
+
diff --git a/templates/index.html b/templates/index.html
index 6121417..d7a81d9 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,68 +1,29 @@
+{% extends "ip.html" %}
{% import "helpers.html" as helper %}
-
-
-
- Your IP: {{ data.query.ip }}
-
-
- {% set r = data.result %}
-
- Your IP-Address is: {{ data.query.ip }}
-
- Network Information
-
- {% if r.hostname %}
- Hostname
- - {{r.hostname}}
- {% endif %}
- {% if r.asn %}
- ASN
- - AS{{r.asn.asn}}
- AS Name
- - {{ r.asn.name }}
-
- {% endif %}
-
- {% if r.location %}
-
- Geolocation
-
- {{ helper::place_dl(place=r.location.continent, label="Continent") }}
- {{ helper::place_dl(place=r.location.country, label="Country") }}
- {{ helper::place_dl(place=r.location.registered_country, label="Registred in") }}
- {{ helper::place_dl(place=r.location.represented_country, label="Represents") }}
- {% if r.location.subdivisions %}
- {% for sd in r.location.subdivisions %}
- {{ helper::place_dl(place=sd, label="Subdivision", iso_code_prefix=r.location.country.iso_code|default(value="")) }}
- {% endfor %}
- {% endif %}
- {{ helper::place_dl(place=r.location.city, label="City") }}
- {% if r.location.postal_code %}
- Postal Code
- - {{r.location.postal_code}}
- {% endif %}
- {% if r.location.time_zone %}
- Timezone
- - {{r.location.time_zone}}
- {% endif %}
-
-
-
- The GeopIP and ASN information is provided by the GeoLite2 database created by
- MaxMind.
-
-
- {% endif %}
- {% if data.user_agent %}
-
- User Agent
- Independent of your IP-Address your browser sends a User Agent header with each http request.
- Your browser sent: {{data.user_agent}}
-
- {% endif %}
-
-
+
+{% block title %}Your IP: {{ data.result.address }}{% endblock %}
+{% block og_title %}What is my IP-Address?{% endblock %}
+{% block h1 %}Your IPv{% if data.result.ip_info.is_v6_address %}6{% else %}4{% endif %}: {{ data.result.address }}
{% endblock %}
+
+{% block description %}
+ Look up Your and others public IP-Adresses. - {{ data.result.address }}
+{% endblock %}
+
+{% block og_path %}/{% endblock %}
+
+{% block other_ip_button %}
+
+{% endblock %}
+
+{% block extra_content %}
+
+ Your User Agent
+ The program you were using to download this page identified itself as {{ data.user_agent }}
+ While this doesn't have to do anything with your public IP-Adress this might be useful information.
+ You can use the /ua
endpoint to fetch this information with any client
+
+
+ Did you know?
+ If you share this site and the Link gets a preview. The IP-Address after the dash is the one of the machine that generated that preview
+
+{% endblock %}
diff --git a/templates/ip.html b/templates/ip.html
index a18ef86..b9b91dc 100644
--- a/templates/ip.html
+++ b/templates/ip.html
@@ -1,18 +1,22 @@
+{% extends "base.html" %}
{% import "helpers.html" as helper %}
-
-
-
- {{ data.query.ip }}
-
-
+
+{% block title %}{{ data.result.address }}{% endblock %}
+{% block og_title %}Lookup {{ data.result.address }}{% endblock %}
+{% block h1 %}Lookup {{ data.result.address }}
{% endblock %}
+
+{% block og_path %}/ip/{{ data.result.address }}{% endblock %}
+
+{% block content %}
{% set r = data.result %}
- About IP-Address: {{ data.query.ip }}
Network Information
+ Type of Address
+ - {{r.ip_info.scope}} {{r.ip_info.cast}} IPv{% if r.ip_info.is_v6_address %}6{% else %}4{% endif %}
{% if r.hostname %}
Hostname
- - {{r.hostname|trim_end_matches(pat=".")}}
+ - {{ helper::dig(extra=extra, name=r.hostname) }}
{% endif %}
{% if r.asn %}
ASN
@@ -52,6 +56,6 @@
{% endif %}
-
-
+ {% block extra_content %}{% endblock %}
+{% endblock %}
diff --git a/templates/message.html b/templates/message.html
new file mode 100644
index 0000000..e7ad376
--- /dev/null
+++ b/templates/message.html
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+
+{% block title %}{{data.title}}{% endblock %}
+{% block og_title %}{{ data.title }}{% endblock %}
+{% block h1 %}{{ data.title }}{% endblock %}
+
+{% block content %}
+ {{data.mesage}}
+{% endblock %}