Change logic for setting page title

This commit is contained in:
G.Ambatte
2026-09-07 20:35:23 +12:00
parent 857257a1be
commit 9120a166c8
+14 -4
View File
@@ -21,6 +21,15 @@
let prefix = ''; let prefix = '';
// Default page title
let result ='The Homebrewery';
// Add brew title, if it exists
if (title) {
result = `${title} - ${result}`;
}
// Add prefix for Stage/PR Deployment/Local install
if (url && url?.includes('://homebrewery-stage.')) { if (url && url?.includes('://homebrewery-stage.')) {
prefix = `Stage `; prefix = `Stage `;
} else if (url?.includes('://homebrewery-pr-')) { } else if (url?.includes('://homebrewery-pr-')) {
@@ -30,12 +39,13 @@
prefix = 'Local '; prefix = 'Local ';
} }
if (title) { if (prefix) {
document.title = `${prefix} - ${title} - The Homebrewery`; result = `${prefix} - ${result}`;
} else if (prefix) {
document.title = `${prefix} - The Homebrewery`;
} }
// Set page title
document.title = result;
if (window.location.pathname.startsWith('/admin')) { if (window.location.pathname.startsWith('/admin')) {
import('/client/admin/main.jsx'); import('/client/admin/main.jsx');
} else { } else {