From 39c93e717862523efb00bf7bf272d3f47b299fdc Mon Sep 17 00:00:00 2001 From: Timo Knuth Date: Thu, 5 Feb 2026 13:09:25 +0100 Subject: [PATCH] Sitemap --- bizmatch/server.ts | 68 +++++++++++++++++++++++++++++++++++++++++ bizmatch/src/build.ts | 2 +- bizmatch/src/robots.txt | 9 ++---- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/bizmatch/server.ts b/bizmatch/server.ts index abfc7d3..ce0877f 100644 --- a/bizmatch/server.ts +++ b/bizmatch/server.ts @@ -26,6 +26,74 @@ export async function app(): Promise { 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 = ` + + + https://www.bizmatch.net/sitemap-static.xml + ${new Date().toISOString().split('T')[0]} + +`; + + 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 = ` + + + https://www.bizmatch.net/ + daily + 1.0 + + + https://www.bizmatch.net/home + daily + 1.0 + + + https://www.bizmatch.net/businessListings + daily + 0.9 + + + https://www.bizmatch.net/commercialPropertyListings + daily + 0.9 + + + https://www.bizmatch.net/brokerListings + daily + 0.9 + + + https://www.bizmatch.net/terms-of-use + monthly + 0.5 + + + https://www.bizmatch.net/privacy-statement + monthly + 0.5 + +`; + + 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 diff --git a/bizmatch/src/build.ts b/bizmatch/src/build.ts index 1a0975a..b899679 100644 --- a/bizmatch/src/build.ts +++ b/bizmatch/src/build.ts @@ -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; \ No newline at end of file diff --git a/bizmatch/src/robots.txt b/bizmatch/src/robots.txt index 9274e1f..5ad6302 100644 --- a/bizmatch/src/robots.txt +++ b/bizmatch/src/robots.txt @@ -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)