mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
app.logicsrc.com: sitemap.xml + robots Sitemap line (public pages only)
The credentials app answered 404 for both. robots.txt and sitemap.xml now come from the request host, list only the sign-in and sign-up pages, and disallow the session-only areas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b20afe6f50
commit
d3e07430b4
3 changed files with 63 additions and 1 deletions
26
apps/pwa/test/seo.test.mjs
Normal file
26
apps/pwa/test/seo.test.mjs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { robotsTxt, siteOrigin, sitemapXml } from "../src/lib/seo.mjs";
|
||||
|
||||
const req = (host, protocol = "http") => ({ protocol, headers: { host }, get: (h) => (h.toLowerCase() === "host" ? host : undefined) });
|
||||
|
||||
test("each hostname describes itself over https", () => {
|
||||
assert.equal(siteOrigin(req("app.logicsrc.com"), "https://x"), "https://app.logicsrc.com");
|
||||
assert.equal(siteOrigin(req("localhost:8080"), "https://x"), "http://localhost:8080");
|
||||
});
|
||||
|
||||
test("sitemap lists only public pages on this host", () => {
|
||||
const xml = sitemapXml("https://app.logicsrc.com");
|
||||
assert.match(xml, /<urlset /);
|
||||
assert.match(xml, /<loc>https:\/\/app\.logicsrc\.com\/<\/loc>/);
|
||||
assert.match(xml, /<loc>https:\/\/app\.logicsrc\.com\/\?mode=up<\/loc>/);
|
||||
assert.doesNotMatch(xml, /dashboard|settings|keyring/);
|
||||
});
|
||||
|
||||
test("robots points at this host's sitemap and keeps it crawlable", () => {
|
||||
const txt = robotsTxt("https://app.logicsrc.com");
|
||||
assert.match(txt, /^Sitemap: https:\/\/app\.logicsrc\.com\/sitemap\.xml$/m);
|
||||
assert.doesNotMatch(txt, /Disallow: \/sitemap/);
|
||||
assert.match(txt, /Disallow: \/dashboard/);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue