From a37d64105ba6c78b7b9075dd3ad07ffde0cc2fa0 Mon Sep 17 00:00:00 2001 From: Cameron Otsuka Date: Mon, 5 Aug 2024 12:09:22 -0700 Subject: [PATCH] add opengraph meta --- _data/metadata.json | 4 ++-- _includes/articleslist.njk | 4 ++-- _includes/layouts/base.njk | 49 ++++++++++++++++++++++++++++---------- _includes/layouts/home.njk | 6 ++--- eleventy.config.js | 4 ++-- 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/_data/metadata.json b/_data/metadata.json index 16c427d..63ccf25 100644 --- a/_data/metadata.json +++ b/_data/metadata.json @@ -1,7 +1,7 @@ { "title": "Cameron Otsuka", - "url": "https://otsuka.haus/", - "base": "https://otsuka.haus/", + "url": "https://otsuka.haus", + "base": "https://otsuka.haus", "language": "en", "subtitle": "The collection of Cameron's thoughts.", "description": "The collection of Cameron's thoughts.", diff --git a/_includes/articleslist.njk b/_includes/articleslist.njk index 2741911..91bd38f 100644 --- a/_includes/articleslist.njk +++ b/_includes/articleslist.njk @@ -1,6 +1,6 @@
-{% for article in articleslist | reverse %} +{%- for article in articleslist | reverse %}
{{ article.data.title }}
{{ article.data.description }}
-{% endfor %} +{%- endfor %}
\ No newline at end of file diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index ee8cd8e..7fbcb26 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -1,18 +1,46 @@ - + - - + {%- if modified -%} + {% set updated = modified %} + {%- else -%} + {% set updated = date %} + {%- endif %} + + + + + + + + + + + + + + + {%- if tags %} + + + + + {%- for tag in tags | reject("equalto", "articles") %} + + {%- endfor %} + {%- else %} + + {%- endif %} {{ title }} | {{ metadata.title }} - - - - {% set css %} + + + + {%- set css %} {% include "css/reset.css" %} {% include "css/style.css" %} {% include "css/public-sans.css" %} {% include "css/prism-okaidia.css" %} - {% endset %} + {%- endset %} @@ -36,11 +64,6 @@

- {% if modified %} - {% set updated = modified %} - {% else %} - {% set updated = date %} - {% endif %} Last Modified:

All views my own. Not financial advice. Links, citations, and other references are not endorsements.

diff --git a/_includes/layouts/home.njk b/_includes/layouts/home.njk index d3f87de..f2350bc 100644 --- a/_includes/layouts/home.njk +++ b/_includes/layouts/home.njk @@ -9,14 +9,14 @@ layout: layouts/base.njk

Articles

{% set articleslist = collections.articles %} - {% include "articleslist.njk" %} + {%- include "articleslist.njk" %}

Contributions

\ No newline at end of file diff --git a/eleventy.config.js b/eleventy.config.js index 3ce4c94..85f1b67 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -29,9 +29,9 @@ module.exports = function (eleventyConfig) { // dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd'); }); - eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { + eleventyConfig.addFilter("isoDate", (dateObj) => { // Formatting tokens for Luxon: https://moment.github.io/luxon/#/formatting?id=table-of-tokens - return DateTime.fromJSDate(dateObj, { zone: zone || "utc" }).toFormat(format || "dd LLLL yyyy"); + return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toISO(); }); eleventyConfig.addPassthroughCopy({ "./static/": "/" }); eleventyConfig.addPlugin(feedPlugin, { -- 2.51.0