diff --git a/src/components/LampToggle/LampToggle.jsx b/src/components/LampToggle/LampToggle.jsx
index a6aa92e..4162072 100644
--- a/src/components/LampToggle/LampToggle.jsx
+++ b/src/components/LampToggle/LampToggle.jsx
@@ -19,7 +19,7 @@ function LampToggle() {
const audioOffRef = useRef(null);
useEffect(() => {
- loadConfig().then(setConfig).catch(console.error);
+ loadConfig().then(setConfig).catch(e => console.error('[lamp]:', e));
}, []);
useEffect(() => {
diff --git a/src/components/Navigation/Navigation.jsx b/src/components/Navigation/Navigation.jsx
index 74be768..ad0d4f2 100644
--- a/src/components/Navigation/Navigation.jsx
+++ b/src/components/Navigation/Navigation.jsx
@@ -23,7 +23,7 @@ function Navigation() {
setPieces(piecesData);
setConfig(configData);
})
- .catch(error => console.error('Error loading data:', error));
+ .catch(error => console.error('[nav]: error loading data:', error));
}, []);
const handleRandomPiece = () => {
diff --git a/src/components/Volumes/Volumes.jsx b/src/components/Volumes/Volumes.jsx
index cd4cd8b..d752fca 100644
--- a/src/components/Volumes/Volumes.jsx
+++ b/src/components/Volumes/Volumes.jsx
@@ -16,7 +16,7 @@ function Volumes() {
setCollections(collectionsData);
setConfig(configData);
})
- .catch(error => console.error('Error loading data:', error));
+ .catch(error => console.error('[volumes]: error loading data:', error));
}, []);
if (collections.length === 0) {
diff --git a/src/components/WordsWasted/WordsWasted.jsx b/src/components/WordsWasted/WordsWasted.jsx
index 248146c..11567af 100644
--- a/src/components/WordsWasted/WordsWasted.jsx
+++ b/src/components/WordsWasted/WordsWasted.jsx
@@ -15,7 +15,7 @@ function WordsWasted() {
setConfig(configData);
setStats(statsData);
})
- .catch(console.error);
+ .catch(e => console.error('[stats]:', e));
}, []);
if (!config || !stats) {
diff --git a/src/utils/loadConfig.js b/src/utils/loadConfig.js
index 065b3f4..79ce495 100644
--- a/src/utils/loadConfig.js
+++ b/src/utils/loadConfig.js
@@ -15,7 +15,7 @@ export async function loadConfig() {
return config;
} catch (error) {
- console.error('Error loading configuration:', error);
+ console.error('[config]: error loading configuration:', error);
throw error;
}
}
diff --git a/src/utils/loadTheme.js b/src/utils/loadTheme.js
index 618a077..cbcabf4 100644
--- a/src/utils/loadTheme.js
+++ b/src/utils/loadTheme.js
@@ -14,7 +14,7 @@ export function loadTheme(config) {
const defaultMode = config?.ui?.theme?.defaultMode || null;
if (!themes.has(themeName)) {
- console.warn(`Theme "${themeName}" not found. Falling back to "${defaultTheme}".`);
+ console.warn(`[theme]: "${themeName}" not found, falling back to "${defaultTheme}"`);
}
const baseTheme = themes.get(themeName) || themes.get(defaultTheme);
diff --git a/src/utils/resolveContentPath.js b/src/utils/resolveContentPath.js
index 6fd86c5..9153441 100644
--- a/src/utils/resolveContentPath.js
+++ b/src/utils/resolveContentPath.js
@@ -22,7 +22,7 @@ export async function resolveContentPath({ pathname }) {
const pages = await pagesRes.json();
isPage = pages.some(page => page.slug === slug);
} catch (error) {
- console.log('Error fetching pages index:', error);
+ console.error('[router]: error fetching pages index:', error);
isPage = false;
}
if (!isPage) {
@@ -31,7 +31,7 @@ export async function resolveContentPath({ pathname }) {
const pieces = await piecesRes.json();
isPiece = pieces.some(piece => piece.slug === slug);
} catch (error) {
- console.log('Error fetching pieces index:', error);
+ console.error('[router]: error fetching pieces index:', error);
isPiece = false;
}
}
diff --git a/vercel.json b/vercel.json
index 8cbb440..222f7c2 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,13 +1,21 @@
{
"buildCommand": "npm run build",
"rewrites": [
+ {
+ "source": "/feed.xml",
+ "destination": "/generated/feed.xml"
+ },
+ {
+ "source": "/sitemap.xml",
+ "destination": "/generated/sitemap.xml"
+ },
{
"source": "/feed/",
- "destination": "/feed.xml"
+ "destination": "/generated/feed.xml"
},
{
"source": "/sitemap/",
- "destination": "/sitemap.xml"
+ "destination": "/generated/sitemap.xml"
},
{
"source": "/robots",
@@ -17,9 +25,104 @@
"source": "/robots.txt",
"destination": "/robots.txt"
},
+ {
+ "source": "/",
+ "has": [
+ {
+ "type": "header",
+ "key": "user-agent",
+ "value": ".*(bot|crawl|spider|slurp|facebookexternalhit|facebot|twitterbot|linkedinbot|pinterest|telegram|whatsapp|discord|slack).*"
+ }
+ ],
+ "destination": "/generated/meta/index.html"
+ },
+ {
+ "source": "/:slug",
+ "has": [
+ {
+ "type": "header",
+ "key": "user-agent",
+ "value": ".*(bot|crawl|spider|slurp|facebookexternalhit|facebot|twitterbot|linkedinbot|pinterest|telegram|whatsapp|discord|slack).*"
+ }
+ ],
+ "destination": "/generated/meta/:slug.html"
+ },
+ {
+ "source": "/reader/:collection",
+ "has": [
+ {
+ "type": "header",
+ "key": "user-agent",
+ "value": ".*(bot|crawl|spider|slurp|facebookexternalhit|facebot|twitterbot|linkedinbot|pinterest|telegram|whatsapp|discord|slack).*"
+ },
+ {
+ "type": "query",
+ "key": "piece",
+ "value": "(?
.*)"
+ }
+ ],
+ "destination": "/generated/meta/:piece.html"
+ },
+ {
+ "source": "/reader/:collection",
+ "has": [
+ {
+ "type": "header",
+ "key": "user-agent",
+ "value": ".*(bot|crawl|spider|slurp|facebookexternalhit|facebot|twitterbot|linkedinbot|pinterest|telegram|whatsapp|discord|slack).*"
+ }
+ ],
+ "destination": "/generated/meta/index.html"
+ },
{
"source": "/(.*)",
"destination": "/index.html"
}
+ ],
+ "headers": [
+ {
+ "source": "/generated/og/(.*)",
+ "headers": [
+ {
+ "key": "Content-Type",
+ "value": "image/png"
+ },
+ {
+ "key": "Cache-Control",
+ "value": "public, max-age=31536000, immutable"
+ }
+ ]
+ },
+ {
+ "source": "/generated/meta/(.*)",
+ "headers": [
+ {
+ "key": "Content-Type",
+ "value": "text/html; charset=utf-8"
+ },
+ {
+ "key": "Cache-Control",
+ "value": "public, max-age=3600"
+ }
+ ]
+ },
+ {
+ "source": "/generated/feed.xml",
+ "headers": [
+ {
+ "key": "Content-Type",
+ "value": "application/xml"
+ }
+ ]
+ },
+ {
+ "source": "/generated/sitemap.xml",
+ "headers": [
+ {
+ "key": "Content-Type",
+ "value": "application/xml"
+ }
+ ]
+ }
]
}
\ No newline at end of file