seahaven-site/.eleventy.js
Adam Moussa 381f6b6dce feat(seo): BreadcrumbList on interior pages + richer LocalBusiness
Add a breadcrumb-ld partial (rendered from breadcrumbName/breadcrumbParent
front-matter) emitting BreadcrumbList JSON-LD on all 11 interior pages
(3-level on the job pages). Enrich homepage LocalBusiness with geo,
areaServed (US), and hasMap. NOTE: geo coords are approximate (Ronkonkoma
ZIP) — set precisely from the Google Business Profile; openingHours and
sameAs omitted pending real hours + non-placeholder social URLs.
2026-06-12 17:23:11 -04:00

33 lines
1.3 KiB
JavaScript

const images = require("./_data/images.json");
module.exports = function (eleventyConfig) {
// Static assets shipped verbatim to the document root.
eleventyConfig.addPassthroughCopy("assets");
eleventyConfig.addPassthroughCopy("robots.txt");
eleventyConfig.addPassthroughCopy("sitemap.xml");
// {% image "key", "alt text", 'loading="lazy" class="x"' %}
// Emits an <img> with width/height from _data/images.json (prevents CLS).
eleventyConfig.addShortcode("image", function (key, alt, attrs = "") {
const img = images[key];
if (!img) {
throw new Error(`image shortcode: unknown key "${key}" (add it to _data/images.json)`);
}
const safeAlt = String(alt).replace(/"/g, "&quot;");
const extra = attrs ? " " + attrs : "";
return `<img src="${img.src}" width="${img.w}" height="${img.h}" alt="${safeAlt}"${extra}>`;
});
// Current year, for the footer (replaces the deprecated document.write pattern).
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
// JSON-encode a value (for safely emitting strings into JSON-LD).
eleventyConfig.addFilter("json", (v) => JSON.stringify(v));
return {
dir: { input: ".", includes: "_includes", data: "_data", output: "_site" },
templateFormats: ["njk"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
};
};