diff --git a/bun.lockb b/bun.lockb index 1311e76f..65661372 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eleventy.config.js b/eleventy.config.js index b7a14bda..5208fff9 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -6,6 +6,7 @@ import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import pluginEmbedEverything from "eleventy-plugin-embed-everything"; import pluginWordcount from "eleventy-plugin-wordcount-extended"; import pluginTOC from "@uncenter/eleventy-plugin-toc"; +import { VentoPlugin } from 'eleventy-plugin-vento'; // Custom Configurations import markdownItConfig from "./src/_config/markdown-it.js"; @@ -48,9 +49,15 @@ export default function(eleventyConfig) { eleventyConfig.addBundle("css"); eleventyConfig.addBundle("js", { toFileDirectory: "assets/js" }); + // ----- Vento plugin for Eleventy + // Must be loaded after plugins that modify filters + eleventyConfig.addPlugin(VentoPlugin, { + autotrim: true, + }); + return { - markdownTemplateEngine: "njk", - htmlTemplateEngine: "njk", + markdownTemplateEngine: "vto", + htmlTemplateEngine: "vto", dir: { input: "src" } diff --git a/package.json b/package.json index 520bed48..99ab91f3 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@types/bun": "^1.2.11" }, "dependencies": { - "@11ty/eleventy": "^3.0.0", + "@11ty/eleventy": "^3.1.0-beta.1", "@11ty/eleventy-fetch": "^5.0.2", "@11ty/eleventy-navigation": "^1.0.4", "@11ty/eleventy-plugin-rss": "^2.0.3", @@ -23,6 +23,7 @@ "@uncenter/eleventy-plugin-toc": "^1.0.3", "@zachleat/details-utils": "^2.0.2", "eleventy-plugin-embed-everything": "^1.21.0", + "eleventy-plugin-vento": "^4.2.1", "eleventy-plugin-wordcount-extended": "^0.2.1", "install": "^0.13.0", "markdown-it-anchor": "^9.2.0", diff --git a/src/.htaccess.njk b/src/.htaccess.vto similarity index 100% rename from src/.htaccess.njk rename to src/.htaccess.vto diff --git a/src/404.html b/src/404.vto similarity index 83% rename from src/404.html rename to src/404.vto index 1e9eda87..824e203f 100644 --- a/src/404.html +++ b/src/404.vto @@ -1,7 +1,9 @@ --- -layout: global/root +layout: layouts/root title: "404: Page Not Found" h1: "404: Page Not Found" +desc: Page not found. +permalink: 404.html eleventyExcludeFromCollections: true --- diff --git a/src/_config/filters.js b/src/_config/filters.js index d39765bf..0fdebf16 100644 --- a/src/_config/filters.js +++ b/src/_config/filters.js @@ -25,8 +25,11 @@ export default function(eleventyConfig) { return array.slice(0, maximum); }); + // Filter: Collection item count + eleventyConfig.addFilter("itemCount", (array) => array.length ); + // Filter: Thousands separator eleventyConfig.addFilter("thousands", function(num) { return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }); -} \ No newline at end of file +} diff --git a/src/_includes/asummersend/base.html b/src/_includes/asummersend/base.html deleted file mode 100644 index 62384048..00000000 --- a/src/_includes/asummersend/base.html +++ /dev/null @@ -1,19 +0,0 @@ -{%- css %}{% include "src/assets/css/asummersend.css" %}{%- endcss %} - -{% extends "global/baselayout.html" %} - -{% block metaTitle %} - -{% endblock %} - -{% block pageTitle %} -{{ title + " | " if title }}A Summer’s End — Hong Kong 1986 Shrine | {{ sitemeta.siteName | safe }} -{% endblock %} - -{% block favicon %} - -{% endblock %} - -{% block hero %}{% include "asummersend/hero.html" %}{% endblock %} -{% block navbar %}{% include "asummersend/navbar.html" %}{% endblock %} -{% block footer %}{% include "asummersend/footer.html" %}{% endblock %} diff --git a/src/_includes/asummersend/content.html b/src/_includes/asummersend/content.html deleted file mode 100644 index c8908859..00000000 --- a/src/_includes/asummersend/content.html +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: asummersend/base ---- - -{% extends "global/content.html" %} - -{% block shrineInfo %}{% include "asummersend/shrineinfo.html" %}{% endblock %} diff --git a/src/_includes/asummersend/footer.html b/src/_includes/asummersend/footer.html deleted file mode 100644 index 86a60fe8..00000000 --- a/src/_includes/asummersend/footer.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "global/footer.html" %} - -{% block footerContent %} -

