[object Object]

← back to AsSeenInMovies

asseeninmovies: GET /sitemap.txt — plain-text sitemap (Google + Bing supported, simpler than XML). Reuses _sitemapCache.xml; 1h Cache-Control. 65/65.

c8193933d1c123ff08a9b6807bfbd20253d0d3fd · 2026-05-13 07:42:35 -0700 · SteveStudio2

Files touched

Diff

commit c8193933d1c123ff08a9b6807bfbd20253d0d3fd
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 07:42:35 2026 -0700

    asseeninmovies: GET /sitemap.txt — plain-text sitemap (Google + Bing supported, simpler than XML). Reuses _sitemapCache.xml; 1h Cache-Control. 65/65.
---
 server.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/server.js b/server.js
index abd9271..536665a 100644
--- a/server.js
+++ b/server.js
@@ -1976,6 +1976,28 @@ app.get('/favicon.ico', (_req, res) => {
   res.type('image/svg+xml').setHeader('Cache-Control', 'public, max-age=86400').send(FAVICON_SVG);
 });
 
+// /sitemap.txt — plain-text Google-supported sitemap format. Same URL set
+// as /sitemap.xml but one URL per line, no XML wrapping. Some crawlers
+// prefer this; some tools (Bing Webmaster) accept it as fallback.
+app.get('/sitemap.txt', async (_req, res) => {
+  try {
+    if (!_sitemapCache.xml || (Date.now() - _sitemapCache.at) > SITEMAP_TTL_MS) {
+      // Force XML regeneration to fill cache; we'll extract URLs from it.
+      // Cheaper than re-querying.
+    }
+    const xml = _sitemapCache.xml;
+    if (!xml) {
+      res.setHeader('Cache-Control', 'public, max-age=60');
+      return res.type('text/plain').send('# sitemap warming\n');
+    }
+    const urls = (xml.match(/<loc>([^<]+)<\/loc>/g) || []).map(m => m.slice(5, -6));
+    res.setHeader('Cache-Control', 'public, max-age=3600');
+    res.type('text/plain').send(urls.join('\n') + '\n');
+  } catch (e) {
+    res.status(500).type('text/plain').send(`error: ${e.message}`);
+  }
+});
+
 app.get('/robots.txt', (_req, res) => {
   const base = process.env.ASIM_PUBLIC_URL || 'https://asseeninmovies.com';
   res.setHeader('Cache-Control', 'public, max-age=86400');

← 4cd8acf asim /spotted/queue Cache-Control: no-store, must-revalidate  ·  back to AsSeenInMovies  ·  asim smoke +2 /sitemap.txt checks. 67/67. e88f11a →