From 516dc1ecdb443d93f70b4d590810b133ebac742e Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Fri, 19 Apr 2024 07:50:20 +0800 Subject: [PATCH] Set up global content layout --- src/_includes/global/content.njk | 65 +++++++++++++++++++++++++++++++ src/_includes/main/content.njk | 66 +------------------------------- 2 files changed, 66 insertions(+), 65 deletions(-) create mode 100644 src/_includes/global/content.njk diff --git a/src/_includes/global/content.njk b/src/_includes/global/content.njk new file mode 100644 index 00000000..63f45e2e --- /dev/null +++ b/src/_includes/global/content.njk @@ -0,0 +1,65 @@ +
+ {% if isArticle %} + + +

{{ articleTitle }}

+
+

Posted on {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }} + {% if updated %} + • Last updated on {{ updated | niceDate }}

+ {% endif %} + {% if categories %} +

Categories: + {% for cat in categories %} + {{ cat }}{% if not loop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} +

{{ content | emojiReadTime }}

+
+ {% else %} +

{{ pageTitle or title }}

+ {% if desc %} +

{{ desc }}

+ {% endif %} + {% endif %} +
+ +
+ {% if toc %} + {% include "global/toc.njk" %} + {% endif %} + + {% if isArticle %} +
+ {{ content | safe }} +
+ {% else %} +
+ {{ content | safe }} +
+ {% endif %} + + {% if tags and tags.includes("contents") or title === "Articles" or tags and tags.includes("blog pages") %} + {% include "main/content-nav.njk" %} + {% endif %} +
+ + \ No newline at end of file diff --git a/src/_includes/main/content.njk b/src/_includes/main/content.njk index 91c9d0a2..79e86d45 100644 --- a/src/_includes/main/content.njk +++ b/src/_includes/main/content.njk @@ -2,68 +2,4 @@ layout: main/base --- -
- {% if isArticle %} - - -

{{ articleTitle }}

-
-

Posted on {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }} - {% if updated %} - • Last updated on {{ updated | niceDate }}

- {% endif %} - {% if categories %} -

Categories: - {% for cat in categories %} - {{ cat }}{% if not loop.last %}, {% endif %} - {% endfor %} -

- {% endif %} -

{{ content | emojiReadTime }}

-
- {% else %} -

{{ pageTitle or title }}

- {% if desc %} -

{{ desc }}

- {% endif %} - {% endif %} -
- -
- {% if toc %} - {% include "global/toc.njk" %} - {% endif %} - - {% if isArticle %} -
- {{ content | safe }} -
- {% else %} -
- {{ content | safe }} -
- {% endif %} - - {% if tags and tags.includes("articles") or title === "Articles" or tags and tags.includes("blog pages") %} - {% include "main/content-nav.njk" %} - {% endif %} -
- - \ No newline at end of file +{% extends "global/content.njk" %} \ No newline at end of file