From 54832e8bfd06d32f4a5604b792918090a7bdd7e9 Mon Sep 17 00:00:00 2001 From: Leilukin 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 }}

+ + {% 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 }}

- - {% 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