From 66efe2cdff942f814b31495320bd1b0e0e067cb6 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sun, 14 Apr 2024 18:08:50 +0800 Subject: [PATCH] Move table of contents into its own template --- src/_includes/main/article.njk | 49 +++++++++++----------------------- src/_includes/toc.njk | 27 +++++++++++++++++++ 2 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 src/_includes/toc.njk diff --git a/src/_includes/main/article.njk b/src/_includes/main/article.njk index f6052a02..ebe5ce5d 100644 --- a/src/_includes/main/article.njk +++ b/src/_includes/main/article.njk @@ -6,45 +6,26 @@ eleventyComputed: title: "{{ articleTitle }} | Articles" --- -{% if toc %} - - -{% endif %} - -
+

{{ articleTitle }}

-
+{% if toc %} + {% include "toc.njk" %} +{% endif %} + +
{{ content | safe }}
+ + \ No newline at end of file diff --git a/src/_includes/toc.njk b/src/_includes/toc.njk new file mode 100644 index 00000000..05df4c93 --- /dev/null +++ b/src/_includes/toc.njk @@ -0,0 +1,27 @@ + +