mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-05 00:48:44 +00:00
Merge pull request #4997 from G-Ambatte/fixPageTitle
Fix leading hyphen on page title - closes Issue #5069
This commit is contained in:
+14
-4
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user