This commit is contained in:
Timo Knuth 2026-02-05 13:09:25 +01:00
parent 6f1109d593
commit 39c93e7178
3 changed files with 71 additions and 8 deletions

View File

@ -26,6 +26,74 @@ export async function app(): Promise<express.Express> {
server.set('view engine', 'html');
server.set('views', browserDistFolder);
// Sitemap XML endpoints - MUST be before static files middleware
server.get('/sitemap.xml', async (req, res) => {
try {
const sitemapIndexXml = `<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.bizmatch.net/sitemap-static.xml</loc>
<lastmod>${new Date().toISOString().split('T')[0]}</lastmod>
</sitemap>
</sitemapindex>`;
res.header('Content-Type', 'application/xml; charset=utf-8');
res.send(sitemapIndexXml);
} catch (error) {
console.error('[SSR] Error generating sitemap index:', error);
res.status(500).send('Error generating sitemap');
}
});
server.get('/sitemap-static.xml', async (req, res) => {
try {
const sitemapXml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.bizmatch.net/</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bizmatch.net/home</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bizmatch.net/businessListings</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://www.bizmatch.net/commercialPropertyListings</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://www.bizmatch.net/brokerListings</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://www.bizmatch.net/terms-of-use</loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>https://www.bizmatch.net/privacy-statement</loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>`;
res.header('Content-Type', 'application/xml; charset=utf-8');
res.send(sitemapXml);
} catch (error) {
console.error('[SSR] Error generating static sitemap:', error);
res.status(500).send('Error generating sitemap');
}
});
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser

View File

@ -1,6 +1,6 @@
// Build information, automatically generated by `the_build_script` :zwinkern:
const build = {
timestamp: "GER: 05.02.2026 12:45 | TX: 02/05/2026 5:45 AM"
timestamp: "GER: 05.02.2026 13:06 | TX: 02/05/2026 6:06 AM"
};
export default build;

View File

@ -129,13 +129,8 @@ Disallow: /
# ===========================================
# Sitemap locations
# ===========================================
# Main sitemap index (dynamically generated, contains all sub-sitemaps)
Sitemap: https://www.bizmatch.net/bizmatch/sitemap.xml
# Individual sitemaps (auto-listed in sitemap index)
# - https://www.bizmatch.net/bizmatch/sitemap/static.xml
# - https://www.bizmatch.net/bizmatch/sitemap/business-1.xml
# - https://www.bizmatch.net/bizmatch/sitemap/commercial-1.xml
# Main sitemap index
Sitemap: https://www.bizmatch.net/sitemap.xml
# ===========================================
# Host directive (for Yandex)