Skip to content

Commit 4f87ac5

Browse files
authored
Merge pull request #6 from PyConColombia/develop
Add Sponsors page and update routing to use HashRouter
2 parents ea3dcba + 0bada3f commit 4f87ac5

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
send_page_view: false
1818
});
1919
</script>
20+
21+
<script>
22+
var path = window.location.pathname;
23+
if (!path.startsWith("/#") && !['/', ''].includes(path)) {
24+
window.location.replace(`/#${path}`);
25+
}
26+
</script>
2027
</head>
2128
<body>
2229
<div id="root"></div>

src/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Route, Routes } from "react-router-dom";
22
import { usePageTracking } from "./hooks/usePageTracking";
33
import Home from "./pages/Home";
44
import Team from "./pages/Team";
5+
import Sponsors from "./pages/Sponsors";
56

67
function App() {
78
usePageTracking();
@@ -10,6 +11,7 @@ function App() {
1011
<Routes>
1112
<Route path="/" element={<Home />} />
1213
<Route path="/team" element={<Team />} />
14+
<Route path="/sponsors" element={<Sponsors />} />
1315
</Routes>
1416
);
1517
}

src/main.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { StrictMode } from "react";
22
import { createRoot } from "react-dom/client";
3-
import { BrowserRouter } from "react-router-dom";
3+
import { HashRouter } from "react-router-dom";
44
import "./index.css";
55
import App from "./App.jsx";
66

7+
const baseUrl = (import.meta.env.BASE_URL ?? "/").replace(/\/$/, "") || undefined;
8+
79
createRoot(document.getElementById("root")).render(
810
<StrictMode>
9-
<BrowserRouter>
11+
<HashRouter basename={baseUrl}>
1012
<App />
11-
</BrowserRouter>
13+
</HashRouter>
1214
</StrictMode>,
1315
);

src/pages/Sponsors/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const Sponsors = () => {
2+
return (
3+
<div>Sponsors</div>
4+
)
5+
}
6+
7+
export default Sponsors

vite.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import { defineConfig } from "vite";
44
// https://vite.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: "/",
78
});

0 commit comments

Comments
 (0)