Skip to content

Commit

Permalink
Merge pull request #231 from ninjamuffin99/11ty-phase2
Browse files Browse the repository at this point in the history
11ty phase2: showcases page, and remove docker stuff
  • Loading branch information
ninjamuffin99 authored Feb 21, 2024
2 parents e301c69 + 771203d commit 81ab36e
Show file tree
Hide file tree
Showing 68 changed files with 451 additions and 165 deletions.
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

34 changes: 31 additions & 3 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
const { EleventyRenderPlugin } = require("@11ty/eleventy");

const Image = require("@11ty/eleventy-img");
const Sharp = require('sharp');

module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyRenderPlugin);

// used to set the current active dropdown list item to active, depending on current page
eleventyConfig.addShortcode("dropdownActive", function(dropdownItem) {

let isActive = this.page.url.includes(`/${dropdownItem}/`);
return isActive ? "active" : "";
});

eleventyConfig.addShortcode("image", async function(src, alt, width, height) {
let resizedImage = await resizeImage(src, width, height, "cover");

let metadata = await Image(resizedImage, {
formats: ["webp", "png"],
outputDir: "out/img"
});

let imageAttributes = {
alt,
width: width,
height: height,
loading: "lazy",
decoding: "async",
};

// You bet we throw an error on a missing alt (alt="" works okay)
return Image.generateHTML(metadata, imageAttributes);
});

eleventyConfig.addPassthroughCopy({ "src/files/images": "images" });

// Return your Object options:
return {
Expand All @@ -19,4 +41,10 @@ module.exports = function(eleventyConfig) {
output: "out"
}
}
};
};

async function resizeImage(src, width, height, mode) {
return await Sharp(src)
.resize({ width: width, height: height, fit: mode })
.toBuffer();
}
5 changes: 2 additions & 3 deletions 11ty-source/_layouts/blog-layout.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ layout: default.liquid
<div class="col-md-8">

<h1 class="title">{{title}}</h1>

{{content}}

{{content}}

</div>

<div class="col-md-4 twitter-widget">
Expand Down
11 changes: 11 additions & 0 deletions 11ty-source/_layouts/showcase.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: default
---

<h1 class="title">{{title}}</h1>

<iframe width="180px" scrolling="0" height="30px" frameborder="0" id="githubBtn-tr-info"
allowtransparency="true"
src="https://ghbtns.com/github-btn.html?user=haxeflixel&amp;repo=haxeflixel.com&amp;type=watch&amp;count=true&amp;size=large"></iframe>

{{content}}
13 changes: 13 additions & 0 deletions 11ty-source/_layouts/sponsors-layout.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: default.liquid
---

<div class="col-md-12">

<h1 class="title">{{title}}</h1>
{{content}}

</div>



Loading

0 comments on commit 81ab36e

Please sign in to comment.