SEO: Canonicals/OG auf allen Seiten, WebP, Caching, www-Redirect
Deploy / build-and-deploy (push) Successful in 24s
Deploy / build-and-deploy (push) Successful in 24s
- alle Unterseiten: Canonical-Tags; techday/gamejam zusaetzlich Open Graph - techday: Event-JSON-LD (27. Mai 2026, HubWerk01 Bruchsal) - mITapp-Screenshots als WebP (1,6 MB -> 65 KB) mit width/height/lazy - dediziertes OG-Bild 1200x630 (Logo + Tagline) fuer Start & GameJam - server.js: 301 www -> non-www, /index.html -> /, statische Assets 1 Jahr immutable cachen (HTML weiter no-cache), .webp MIME - CSS/JS ueberall versioniert (?v=20260610) - sitemap: lastmod ergaenzt, noindex-Seiten (Impressum/Datenschutz) entfernt Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
41bdd52be8
commit
9f832bcec7
11 files changed
+85
-21
No files matched your search
@@ -112,6 +112,7 @@ const MIME = {
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".webp": "image/webp",
|
||||
".ico": "image/x-icon",
|
||||
".json": "application/json; charset=utf-8",
|
||||
".woff2": "font/woff2",
|
||||
@@ -174,6 +175,20 @@ function saveLead(lead) {
|
||||
/* ---------- Statische Dateien ---------- */
|
||||
function serveStatic(req, res) {
|
||||
let urlPath = decodeURIComponent(req.url.split("?")[0]);
|
||||
|
||||
/* SEO: kanonischer Host (www -> non-www) und /index.html -> / */
|
||||
const host = (req.headers.host || "").toLowerCase();
|
||||
if (host === "www.tool-ctrl.de") {
|
||||
res.writeHead(301, { Location: "https://tool-ctrl.de" + req.url });
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
if (urlPath === "/index.html") {
|
||||
res.writeHead(301, { Location: "/" });
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (urlPath === "/") urlPath = "/index.html";
|
||||
|
||||
/* Path-Traversal verhindern */
|
||||
@@ -195,9 +210,13 @@ function serveStatic(req, res) {
|
||||
return;
|
||||
}
|
||||
const ext = path.extname(filePath).toLowerCase();
|
||||
/* HTML immer frisch, statische Assets lange cachen (Versionierung via ?v=) */
|
||||
const cacheControl = ext === ".html"
|
||||
? "no-cache"
|
||||
: "public, max-age=31536000, immutable";
|
||||
res.writeHead(200, {
|
||||
"Content-Type": MIME[ext] || "application/octet-stream",
|
||||
"Cache-Control": "no-cache"
|
||||
"Cache-Control": cacheControl
|
||||
});
|
||||
fs.createReadStream(filePath).pipe(res);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user