From 4cec339f0d19ae07e32c44655a1b67cb453113dd Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Fri, 28 Mar 2025 18:18:36 +0800 Subject: [PATCH] Use Nunjucks macro for article lists --- src/_includes/global/macros.njk | 13 ++++++++++ src/shrines/cassettebeasts/articles.md | 13 +++------- src/shrines/starwarskotor/articles.md | 35 ++++---------------------- src/shrines/starwarskotor/guides.md | 13 +++------- src/slashes/navbarlinks/articles.md | 24 +++--------------- 5 files changed, 28 insertions(+), 70 deletions(-) diff --git a/src/_includes/global/macros.njk b/src/_includes/global/macros.njk index 25d27250..d31dbc93 100644 --- a/src/_includes/global/macros.njk +++ b/src/_includes/global/macros.njk @@ -1,3 +1,16 @@ +{%- macro articleList(tag) -%} + +{%- endmacro -%} + {%- macro modEntry(params) -%} {% headingAnchor 3 %}{{ params.title }}{% endheadingAnchor %}
diff --git a/src/shrines/cassettebeasts/articles.md b/src/shrines/cassettebeasts/articles.md index 7fac5b20..4eff0267 100644 --- a/src/shrines/cassettebeasts/articles.md +++ b/src/shrines/cassettebeasts/articles.md @@ -12,17 +12,10 @@ eleventyNavigation: order: 1 --- +{% from "global/macros.njk" import articleList with context %} + ## My {% cite "Cassette Beasts" %} Articles - +{{ articleList("cassette beasts articles") }} ## {% cite "Cassette Beasts" %} Articles I Recommend diff --git a/src/shrines/starwarskotor/articles.md b/src/shrines/starwarskotor/articles.md index 6e102aac..f016164a 100644 --- a/src/shrines/starwarskotor/articles.md +++ b/src/shrines/starwarskotor/articles.md @@ -12,41 +12,16 @@ eleventyNavigation: order: 1 --- +{% from "global/macros.njk" import articleList with context %} + ## My Articles for Both Games - +{{ articleList("kotor both articles") }} ## My KotOR 1 Articles - +{{ articleList("kotor 1 articles") }} ## My KotOR 2 Articles - +{{ articleList("kotor 2 articles") }} ## KotOR Articles I Recommend diff --git a/src/shrines/starwarskotor/guides.md b/src/shrines/starwarskotor/guides.md index 36c9d247..3b75346a 100644 --- a/src/shrines/starwarskotor/guides.md +++ b/src/shrines/starwarskotor/guides.md @@ -12,17 +12,10 @@ eleventyNavigation: order: 2 --- +{% from "global/macros.njk" import articleList with context %} + ## My KotOR Guides - +{{ articleList("kotor guides") }} ## KotOR 1 Guides by Others * [{% cite "Star Wars: Knights of the Old Republic" %} section](https://strategywiki.org/wiki/Star_Wars:_Knights_of_the_Old_Republic) on StrategyWiki diff --git a/src/slashes/navbarlinks/articles.md b/src/slashes/navbarlinks/articles.md index 0973d6de..069bc233 100644 --- a/src/slashes/navbarlinks/articles.md +++ b/src/slashes/navbarlinks/articles.md @@ -6,18 +6,11 @@ eleventyNavigation: order: 5 --- +{% from "global/macros.njk" import articleList with context %} + ## My Articles Articles I have written. - +{{ articleList("my articles") }} ## My Articles for Video Games with Their Own Pages * My {% cite "Cassette Beasts" %} shrine [Articles](/shrines/cassettebeasts/articles/) page @@ -25,13 +18,4 @@ Articles I have written. ## Featured Articles Articles featuring other people's interview with me. - +{{ articleList("featured articles") }} \ No newline at end of file