feat: Updated project config/setup
Added eleventy config to add public folder passthrough, updated pack.json to serve content instead of compile, added plugins/metadata to rendering engine
This commit is contained in:
6
eleventy.config.js
Normal file
6
eleventy.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
|
||||||
|
export default async function(eleventyConfig) {
|
||||||
|
eleventyConfig.addPassthroughCopy(
|
||||||
|
{'./public/': '/'}
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -3,7 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "My personal blog",
|
"description": "My personal blog",
|
||||||
"scripts": {
|
"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}"
|
"clean": "rm -rf {_site,./src/_site}"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -13,5 +14,5 @@
|
|||||||
"keywords": ["blog", "@11ty/eleventy", "eleventy"],
|
"keywords": ["blog", "@11ty/eleventy", "eleventy"],
|
||||||
"author": "Cyper",
|
"author": "Cyper",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "commonjs"
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|||||||
20
src/_data/metadata.js
Normal file
20
src/_data/metadata.js
Normal file
@ -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()
|
||||||
|
}
|
||||||
11
src/_data/wordCount.js
Normal file
11
src/_data/wordCount.js
Normal file
@ -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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user