From 9d84151ee5ffe7f008aff9e881ca00bd81dbbd1b Mon Sep 17 00:00:00 2001 From: Nathan Upchurch Date: Tue, 23 Jan 2024 11:38:50 -0600 Subject: [PATCH] Refactor and modularize --- _data/metadata.js | 17 +++++- _includes/footer.njk | 12 ++++ _includes/header.njk | 5 ++ _includes/layouts/403.njk | 1 - _includes/layouts/404.njk | 1 - _includes/layouts/base.njk | 91 ++--------------------------- _includes/layouts/baseBareBones.njk | 22 +------ _includes/layouts/links.njk | 1 + _includes/metadata.njk | 9 +++ _includes/nav.njk | 13 +++++ _includes/postslist.njk | 2 +- _includes/rssLogo.njk | 19 ++++++ _includes/structuredData.njk | 30 ++++++++++ 13 files changed, 112 insertions(+), 111 deletions(-) create mode 100644 _includes/footer.njk create mode 100644 _includes/header.njk create mode 100644 _includes/metadata.njk create mode 100644 _includes/nav.njk create mode 100644 _includes/rssLogo.njk create mode 100644 _includes/structuredData.njk diff --git a/_data/metadata.js b/_data/metadata.js index aeca8f6..6b24800 100644 --- a/_data/metadata.js +++ b/_data/metadata.js @@ -4,15 +4,16 @@ module.exports = { url: "https://nathanupchurch.com/", language: "en", description: "The personal website and blog of Nathan Upchurch.", - pgpkey: "", author: { name: "Nathan Upchurch", email: "blog@upchur.ch", url: "https://nathanupchurch.com/me", profilePic: "/img/CN20191025_301_Srt_SQUARE.jpg" }, + copyrightNotice: "© Nathan Upchurch 2022 - 2024", defaultPostImageURL: "/img/vasilina-sirotina-1NMPvajSt9Q-unsplash_copy.avif", defaultPostImageAlt: "The default post image: a close picture of the dark green leaves of a plant.", + postlistHeaderText: "Latest Posts", socialLinks: [ { title: "My Blog", @@ -69,5 +70,19 @@ module.exports = { linkDisplay: "Keyoxide Identity Profile", iconURL: "/img/keyoxide.svg" } + ], + webrings: [ + { + name: "Fediring", + ringURL: "https://fediring.net/", + previousURL: "https://fediring.net/previous?host=nathanupchurch.com", + nextURL: "https://fediring.net/next?host=nathanupchurch.com" + }, + { + name: "Geekring", + ringURL: "https://geekring.net/", + previousURL: "", + nextURL: "" + } ] } diff --git a/_includes/footer.njk b/_includes/footer.njk new file mode 100644 index 0000000..ec14a44 --- /dev/null +++ b/_includes/footer.njk @@ -0,0 +1,12 @@ + diff --git a/_includes/header.njk b/_includes/header.njk new file mode 100644 index 0000000..a4b88d1 --- /dev/null +++ b/_includes/header.njk @@ -0,0 +1,5 @@ +Skip to main content +
+ + {% if not hideNav %}{% include "nav.njk" %}{% endif %} +
diff --git a/_includes/layouts/403.njk b/_includes/layouts/403.njk index 4751e2d..6466cb7 100644 --- a/_includes/layouts/403.njk +++ b/_includes/layouts/403.njk @@ -1,6 +1,5 @@ --- layout: layouts/base.njk -showPostListHeader: yep ---

403 Forbidden

*Ahem* Go to the home page.

diff --git a/_includes/layouts/404.njk b/_includes/layouts/404.njk index d7a6205..f20459d 100644 --- a/_includes/layouts/404.njk +++ b/_includes/layouts/404.njk @@ -1,6 +1,5 @@ --- layout: layouts/base.njk -showPostListHeader: yep ---

404

Sorry, it looks like that link is broken. Go to the home page.

diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 136f7bb..ba0ac71 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -1,103 +1,20 @@ - - - {{ title or metadata.title }} - - - - - - - {% if metadata.pgpkey %}{% endif %} - - + {% include "metadata.njk" %} {#- Bundle CSS #} {%- css %}{% include "public/css/index.css" %}{% endcss %} {%- css %}{% include "public/css/webfonts/webfonts.css" %}{% endcss %} {%- css %}{% include "public/css/dropcap.css" %}{% endcss %} - {% if title %} - - - - - - - - - - - - - - - - {% endif %} - + {% include "structuredData.njk" %} {% include "umami.html" %} - Skip to main content - -
- - - -
- + {% include "header.njk" %}
{{ content | safe }}
- + {% include "footer.njk" %} diff --git a/_includes/layouts/baseBareBones.njk b/_includes/layouts/baseBareBones.njk index 14f9af4..cd31b50 100644 --- a/_includes/layouts/baseBareBones.njk +++ b/_includes/layouts/baseBareBones.njk @@ -1,35 +1,17 @@ - - - {{ title or metadata.title }} - - - - - + {% include "metadata.njk" %} {#- Bundle CSS #} {%- css %}{% include "public/css/index.css" %}{% endcss %} {%- css %}{% include "public/css/webfonts/webfonts.css" %}{% endcss %} - {%- css %}{% include "public/css/dropcap.css" %}{% endcss %} - {% include "umami.html" %} - Skip to main content - -
- -
- + {% include "header.njk" %}
{{ content | safe }}
- - - - diff --git a/_includes/layouts/links.njk b/_includes/layouts/links.njk index ca7de20..5cf0adc 100644 --- a/_includes/layouts/links.njk +++ b/_includes/layouts/links.njk @@ -1,5 +1,6 @@ --- layout: layouts/baseBareBones.njk +hideNav: please --- {%- css %}{% include "public/css/links.css" %}{% endcss %} diff --git a/_includes/metadata.njk b/_includes/metadata.njk new file mode 100644 index 0000000..d7c47b9 --- /dev/null +++ b/_includes/metadata.njk @@ -0,0 +1,9 @@ + + +{{ title or metadata.title }} + + + + + + diff --git a/_includes/nav.njk b/_includes/nav.njk new file mode 100644 index 0000000..6c32415 --- /dev/null +++ b/_includes/nav.njk @@ -0,0 +1,13 @@ + diff --git a/_includes/postslist.njk b/_includes/postslist.njk index 3de1e1f..a101256 100644 --- a/_includes/postslist.njk +++ b/_includes/postslist.njk @@ -1,5 +1,5 @@
-{% if showPostListHeader %}

Latest Posts

{% endif %} +{% if showPostListHeader %}

{{ metadata.postlistHeaderText }}

{% endif %}
{% for post in postslist | reverse %}
diff --git a/_includes/rssLogo.njk b/_includes/rssLogo.njk new file mode 100644 index 0000000..a5c141c --- /dev/null +++ b/_includes/rssLogo.njk @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/_includes/structuredData.njk b/_includes/structuredData.njk new file mode 100644 index 0000000..fa4ae77 --- /dev/null +++ b/_includes/structuredData.njk @@ -0,0 +1,30 @@ +{% if title %} + + + + + + + + + + + + + +{% endif %}