Skip to content

Commit 660a3fb

Browse files
Viktor ZaundersViktor Zaunders
authored andcommitted
routing updates
1 parent ac44ef0 commit 660a3fb

File tree

6 files changed

+83
-57
lines changed

6 files changed

+83
-57
lines changed

404.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Page Not Found - Dark Soil Studio</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Page Not Found</h1>
12+
<p>The page you're looking for doesn't exist.</p>
13+
<a href="/" class="btn">Go Home</a>
14+
</div>
15+
16+
<script src="clean-urls.js"></script>
17+
</body>
18+
</html>

_redirects

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Clean URLs - redirect requests without .html to .html files
2+
/contact /contact.html 200
3+
/corri /corri.html 200
4+
/bouy-os /bouy-os.html 200
5+
/dash-chat /dash-chat.html 200
6+
/roadmap /roadmap.html 200
7+
/drapac /drapac.html 200
8+
9+
# Handle 404s gracefully
10+
/* /index.html 404

clean-urls.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Clean URLs handler for Dark Soil Studio
2+
(function() {
3+
'use strict';
4+
5+
// List of valid routes without .html
6+
const validRoutes = [
7+
'/contact',
8+
'/corri',
9+
'/bouy-os',
10+
'/dash-chat',
11+
'/roadmap',
12+
'/drapac'
13+
];
14+
15+
// Function to handle clean URL routing
16+
function handleCleanUrls() {
17+
const path = window.location.pathname;
18+
const cleanPath = path.replace(/\/$/, ''); // Remove trailing slash
19+
20+
// Check if this is a clean URL request
21+
if (validRoutes.includes(cleanPath)) {
22+
// Redirect to the .html version
23+
window.location.href = cleanPath + '.html';
24+
}
25+
}
26+
27+
// Run on page load
28+
if (document.readyState === 'loading') {
29+
document.addEventListener('DOMContentLoaded', handleCleanUrls);
30+
} else {
31+
handleCleanUrls();
32+
}
33+
34+
// Also handle navigation events for SPA-like behavior
35+
window.addEventListener('popstate', handleCleanUrls);
36+
})();

index.html

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
</button>
1919
<nav class="menu-links">
2020
<div class="menu-left">
21-
<a href="index.html" class="home-link">darksoil studio</a>
21+
<a href="/" class="home-link">darksoil studio</a>
2222
</div>
2323
<div class="menu-right">
2424
<div class="dropdown">
2525
<a href="#" class="dropdown-toggle">Projects ▾</a>
2626
<div class="dropdown-menu">
27-
<a href="dash-chat.html">Dash Chat</a>
28-
<a href="corri.html">Corri AI</a>
27+
<a href="/dash-chat">Dash Chat</a>
28+
<a href="/corri">Corri AI</a>
2929
<a href="https://darksoil.studio/p2p-shipyard" target="_blank" rel="noopener">p2p Shipyard</a>
30-
<a href="bouy-os.html">Buoy</a>
30+
<a href="/bouy-os">Buoy</a>
3131
</div>
3232
</div>
33-
<a href="contact.html">Connect</a>
33+
<a href="/contact">Connect</a>
3434
<div class="menu-separator"></div>
3535
<custom-social-link name="Github" url="https://github.com/darksoil-studio"></custom-social-link>
3636
<a href="https://darksoil.studio/p2p-shipyard/" class="dev-btn" target="_blank" rel="noopener" title="Developer Documentation">developer portal</a>
@@ -42,13 +42,13 @@
4242
<div class="dropdown mobile-dropdown">
4343
<a href="#" class="dropdown-toggle">Projects ▾</a>
4444
<div class="dropdown-menu">
45-
<a href="dash-chat.html">Dash Chat</a>
46-
<a href="corri.html">Corri AI</a>
45+
<a href="/dash-chat">Dash Chat</a>
46+
<a href="/corri">Corri AI</a>
4747
<a href="https://darksoil.studio/p2p-shipyard" target="_blank" rel="noopener">p2p Shipyard</a>
48-
<a href="bouy-os.html">Buoy</a>
48+
<a href="/bouy-os">Buoy</a>
4949
</div>
5050
</div>
51-
<a href="contact.html">Connect</a>
51+
<a href="/contact">Connect</a>
5252
<a href="https://darksoil.studio/p2p-shipyard/" class="dev-btn" target="_blank" rel="noopener" title="Developer Documentation">developer portal</a>
5353
</nav>
5454
</div>
@@ -72,7 +72,7 @@ <h2 id="what-we-do">What We Do</h2>
7272
<h2 id="things-weve-made">Projects</h2>
7373

7474
<rocket-columns>
75-
<a href="dash-chat.html" class="project-card-link">
75+
<a href="/dash-chat" class="project-card-link">
7676
<rocket-card>
7777
<div slot="title" class="card-title">
7878
<h4>Dash Chat</h4>
@@ -84,7 +84,7 @@ <h4>Dash Chat</h4>
8484
</p>
8585
</rocket-card>
8686
</a>
87-
<a href="corri.html" class="project-card-link">
87+
<a href="/corri" class="project-card-link">
8888
<rocket-card>
8989
<div slot="title" class="card-title">
9090
<h4>Corri AI</h4>
@@ -172,6 +172,7 @@ <h2 id="connect">Connect</h2>
172172

173173
registerCustomElements();
174174
import "./custom-social-link.js";
175+
import "./clean-urls.js";
175176
</script>
176177
<script>
177178
document.addEventListener('DOMContentLoaded', () => {

package-lock.json

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vite.config.ts

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,16 @@
1-
/*import { defineConfig } from 'vite';
2-
3-
export default defineConfig({
4-
base: ''
5-
});
6-
7-
8-
import { resolve } from 'path'
9-
import { defineConfig } from 'vite';
10-
11-
export default defineConfig({
12-
base: '',
13-
build: {
14-
rollupOptions: {
15-
input: {
16-
main: resolve(__dirname, 'index.html'),
17-
hc_intro: resolve(__dirname, 'hc-intro/index.html'),
18-
},
19-
},
20-
},
21-
});*/
22-
231
import { defineConfig } from 'vite'
24-
import { resolve } from 'path'
252

263
export default defineConfig({
274
build: {
285
rollupOptions: {
296
input: {
30-
main: resolve(__dirname, 'index.html'),
31-
dash: resolve(__dirname, 'dash-chat.html'),
32-
corri: resolve(__dirname, 'corri.html'),
33-
bouy: resolve(__dirname, 'bouy-os.html'),
34-
contact: resolve(__dirname, 'contact.html')
35-
// Add more pages he
7+
main: 'index.html',
8+
dash: 'dash-chat.html',
9+
corri: 'corri.html',
10+
bouy: 'bouy-os.html',
11+
contact: 'contact.html',
12+
roadmap: 'roadmap.html',
13+
drapac: 'drapac.html'
3614
}
3715
}
3816
}

0 commit comments

Comments
 (0)