Add basic 11ty project

main
Arseniy Prosvirnin 1 year ago
parent fbbc3796fb
commit 4ff83076fc
No known key found for this signature in database
GPG Key ID: 662ADE783CBB4026

@ -0,0 +1,50 @@
const Image = require("@11ty/eleventy-img");
const path = require("path");
function relativeToInputPath(inputPath, relativeFilePath) {
let split = inputPath.split("/");
split.pop();
return path.resolve(split.join(path.sep), relativeFilePath);
}
function isFullUrl(url) {
try {
new URL(url);
return true;
} catch(e) {
return false;
}
}
// Only one module.exports per configuration file, please!
module.exports = function (eleventyConfig) {
eleventyConfig.addShortcode("image", async function (src, alt, sizes) {
let input;
if(isFullUrl(src)) {
input = src;
} else {
input = relativeToInputPath(this.page.inputPath, src);
}
console.log("SEARCH IMAGE IN", input);
let metadata = await Image(input, {
widths: [300, 600],
formats: ["avif", "jpeg"],
outputDir: path.join(eleventyConfig.dir.output, "img"),
});
let imageAttributes = {
alt,
sizes,
loading: "lazy",
decoding: "async",
};
// You bet we throw an error on a missing alt (alt="" works okay)
return Image.generateHTML(metadata, imageAttributes);
});
};

@ -0,0 +1,12 @@
<section itemscope itemtype="https://schema.org/ItemList">
<h2>albums and singles</h2>
{% for album in collections.albums | reverse %}
<ol>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/MusicAlbum">
<h3 itemprop="name">{{ album.data.title }}</h3>
<p itemprop="description">{{ album.data.description }}</p>
{% image album.data.cover, "photo of my tabby cat", "(min-width: 30em) 50vw, 100vw" %}
</li>
</ol>
{% endfor %}
</section>

@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Bjornmossa</title>
</head>
<body itemscope itemtype="https://schema.org/MusicGroup">
{{ content | safe }}
</body>
</html>

@ -0,0 +1,4 @@
---
layout: layouts/base.njk
---
{{ content | safe }}

@ -0,0 +1,7 @@
---
tags:
- albums
title: Cheburek
description: In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before the final copy is available.
cover: ./albums/cheburek/cover.jpg
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@ -0,0 +1,6 @@
---
tags:
- albums
title: Kek
cover: ./albums/cover.jpg
---

@ -0,0 +1,6 @@
---
tags:
- albums
title: Lol
cover: ./albums/cover.jpg
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,18 @@
---
layout: layouts/home.njk
eleventyNavigation:
key: Home
order: 1
---
<h1 itemprop="name">Bjornmossa</h1>
<p itemprop="description">
Bjornmossa is an electronic music project focused on algorithmic and computer music. Inspired by northern nature, musicians create stochastic sound structures using genetic algorithms and random processes and weave them into ambiance sound design.
</p>
<nav>
<ul>
<li><a href="">albums and singles</a></li>
<li><a href="">performances</a></li>
<li><a href="">software</a></li>
</ul>
</nav>
{% include "albumslist.njk" %}

3216
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,18 @@
{
"name": "bjornmossa_website",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "npx @11ty/eleventy --serve",
"build": "npx @11ty/eleventy",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-img": "^4.0.2"
}
}
Loading…
Cancel
Save