From 26effb5ea8c21478a47a41b58f3209246bc21dbb Mon Sep 17 00:00:00 2001 From: Kristoff Lalicki <32229646+klalicki@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:39:41 -0400 Subject: [PATCH] adds code to make it build on other URLs other than root --- .eleventy.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.eleventy.js b/.eleventy.js index acc501c..b55d8ad 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -5,6 +5,8 @@ const fs = require("fs"); const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); const lazyImagesPlugin = require("eleventy-plugin-lazyimages"); const embedYouTube = require("eleventy-plugin-youtube-embed"); +const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); +const urlBase = process.env.BASE_URL || ""; const markdownItOptions = { html: true, @@ -136,7 +138,16 @@ module.exports = function (eleventyConfig) { } }); + let p = {}; + if (process.env.NODE_ENV === "build") { + console.log("running in production"); + eleventyConfig.addPlugin(EleventyHtmlBasePlugin); + // this should be set + p = { pathPrefix: urlBase }; + } + return { + ...p, passthroughFileCopy: true, dir: { input: "content/pages",