diff --git a/eleventy.config.js b/eleventy.config.js new file mode 100644 index 0000000..6c0a4c0 --- /dev/null +++ b/eleventy.config.js @@ -0,0 +1,6 @@ +/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */ +export default async function(eleventyConfig) { + eleventyConfig.addPassthroughCopy( + {'./public/': '/'} + ) +} \ No newline at end of file diff --git a/package.json b/package.json index b2370fe..629914a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "1.0.0", "description": "My personal blog", "scripts": { - "start": "npx @11ty/eleventy --input ./src", + "start": "npx @11ty/eleventy --input ./src --serve", + "build": "npx @11ty/eleventy --input .src", "clean": "rm -rf {_site,./src/_site}" }, "repository": { @@ -13,5 +14,5 @@ "keywords": ["blog", "@11ty/eleventy", "eleventy"], "author": "Cyper", "license": "ISC", - "type": "commonjs" + "type": "module" } diff --git a/src/_data/metadata.js b/src/_data/metadata.js new file mode 100644 index 0000000..5eddb50 --- /dev/null +++ b/src/_data/metadata.js @@ -0,0 +1,20 @@ +const date = new Date(); +const formattedDate = date.toLocaleDateString('en-GB', { + day: '2-digit', + month: 'short', + year: 'numeric' +}); + +export default { + author: { + name: "Cyper", + url: "https://cyper.cc" + }, + + title: "Cy by Side!", + url: "https://cy.cyper.cc/", + language: "en", + description: "Cy by Side with Cyper: Tangents, Tech, and Thoughtful Takes.", + date: formattedDate, + year: date.getFullYear() +} \ No newline at end of file diff --git a/src/_data/wordCount.js b/src/_data/wordCount.js new file mode 100644 index 0000000..2c65878 --- /dev/null +++ b/src/_data/wordCount.js @@ -0,0 +1,11 @@ +export default function (data) { + if (typeof data.content === 'string') { + const words = data.content.trim().split(/\s+/).length; + const minutes = Math.ceil(words / 200); // avg reading speed + data.wordCount = words; + data.readingTime = `${minutes} min read`; + data.readingTimeMinutes = minutes; + } + + return data; +}