Some config cleanup

This commit is contained in:
Ben Edgington
2025-06-10 14:09:24 +01:00
parent 57c8f8a004
commit 0dabc11908
3 changed files with 9 additions and 8 deletions

View File

@@ -19,10 +19,8 @@ import myHtaccess from './integrations/my_htaccess';
Prism.languages.none = Prism.languages.text;
Prism.languages.code = Prism.languages.text;
const basePath = '/' + metadata.version;
export default defineConfig({
base: basePath,
base: '/' + metadata.version,
integrations: [
myBuildChecks(),
myAutoLinkHeadings({ exclude: 'h1, .no-anchor' }),
@@ -31,7 +29,7 @@ export default defineConfig({
myAddTooltips({ constantsFile: 'src/include/constants.json' }),
myFixupLinks(),
myCleanupHtml(),
myHtaccess(basePath),
myHtaccess(),
],
markdown: {
syntaxHighlight: 'prism',

View File

@@ -9,10 +9,14 @@ function writeHtaccess(base, dir, logger) {
logger.info(`Wrote .htaccess file to ${file}`);
}
export default function (base) {
export default function () {
let base;
return {
name: 'myHtaccess',
hooks: {
'astro:config:done': ({ config }) => {
base = config.base;
},
'astro:build:done': ({ dir, logger }) => {
writeHtaccess(base, dir, logger);
},

View File

@@ -21,7 +21,6 @@ function getGitBranch() {
}
const date = new Date().toISOString().substr(0, 16).replace('T', ' ') + ' UTC';
const version = getGitBranch();
const hostname = 'https://eth2book.info';
const canonical = hostname + '/latest';
@@ -30,13 +29,13 @@ const metadata = {
description:
"A technical handbook on Ethereum's move to proof of stake and beyond",
author: 'Ben Edgington',
gitHash: getGitHash(),
gitHash: getGitHash() || 'unknown',
gitUrl: 'https://github.com/benjaminion/upgrading-ethereum-book',
date: date,
licenceUrl: 'https://creativecommons.org/licenses/by-sa/4.0/',
licence: 'CC BY-SA 4.0',
hostname: hostname,
version: version,
version: getGitBranch() || 'unknown',
canonical: canonical,
};