0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-22 08:58:11 +00:00

fix title

This commit is contained in:
Víctor Losada Hernández
2026-03-22 02:18:02 +01:00
parent 0752fbf125
commit 3772f8c3b3

View File

@@ -19,28 +19,23 @@
<main id="reactRoot"></main>
<script type="module">
const url = window.__INITIAL_PROPS__.config.baseUrl;
console.log(window.__INITIAL_PROPS__);
const title = window.__INITIAL_PROPS__.brew.title;
const { config: { baseUrl: url }, brew: { title } } = window.__INITIAL_PROPS__;
if(title && title.length !== 0) {
document.title = `${title} - The Homebrewery`
}
let prefix = '';
if (url.includes('://homebrewery-pr-')) {
if (url.includes('://homebrewery-pr-')) {
const match = url.match(/pr-(\d+)/);
if (match) {
document.title = `PR-${match[1]} ` + document.title;
}
} else if (url.includes('://localhost:')) {
document.title = `LOCAL - ` + document.title;
}
if (window.location.pathname.startsWith('/admin')) {
import('/client/admin/main.jsx');
} else {
import('/client/homebrew/main.jsx');
}
if (match) prefix = `PR-${match[1]} `;
} else if (url.includes('://localhost')) {
prefix = 'LOCAL - ';
}
if (title) {
document.title = `${prefix}${title} - The Homebrewery`;
}
const isAdmin = window.location.pathname.startsWith('/admin');
import(isAdmin ? '/client/admin/main.jsx' : '/client/homebrew/main.jsx');
</script>
</body>
</html>