修复本地开发base标签问题,添加内联脚本提前移除

This commit is contained in:
2026-06-02 20:39:28 +08:00
parent d9c0b6ade9
commit 94d9680174
6 changed files with 40 additions and 0 deletions

View File

@@ -21,6 +21,21 @@
<!-- Base Path for Subdirectory Deployment -->
<base href="/g2026/g4/">
<!-- Smart Path Detection - Must run before CSS/JS loading -->
<script>
(function() {
const hostname = window.location.hostname;
// 本地开发环境自动移除 base 标签
if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '') {
const baseTag = document.querySelector('base');
if (baseTag) {
baseTag.remove();
console.log('🔧 Local dev mode: base tag removed');
}
}
})();
</script>
<!-- Stylesheet -->
<link rel="stylesheet" href="css/style.css">