Compare commits

...

5 Commits

Author SHA1 Message Date
Helen Chong e4d0ed94c1 Use export variables for site meta 2024-07-19 09:25:30 +08:00
Helen Chong 1c2522ba28 Add author name to site OpenGraph meta 2024-07-19 09:21:51 +08:00
Helen Chong 4f6959e4fa Put CSS and JS files to be bundled into its own folder 2024-07-19 08:35:56 +08:00
Helen Chong 5c727cb349 Use this keyword for site author URL 2024-07-19 02:21:20 +08:00
Helen Chong 1dc8fd8959 Convert CommonJS syntax to ESM syntax 2024-07-19 02:08:10 +08:00
10 changed files with 45 additions and 37 deletions

View File

@ -1,12 +1,14 @@
// Installed Plugins // Installed Plugins
const pluginRss = require("@11ty/eleventy-plugin-rss"); import pluginRss from "@11ty/eleventy-plugin-rss";
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
const metagen = require('eleventy-plugin-metagen'); import metagen from 'eleventy-plugin-metagen';
const emojiReadTime = require("@11tyrocks/eleventy-plugin-emoji-readtime"); import emojiReadTime from "@11tyrocks/eleventy-plugin-emoji-readtime";
const slugify = require("slugify"); import slugify from "slugify";
module.exports = function (eleventyConfig) { import markdownPlugin from "./eleventy.config.md.js";
export default function (eleventyConfig) {
// Copy files // Copy files
eleventyConfig.addPassthroughCopy("./src/assets/"); eleventyConfig.addPassthroughCopy("./src/assets/");
eleventyConfig.addWatchTarget("./src/assets/"); eleventyConfig.addWatchTarget("./src/assets/");
@ -15,7 +17,7 @@ module.exports = function (eleventyConfig) {
}); });
// Custom Plugins // Custom Plugins
eleventyConfig.addPlugin(require('./eleventy.config.md.js')); eleventyConfig.addPlugin(markdownPlugin);
// Installed Plugins // Installed Plugins
eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginRss);
@ -25,7 +27,7 @@ module.exports = function (eleventyConfig) {
// Eleventy bundle plugin // Eleventy bundle plugin
eleventyConfig.addBundle("css"); eleventyConfig.addBundle("css");
eleventyConfig.addBundle("js"); eleventyConfig.addBundle("js", { toFileDirectory: "assets/js" });
// Add content categories to a collection // Add content categories to a collection
eleventyConfig.addCollection("categories", function(collectionApi) { eleventyConfig.addCollection("categories", function(collectionApi) {

View File

@ -1,16 +1,22 @@
/* CONFIGURATION FOR MARKDOWN TEMPLATES */ /* CONFIGURATION FOR MARKDOWN TEMPLATES */
// Installed Plugins // Installed Plugins
const pluginTOC = require('@uncenter/eleventy-plugin-toc'); import pluginTOC from '@uncenter/eleventy-plugin-toc';
const embedEverything = require("eleventy-plugin-embed-everything"); import embedEverything from "eleventy-plugin-embed-everything";
// Configure slug filter // Configure slug filter
const slugify = require("slugify"); import slugify from "slugify";
// Configure markdown-it plugins
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
module.exports = function (eleventyConfig) { // markdown-it plugins
import markdownIt from "markdown-it";
import markdownItAnchor from "markdown-it-anchor";
import markdownItAttribution from "markdown-it-attribution";
import markdownItAttrs from "markdown-it-attrs";
import markdownItBracketedSpans from 'markdown-it-bracketed-spans';
import markdownItDefList from "markdown-it-deflist";
import markdownItFootnote from "markdown-it-footnote";
export default function (eleventyConfig) {
// Installed Plugins // Installed Plugins
eleventyConfig.addPlugin(pluginTOC, { eleventyConfig.addPlugin(pluginTOC, {
tags: ['h2', 'h3', 'h4', 'h5', 'h6'], tags: ['h2', 'h3', 'h4', 'h5', 'h6'],
@ -73,11 +79,11 @@ module.exports = function (eleventyConfig) {
linkify: true, linkify: true,
}) })
.use(markdownItAnchor, markdownItAnchorOptions) .use(markdownItAnchor, markdownItAnchorOptions)
.use(require("markdown-it-attribution")) .use(markdownItAttribution)
.use(require("markdown-it-attrs")) .use(markdownItAttrs)
.use(require("markdown-it-bracketed-spans")) .use(markdownItBracketedSpans)
.use(require("markdown-it-deflist")) .use(markdownItDefList)
.use(require('markdown-it-footnote')); .use(markdownItFootnote);
// Configure linkify // Configure linkify
markdownLibrary.linkify.set({ fuzzyLink: false }); markdownLibrary.linkify.set({ fuzzyLink: false });

View File

@ -4,6 +4,7 @@
"start": "bunx @11ty/eleventy --serve --quiet", "start": "bunx @11ty/eleventy --serve --quiet",
"build": "bunx @11ty/eleventy" "build": "bunx @11ty/eleventy"
}, },
"type": "module",
"devDependencies": { "devDependencies": {
"@types/bun": "^1.1.6" "@types/bun": "^1.1.6"
}, },

View File

@ -1,13 +1,11 @@
module.exports = { export const siteName = "Leilukin's Hub";
siteName: "Leilukin's Hub", export const siteDomain = "leilukin.com";
siteUrl: "https://leilukin.com" || "http://localhost:8080", export const siteUrl = "https://" + siteDomain || "http://localhost:8080";
siteDomain: "leilukin.com", export const siteAuthor = {
siteLocale: "en_MY", name: "Leilukin",
siteLanguage: "en", email: "contact@leilukin.com",
siteDescription: "Leilukin's personal website.", url: siteUrl + "/about"
siteAuthor: { };
name: "Leilukin", export const siteLocale = "en_MY";
email: "contact@leilukin.com", export const siteLanguage = "en";
url: this.siteUrl + "/about" export const siteDescription = siteAuthor.name + "'s personal website.";
}
}

View File

@ -2,6 +2,7 @@
desc=desc or metadata.desc, desc=desc or metadata.desc,
url=sitemeta.siteUrl + page.url, url=sitemeta.siteUrl + page.url,
locale=sitemeta.siteLocale, locale=sitemeta.siteLocale,
name=sitemeta.siteAuthor.name,
site_name=sitemeta.siteName, site_name=sitemeta.siteName,
img=image, img=image,
img_alt=alt, img_alt=alt,

View File

@ -5,10 +5,10 @@ eleventyNavigation:
eleventyComputed: eleventyComputed:
desc: Leave a message for {{ sitemeta.siteAuthor.name }}. desc: Leave a message for {{ sitemeta.siteAuthor.name }}.
--- ---
{%- css %}{% include "src/assets/css/comments.css" %}{%- endcss %} {%- css %}{% include "src/_bundle/css/comments.css" %}{%- endcss %}
{%- js %}{% include "src/assets/js/svgIconControl.js" %}{%- endjs %} {%- js %}{% include "src/_bundle/js/svgIconControl.js" %}{%- endjs %}
{%- js %}{% include "src/assets/js/googleSheetsReaderGizmo.js" %}{%- endjs %} {%- js %}{% include "src/_bundle/js/googleSheetsReaderGizmo.js" %}{%- endjs %}
{%- js %}{% include "src/assets/js/comments.js" %}{%- endjs %} {%- js %}{% include "src/_bundle/js/comments.js" %}{%- endjs %}
<p class="center-text">Guestbook Archive: <a href="https://web.archive.org/web/20240528231121/https%3A%2F%2Fleilukin.123guestbook.com%2F">123Guestbook</a></p> <p class="center-text">Guestbook Archive: <a href="https://web.archive.org/web/20240528231121/https%3A%2F%2Fleilukin.123guestbook.com%2F">123Guestbook</a></p>