diff --git a/source/article.d b/source/article.d
index a83c134..bc672a0 100644
--- a/source/article.d
+++ b/source/article.d
@@ -62,4 +62,5 @@ class Article : Page {
@property string author() { return m_author; }
@property DateTime firstPublished() { return m_firstPublished; }
@property DateTime updated() { return m_updated; }
+ @property bool isModified() { return m_firstPublished != m_updated; }
}
diff --git a/source/constants.d b/source/constants.d
index 99b3740..44baedd 100644
--- a/source/constants.d
+++ b/source/constants.d
@@ -3,5 +3,6 @@
*/
class Constants {
public static immutable string SITE_NAME = "Chris Netsoj.nl";
+ public static immutable string SITE_URL = "https://chris.netsoj.nl";
public static immutable string COPYRIGHT = "© Chris Josten, 2020";
}
diff --git a/views/pages/article.dt b/views/pages/article.dt
index 75f061d..58dbeb7 100644
--- a/views/pages/article.dt
+++ b/views/pages/article.dt
@@ -1,11 +1,16 @@
extends /parts/page
-block header
- title #{content.title} - Chris Netsoj.nl
- meta(name="og:title", content="#{content.title}")
- meta(name="og:type", content="article")
- meta(name="og:article", content="article")
-block sidebar
+block meta_data
+ - page_type = "article";
+ - page_title = content.title;
+ - page_url = "/post/" ~ content.slug;
+ - page_description = content.excerpt;
+
+block extra_meta_data
+ meta(name="og:article:author:username", content=content.author)
+ meta(name="og:article:published_time", content=content.firstPublished.toISOExtString)
+ - if (content.isModified)
+ meta(name="og:article:modified_time", content=content.updated.toISOExtString)
block content
article(itemscope, itemtype="https://schema.org/BlogPosting")
@@ -15,6 +20,6 @@ block content
p.subtitle
| By #{content.author}
| on #{content.firstPublished.toHumanString}
- - if (content.firstPublished != content.updated)
+ - if (content.isModified)
|, updated on #{content.updated.toHumanString}
section(itemprop="articleBody") !{content.content}
diff --git a/views/pages/page.dt b/views/pages/page.dt
index a1afa5e..6b01b2f 100644
--- a/views/pages/page.dt
+++ b/views/pages/page.dt
@@ -1,7 +1,11 @@
extends /parts/page.dt
-block header
- title #{content.title} - Chris Netsoj.nl
+block meta_data
+ - page_title = content.title;
+ - if (content.slug == "index")
+ - page_url = "/";
+ - else
+ - page_url = "/" ~ content.slug;
block sidebar
diff --git a/views/pages/project.dt b/views/pages/project.dt
index 65b8822..ada9ac1 100644
--- a/views/pages/project.dt
+++ b/views/pages/project.dt
@@ -1,6 +1,9 @@
extends /parts/page
-block header
- title #{content.title} - Netsoj.nl
+block meta_data
+ - page_title = content.title;
+ - page_url = "/project/" ~ content.slug;
+ - page_image = content.icon;
+ - page_description = content.description;
block sidebar
diff --git a/views/parts/page.dt b/views/parts/page.dt
index 3caa13f..df0ced5 100644
--- a/views/parts/page.dt
+++ b/views/parts/page.dt
@@ -2,14 +2,39 @@ doctype html
html(prefix="og: http://ogp.me/ns#")
- import constants;
head
+ //- Kick off loading the css as fast as possible
meta(name="viewport", content="width=device-width; initial-scale=1")
link(rel="stylesheet", href="/static/style/base.css")
+
+ - string page_image = "/static/img/logo.png";
+ - string page_title;
+ - string page_type;
+ - string page_url;
+ - string page_description;
+ block meta_data
+
+ - if (page_title !is null)
+ title #{page_title} - Chris Netsoj.nl
+ meta(name="og:title", content=page_title)
+ - else
+ title Chris Netsoj.nl
+
+ meta(name="og:site_name", content=Constants.SITE_NAME)
+ - if (page_image !is null)
+ meta(name="og:image", content=Constants.SITE_URL ~ page_image)
+ - if (page_type !is null)
+ meta(name="og:type", content=page_type)
+ - if (page_url !is null)
+ meta(name="og:url", content=Constants.SITE_URL ~ page_url)
+ - if (page_description !is null)
+ meta(name="og:description", content=page_description)
+ block extra_meta_data
+
link(rel="stylesheet", href="/static/style/highlight.css", defer)
link(rel="alternate stylesheet", href="/static/style/old.css", title="1999")
link(rel="shortcut icon", href="/static/img/logo.png")
link(rel="apple-touch-icon", href="/static/img/logo.png")
meta(name="theme-color", content="#7f0602")
- meta(name="og:site_name", content="#{Constants.SITE_NAME}")
block header
body