From 7fa8f0b308d5c77cac73050a2e213c11380ab398 Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sun, 8 Aug 2021 18:32:09 +0200 Subject: [PATCH] Added support for dates of articles. :) --- assets/css/article.css | 5 +++++ content/pages/docs/intro.md | 1 + content/templates/external_md.njk | 1 + libs/generateContext.js | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/assets/css/article.css b/assets/css/article.css index bf99285..cbec30d 100644 --- a/assets/css/article.css +++ b/assets/css/article.css @@ -10,6 +10,11 @@ article > header { margin-bottom: 2rem; } +article > header > i { + color: var(--accent); + display: block; +} + .toc-container { grid-area: toc; display: grid; diff --git a/content/pages/docs/intro.md b/content/pages/docs/intro.md index a83c3db..37e1f59 100644 --- a/content/pages/docs/intro.md +++ b/content/pages/docs/intro.md @@ -1,6 +1,7 @@ %%- title: qwik cms header: qwik cms intro +date: 8th August 2021 -%% # Introduction diff --git a/content/templates/external_md.njk b/content/templates/external_md.njk index 9f9fce3..6201cb4 100644 --- a/content/templates/external_md.njk +++ b/content/templates/external_md.njk @@ -10,6 +10,7 @@
{{ externalMeta.header }} + {{ externalMeta.date }}
diff --git a/libs/generateContext.js b/libs/generateContext.js index 5f35ef8..a8b8d18 100644 --- a/libs/generateContext.js +++ b/libs/generateContext.js @@ -1,6 +1,10 @@ +import fs from 'fs' import { JSDOM } from 'jsdom' import { parseExternalContext } from './externalContext.js' +const ConfigFile = fs.readFileSync('./config.json') +const Config = JSON.parse(ConfigFile) + function generateToc(dom) { // Get all ToC anchors from the DOM const tocAnchors = dom.window.document.querySelectorAll(".toc-anchor")