-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.js
More file actions
34 lines (29 loc) · 926 Bytes
/
Header.js
File metadata and controls
34 lines (29 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Image = require("@11ty/eleventy-img");
const { menuLinks } = require("../site-metadata.js");
const Navigation = require("./Navigation.js");
const achLogo = async (title) => {
let metadata = await Image("src/images/logo.png", {
formats: ["avif", "webp", "jpeg"],
widths: [584],
outputDir: "./_site/img/",
});
let imageAttributes = {
alt: title,
sizes: "(min-width: 584px) 584px, 100vw",
loading: "eager",
decoding: "async",
style: "object-fit:cover",
class: "!transition-none",
};
return Image.generateHTML(metadata, imageAttributes);
};
module.exports = async (title, usingHero, currentUrl) => {
return `
<header class="global-header${usingHero ? " header-with-hero" : ""}">
<div class="header-inner boxed-regular">
<a href="/" class="logo">${await achLogo(title)}</a>
${Navigation(menuLinks, currentUrl)}
</div>
</header>
`;
};