add getting started page, rework SEO to target nomad communities and social media
This commit is contained in:
@@ -36,6 +36,7 @@ async function createOptimizedBuild() {
|
||||
content: [
|
||||
'public/index.html',
|
||||
'public/about.html',
|
||||
'public/getting-started.html',
|
||||
],
|
||||
css: [
|
||||
'public/css/pico.jade.css',
|
||||
@@ -152,6 +153,7 @@ async function createOptimizedBuild() {
|
||||
console.log('📄 Step 4: Minifying HTML...');
|
||||
await minifyHTMLFile('public/index.html', 'dist/index.html');
|
||||
await minifyHTMLFile('public/about.html', 'dist/about.html');
|
||||
await minifyHTMLFile('public/getting-started.html', 'dist/getting-started.html');
|
||||
|
||||
// Step 5: Copy assets and SEO files
|
||||
console.log('📁 Step 5: Copying assets and SEO files...');
|
||||
@@ -312,6 +314,20 @@ async function copyDirectoryRecursive(src, dest) {
|
||||
}
|
||||
}
|
||||
|
||||
async function injectStructuredData(html) {
|
||||
try {
|
||||
const json = await fs.readFile('public/structured-data.json', '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');
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
async function minifyHTMLFile(inputPath, outputPath) {
|
||||
const html = await fs.readFile(inputPath, 'utf8');
|
||||
|
||||
@@ -322,6 +338,10 @@ 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 minified = await htmlMinify(updatedHTML, {
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
|
||||
Reference in New Issue
Block a user