From 88a90e58ffeb8471dd471209ed83f560748b8c79 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sun, 9 Jun 2024 01:13:28 +0200 Subject: [PATCH] Fix paths for github pages deployment --- .eleventy.js | 4 ++++ .github/workflows/build.yaml | 2 ++ layouts/style.css | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index f9cf507..0f26f95 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,6 +1,7 @@ const CleanCSS = require("clean-css"); const yaml = require("js-yaml"); const Image = require("@11ty/eleventy-img"); +const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); /** * @template T @@ -18,6 +19,8 @@ const Image = require("@11ty/eleventy-img"); * @type {(eleventyConfig: EleventyConfig) => RecursivePartial} */ module.exports = function (config) { + config.addPlugin(EleventyHtmlBasePlugin); + config.addFilter("cssmin", function (code) { return new CleanCSS({}).minify(code).styles; }); @@ -54,5 +57,6 @@ module.exports = function (config) { data: "../data", output: "dist", }, + pathPrefix: process.env.ELEVENTY_PATH_PREFIX, }; }; diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2b8fe80..add1b5d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,6 +7,8 @@ jobs: build: name: Build runs-on: ubuntu-24.04 + env: + ELEVENTY_PATH_PREFIX: website steps: - uses: actions/checkout@v4 - name: Install dependencies diff --git a/layouts/style.css b/layouts/style.css index be074c8..1fe73df 100644 --- a/layouts/style.css +++ b/layouts/style.css @@ -65,7 +65,7 @@ header { var(--color-bg) 1rem, rgba(255, 255, 255, 0) 6rem ), - url("/assets/hero.jpg"); + url("{{ '/assets/hero.jpg' | htmlBaseUrl }}"); background-size: cover; background-position: center; width: 100%;