Skip to content

Commit 4aea3f4

Browse files
fix: permanently rename index to app and landing to index to fix all routing and dark mode issues natively
1 parent a909878 commit 4aea3f4

19 files changed

Lines changed: 3223 additions & 3218 deletions

‎build_netlify.py‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,7 @@ def rewrite_html(content: str) -> str:
5151

5252
def build_html() -> None:
5353
for html_file in PAGES.glob("*.html"):
54-
if html_file.name == "landing.html":
55-
content = html_file.read_text(encoding="utf-8")
56-
rewritten = rewrite_html(content)
57-
(DIST / "index.html").write_text(rewritten, encoding="utf-8")
58-
(DIST / "landing.html").write_text(rewritten, encoding="utf-8")
59-
continue
60-
elif html_file.name == "index.html":
61-
target_file = DIST / "app.html"
62-
else:
63-
target_file = DIST / html_file.name
54+
target_file = DIST / html_file.name
6455
content = html_file.read_text(encoding="utf-8")
6556
target_file.write_text(rewrite_html(content), encoding="utf-8")
6657

‎frontend/js/app.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
// Do NOT re-declare them here — use the globals from config.js directly.
8282
const IS_DEV = typeof window !== 'undefined' && ['localhost', '127.0.0.1'].includes(window.location.hostname);
8383
const moodAnalysisCache = new Map();
84-
const APP_ROUTE = window.location.pathname.endsWith('/app.html') ? 'app.html' : 'index.html';
84+
const APP_ROUTE = window.location.pathname.endsWith('/app.html') ? 'app.html' : 'app.html';
8585

8686
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
8787

‎frontend/js/landing-interactions.js‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,7 @@
201201
link.addEventListener('click', (event) => {
202202
let targetHref = link.getAttribute('href');
203203
if (!targetHref || targetHref.startsWith('#')) return;
204-
205-
// Rewrite index.html to /app in production
206-
if (targetHref.startsWith('index.html')) {
207-
const isLocalPreview = window.location.protocol === 'file:' ||
208-
['localhost', '127.0.0.1', ''].includes(window.location.hostname);
209-
210-
if (!isLocalPreview) {
211-
targetHref = targetHref.replace('index.html', '/app');
212-
}
213-
}
204+
// The link is natively app.html now. No need to intercept and rewrite URLs.
214205

215206
event.preventDefault();
216207
document.body.classList.add('is-leaving');

‎frontend/pages/404.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<body class="error-page-body">
2222
<header>
23-
<a href="index.html" class="logo">
23+
<a href="app.html" class="logo">
2424
<img style="height: 40px" src="../assets/images/biblioDrift_favicon.png" alt="BiblioDrift Logo"> BiblioDrift
2525
</a>
2626
<div class="header-controls">
@@ -30,7 +30,7 @@
3030
</div>
3131
<nav class="nav-links">
3232
<div class="tooltip">
33-
<a href="index.html" >Discovery</a>
33+
<a href="app.html" >Discovery</a>
3434
<span class="tooltip-text"><i class="fa-solid fa-wand-magic-sparkles"></i> Explore books</span>
3535
</div>
3636
<div class="tooltip">
@@ -72,7 +72,7 @@ <h2 class="error-heading">This book is missing from the shelf.</h2>
7272
</p>
7373

7474
<div class="error-actions">
75-
<a href="index.html" class="btn-primary">Return to Library</a>
75+
<a href="app.html" class="btn-primary">Return to Library</a>
7676
<a href="javascript:history.back()" class="btn-outline">Go Back</a>
7777
</div>
7878
</section>

0 commit comments

Comments
 (0)