fix styling of headers and nav bar

This commit is contained in:
2026-06-09 15:07:50 +09:00
parent a7f8da3ff1
commit 9e1ca62515
7 changed files with 212 additions and 200 deletions
+12 -6
View File
@@ -167,9 +167,10 @@ async function createOptimizedBuild() {
// Copy SEO files
try {
await fs.copyFile('public/structured-data.json', 'dist/structured-data.json');
await fs.copyFile('public/getting-started-structured-data.json', 'dist/getting-started-structured-data.json');
await fs.copyFile('public/sitemap.xml', 'dist/sitemap.xml');
await fs.copyFile('public/robots.txt', 'dist/robots.txt');
console.log(' ✅ SEO files copied (structured-data.json, sitemap.xml, robots.txt)');
console.log(' ✅ SEO files copied (structured-data.json, getting-started-structured-data.json, sitemap.xml, robots.txt)');
} catch (err) {
console.log(' ⚠️ Some SEO files not found, skipping...');
}
@@ -314,16 +315,16 @@ async function copyDirectoryRecursive(src, dest) {
}
}
async function injectStructuredData(html) {
async function injectStructuredData(html, jsonPath) {
try {
const json = await fs.readFile('public/structured-data.json', 'utf8');
const json = await fs.readFile(jsonPath, 'utf8');
const minified = JSON.stringify(JSON.parse(json));
return html.replace(
/<script type="application\/ld\+json">[\s\S]*?<\/script>/,
`<script type="application/ld+json">${minified}</script>`
);
} catch (err) {
console.log(' ⚠️ structured-data.json not found, skipping injection');
console.log(` ⚠️ ${jsonPath} not found, skipping injection`);
return html;
}
}
@@ -338,8 +339,13 @@ async function minifyHTMLFile(inputPath, outputPath) {
'<link rel="stylesheet" href="css/bundle.css">')
.replace(/<script src="site-scripts\/theme-toggle\.js"><\/script>/g, ''); // Remove individual script references
if (path.basename(inputPath) === 'index.html') {
updatedHTML = await injectStructuredData(updatedHTML);
const structuredDataByPage = {
'index.html': 'public/structured-data.json',
'getting-started.html': 'public/getting-started-structured-data.json',
};
const structuredDataPath = structuredDataByPage[path.basename(inputPath)];
if (structuredDataPath) {
updatedHTML = await injectStructuredData(updatedHTML, structuredDataPath);
}
const minified = await htmlMinify(updatedHTML, {