Made with ♥ by {{ sitemeta.siteAuthor.name }} • Shrine Launched: 16 February 2023

-{% endblock %} - diff --git a/src/_includes/asummersend/hero.html b/src/_includes/asummersend/hero.html deleted file mode 100644 index ccfb3355..00000000 --- a/src/_includes/asummersend/hero.html +++ /dev/null @@ -1,46 +0,0 @@ -{% extends "global/hero.html" %} - -{% block heroImg %} - - - Banner of A Summer’s End — Hong Kong 1986 Shrine - -{% endblock %} - -{% block eventScript %} -const todayEvent = getTodayEvent(); - -if (todayEvent) { - heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = todayEvent; -} - -function getTodayEvent() { - const date = new Date(); - const month = date.getMonth() + 1; - const day = date.getDate(); - const year = date.getFullYear(); - - const aseReleaseDate = new Date("2020-04-23").getFullYear(); - const aseAnniversary = year - aseReleaseDate; - - if (month === 2 && day === 16) - return ` - Today is Michelle Cheung's birthday. Happy Birthday Michelle! - `; - else if (month === 4 && day === 23) - return ` - Today is the ${aseAnniversary}-year anniversary of the release of {% cite "A Summer’s End — Hong Kong 1986" %}! - `; - else if (month === 8 && day === 9) - return ` - Today is Cecelia Cortes' birthday. Happy Birthday Cecelia! - `; - else if (month === 12 && day === 28) - return ` - Today is Sam Wong's birthday. Happy Birthday Sam! - `; - else - return null; -} -{% endblock %} diff --git a/src/_includes/asummersend/navbar.html b/src/_includes/asummersend/navbar.html deleted file mode 100644 index f7926d45..00000000 --- a/src/_includes/asummersend/navbar.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "global/navbar.html" %} -{% set shrineHomeUrl = "/shrines/asummersend/" %} - -{% block navbarLinks %} -{% set navPages = collections.all | eleventyNavigation("A Summer’s End Shrine") %} -{%- for entry in navPages %} -
  • - {{ entry.title }} -
  • -{%- endfor %} -{% endblock %} diff --git a/src/_includes/asummersend/shrineinfo.html b/src/_includes/asummersend/shrineinfo.html deleted file mode 100644 index c2209e89..00000000 --- a/src/_includes/asummersend/shrineinfo.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "global/shrineinfo.html" %} - -{% block shrineAbout %} -

    Welcome to {{ sitemeta.siteAuthor.name }}'s shrine for {% cite "A Summer’s End — Hong Kong 1986" %}, an indie visual novel developed by Oracle and Bone. Set in 1980s Hong Kong, it tells of a love story between two women.

    -{% endblock %} - -{% block shrineLinks %} -
  • Official Website -
  • -
  • Steam
  • -
  • itch.io
  • -{% endblock %} diff --git a/src/_includes/cassettebeasts/base.html b/src/_includes/cassettebeasts/base.html deleted file mode 100644 index 61b2706c..00000000 --- a/src/_includes/cassettebeasts/base.html +++ /dev/null @@ -1,19 +0,0 @@ -{%- css %}{% include "src/assets/css/cassettebeasts.css" %}{%- endcss %} - -{% extends "global/baselayout.html" %} - -{% block metaTitle %} - -{% endblock %} - -{% block pageTitle %} -{{ title + " | " if title }}Cassette Beasts Shrine | {{ sitemeta.siteName | safe }} -{% endblock %} - -{% block favicon %} - -{% endblock %} - -{% block hero %}{% include "cassettebeasts/hero.html" %}{% endblock %} -{% block navbar %}{% include "cassettebeasts/navbar.html" %}{% endblock %} -{% block footer %}{% include "cassettebeasts/footer.html" %}{% endblock %} diff --git a/src/_includes/cassettebeasts/content.html b/src/_includes/cassettebeasts/content.html deleted file mode 100644 index d71db6d7..00000000 --- a/src/_includes/cassettebeasts/content.html +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: cassettebeasts/base ---- - -{% extends "global/content.html" %} - -{% block shrineInfo %}{% include "cassettebeasts/shrineinfo.html" %}{% endblock %} diff --git a/src/_includes/cassettebeasts/footer.html b/src/_includes/cassettebeasts/footer.html deleted file mode 100644 index f5cf6264..00000000 --- a/src/_includes/cassettebeasts/footer.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "global/footer.html" %} - -{% block footerContent %} -

    Made with ♥ by {{ sitemeta.siteAuthor.name }} • Shrine Launched: 3 August 2023

    -{% endblock %} - diff --git a/src/_includes/cassettebeasts/hero.html b/src/_includes/cassettebeasts/hero.html deleted file mode 100644 index 3350061e..00000000 --- a/src/_includes/cassettebeasts/hero.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends "global/hero.html" %} - -{% block heroImg %} - - - Banner of Cassette Beasts Shrine - -{% endblock %} - -{% block eventScript %} -const todayEvent = getTodayEvent(); - -if (todayEvent) { - heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = todayEvent; -} - -function getTodayEvent() { - const date = new Date(); - const month = date.getMonth() + 1; - const day = date.getDate(); - const year = date.getFullYear(); - - const cbReleaseDate = new Date("2023-04-26").getFullYear(); - const pierReleaseDate = new Date("2023-10-04").getFullYear(); - const cbAnniversary = year - cbReleaseDate; - const pierAnniversary = year - pierReleaseDate; - - if (month === 4 && day === 26) - return ` - Today is the ${cbAnniversary}-year anniversary of the release of {% cite "Cassette Beasts" %}! - `; - else if (month === 10 && day === 4) - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of {% cite "Cassette Beasts" %}! - `; - else - return null; -} -{% endblock %} diff --git a/src/_includes/cassettebeasts/navbar.html b/src/_includes/cassettebeasts/navbar.html deleted file mode 100644 index 568f05d0..00000000 --- a/src/_includes/cassettebeasts/navbar.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "global/navbar.html" %} -{% set shrineHomeUrl = "/shrines/cassettebeasts/" %} - -{% block navbarLinks %} -{% set navPages = collections.all | eleventyNavigation("Cassette Beasts Shrine") %} -{%- for entry in navPages %} -
  • - {{ entry.title }} -
  • -{%- endfor %} -{% endblock %} diff --git a/src/_includes/cassettebeasts/shrineinfo.html b/src/_includes/cassettebeasts/shrineinfo.html deleted file mode 100644 index 8b22865b..00000000 --- a/src/_includes/cassettebeasts/shrineinfo.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "global/shrineinfo.html" %} - -{% block shrineAbout %} -

    Welcome to {{ sitemeta.siteAuthor.name }}'s shrine for {% cite "Cassette Beasts" %}, an indie monster collecting turn-based open-world role-playing video game developed by Bytten Studio and published by Raw Fury.

    -{% endblock %} - -{% block shrineLinks %} -
  • Official Website -
  • -
  • Official Wiki
  • -
  • Steam
  • -
  • Bytten Studio
  • -
  • Cassette Beasts fanlisting
  • -{% endblock %} diff --git a/src/_includes/asummersend/myplaylist.html b/src/_includes/components/aseplaylist.vto similarity index 87% rename from src/_includes/asummersend/myplaylist.html rename to src/_includes/components/aseplaylist.vto index a7e1f06c..efa9bd90 100644 --- a/src/_includes/asummersend/myplaylist.html +++ b/src/_includes/components/aseplaylist.vto @@ -1,13 +1,12 @@ -{% macro myASEPlaylist(intro) %} -{% imgFigure "/assets/projects/playlists/My-Dear-Summer-Lover-cover.avif", "Cover image of A Summer’s End fanmix 'My Dear Summer Lover: A Sam x Michelle Fanmix'" %} +{{ imgFigure "/assets/projects/playlists/My-Dear-Summer-Lover-cover.avif", "Cover image of A Summer’s End fanmix 'My Dear Summer Lover: A Sam x Michelle Fanmix'" }} [Image description: Sam and Michelle from A Summer’s End almost kisses, with a play symbol and text on the top left corner, and the text "My Dear Summer Lover: A Sam x Michelle Fanmix" in a digital style font in front.] -{% endimgFigure %} +{{ /imgFigure }} -{{ intro }} [{% cite "A Summer’s End — Hong Kong 1986" %}](https://www.asummersend.com/home), dedicated to Sam and Michelle’s love story. +{{ intro }} [{{ cite "A Summer’s End — Hong Kong 1986" }}](https://www.asummersend.com/home), dedicated to Sam and Michelle’s love story. This mix contains mostly Cantonese and English songs, with one Mandarin song. Majority of these songs were performed by Hong Kong artists and released in the 80s, because A Summer’s End took place in Hong Kong and in the 80s. -I have carefully selected and arranged these tracks, so the lyrics would reflect Sam and Michelle’s relationship development throughout {% cite "A Summer’s End" %}. Therefore, the content of this mix could be considered spoilers if you have not played the visual novel. +I have carefully selected and arranged these tracks, so the lyrics would reflect Sam and Michelle’s relationship development throughout {{ cite "A Summer’s End" }}. Therefore, the content of this mix could be considered spoilers if you have not played the visual novel. Since Oracle and Bone has cited Anita Mui as a major inspiration for them and this visual novel, I have also included multiple songs performed by Anita Mui in this mix. Because A Summer’s End is a lesbian story, when I was choosing which songs to include in this mix, I also prioritize songs that were performed by women artists. @@ -28,4 +27,3 @@ Tracklist: [Listen on Spotify](https://open.spotify.com/playlist/3SIV7VjSKhspYwugVIQjug){.link-btn} -{% endmacro %} \ No newline at end of file diff --git a/src/_includes/global/macros.njk b/src/_includes/components/functions.vto similarity index 51% rename from src/_includes/global/macros.njk rename to src/_includes/components/functions.vto index c8c26fd6..bd3355b8 100644 --- a/src/_includes/global/macros.njk +++ b/src/_includes/components/functions.vto @@ -1,26 +1,27 @@ -{%- macro articleList(tag) -%} +{{ export function articleList(tag) }} -{%- endmacro -%} +{{ /export }} -{%- macro modEntry(params) -%} -{% headingAnchor 3 %}{{ params.title }}{% endheadingAnchor %} +{{ export function modEntry(params) }} +{{# {{ headingAnchor 3 }}{{ params.title }}{{ /headingAnchor }} #}} +### {{ params.title }}
    Banner of {{ params.title }} mod -

    {{ params.desc | safe }}

    +

    {{ params.desc }}

    Download the mod:

    - {%- for download in params.downloads -%} + {{ for download of params.downloads }} {{ download.site }} - {%- endfor -%} + {{ /for }}
    -{%- endmacro -%} +{{ /export }} diff --git a/src/_includes/main/my-button.html b/src/_includes/components/my-button.vto similarity index 96% rename from src/_includes/main/my-button.html rename to src/_includes/components/my-button.vto index c6a27631..80cc5359 100644 --- a/src/_includes/main/my-button.html +++ b/src/_includes/components/my-button.vto @@ -5,9 +5,9 @@ Leilukin's Hub website button with 200×40 pixel size -{%- css %} +{{- css }} .my-btn { align-items: center; margin-top: 1em; } -{% endcss %} \ No newline at end of file +{{ /css }} diff --git a/src/_includes/global/pagination-oldnew.html b/src/_includes/components/pagination-oldnew.vto similarity index 77% rename from src/_includes/global/pagination-oldnew.html rename to src/_includes/components/pagination-oldnew.vto index 14a6cfdd..2dde9dd1 100644 --- a/src/_includes/global/pagination-oldnew.html +++ b/src/_includes/components/pagination-oldnew.vto @@ -1,63 +1,63 @@ -{% set firstLabel %} +{{ set firstLabel }} -Newest{% endset %} +Newest{{ /set }} -{% set prevLabel %} +{{ set prevLabel }} -Newer{% endset %} +Newer{{ /set }} -{% set nextLabel %}Older +{{ set nextLabel }}Older -{% endset %} +{{ /set }} -{% set lastLabel %}Oldest +{{ set lastLabel }}Oldest -{% endset %} +{{ /set }} -{%- css %} +{{- css }} .pagination__wrapper { display: grid; place-content: center; @@ -95,4 +95,4 @@ Newer{% endset %} } .pagination li a:focus { outline: none; } -{% endcss %} +{{ /css }} diff --git a/src/_includes/main/statuscafe.html b/src/_includes/components/statuscafe.vto similarity index 93% rename from src/_includes/main/statuscafe.html rename to src/_includes/components/statuscafe.vto index 94f15aef..ee0038cd 100644 --- a/src/_includes/main/statuscafe.html +++ b/src/_includes/components/statuscafe.vto @@ -10,9 +10,9 @@

    View my statuses on status.cafe

    -{%- css %}#statuscafe-content { margin-bottom: 0.5em; }{% endcss %} +{{- css }}#statuscafe-content { margin-bottom: 0.5em; }{{ /css }} -{%- js %} +{{- js }} const statusCafeContent = document.getElementById("statuscafe-content"); statusCafeContent.innerHTML = `

    Fetching data from status.cafe...

    @@ -36,4 +36,4 @@ const fetchStatusCafe = async () => { } }; fetchStatusCafe(); -{% endjs %} +{{ /js }} diff --git a/src/_includes/main/support-me.html b/src/_includes/components/support-me.vto similarity index 94% rename from src/_includes/main/support-me.html rename to src/_includes/components/support-me.vto index 231409fd..7416773d 100644 --- a/src/_includes/main/support-me.html +++ b/src/_includes/components/support-me.vto @@ -4,7 +4,7 @@ Buy Me a Coffee at ko-fi.com -{%- css %} +{{- css }} .support-me { display: flex; flex-wrap: wrap; @@ -12,4 +12,4 @@ align-items: center; margin-top: 0.7em; } -{% endcss %} +{{ /css }} diff --git a/src/_includes/main/webcliques.html b/src/_includes/components/webcliques.vto similarity index 95% rename from src/_includes/main/webcliques.html rename to src/_includes/components/webcliques.vto index a2953a70..26643207 100644 --- a/src/_includes/main/webcliques.html +++ b/src/_includes/components/webcliques.vto @@ -1,8 +1,8 @@ -{%- css %}.color-bg { padding: 0.125em 0.3em; }{% endcss %} +{{- css }}.color-bg { padding: 0.125em 0.3em; }{{ /css }} -{%- macro webCliqueImg(file, width, height, alt="") -%} +{{ function webCliqueImg(file, width, height, alt="") -}} {{ alt }} -{%- endmacro -%} +{{ /function }}