Skip to content

Commit 9ea20ea

Browse files
pavelkuceraclaude
andcommitted
fix: ensure BASE_URL always has trailing slash for clean path joining
Use trailing slash on base config so ${BASE_URL}data/... works in both local dev (/) and GitHub Pages (/blog-devdrift/) without regex hacks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8bd46fe commit 9ea20ea

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineConfig({
66
site: process.env.GITHUB_ACTIONS
77
? 'https://cookielab.github.io'
88
: 'http://localhost:4321',
9-
base: process.env.GITHUB_ACTIONS ? '/blog-devdrift' : '/',
9+
base: process.env.GITHUB_ACTIONS ? '/blog-devdrift/' : '/',
1010
output: 'static',
1111
integrations: [react()],
1212
vite: {

src/components/CategoryTrendChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function CategoryTrendChart() {
2828
const canvasRef = useRef<HTMLCanvasElement>(null);
2929

3030
useEffect(() => {
31-
fetch(`${import.meta.env.BASE_URL}/data/skills-timeline.json`)
31+
fetch(`${import.meta.env.BASE_URL}data/skills-timeline.json`)
3232
.then(r => r.json())
3333
.then(data => {
3434
const ctx = canvasRef.current?.getContext('2d');

src/components/ComplexityChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function ComplexityChart() {
2424
const canvasRef = useRef<HTMLCanvasElement>(null);
2525

2626
useEffect(() => {
27-
fetch(`${import.meta.env.BASE_URL}/data/complexity-data.json`)
27+
fetch(`${import.meta.env.BASE_URL}data/complexity-data.json`)
2828
.then(r => r.json())
2929
.then(data => {
3030
const ctx = canvasRef.current?.getContext('2d');

src/components/PopulationChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function PopulationChart() {
1717
const canvasRef = useRef<HTMLCanvasElement>(null);
1818

1919
useEffect(() => {
20-
fetch(`${import.meta.env.BASE_URL}/data/population-data.json`)
20+
fetch(`${import.meta.env.BASE_URL}data/population-data.json`)
2121
.then(r => r.json())
2222
.then(data => {
2323
const ctx = canvasRef.current?.getContext('2d');

src/components/SkillFilters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function SkillFilters() {
3232
const [userFilteredCategories, setUserFilteredCategories] = useState(false);
3333

3434
useEffect(() => {
35-
fetch(`${import.meta.env.BASE_URL}/data/skills-timeline.json`)
35+
fetch(`${import.meta.env.BASE_URL}data/skills-timeline.json`)
3636
.then(r => r.json())
3737
.then(data => {
3838
setSkillsList(data.skills.map((s: any) => ({ name: s.name, category: s.category })));

src/components/SkillsChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export default function SkillsChart({ activeCategories, hiddenSkills }: SkillsCh
7272

7373
useEffect(() => {
7474
Promise.all([
75-
fetch(`${import.meta.env.BASE_URL}/data/skills-timeline.json`).then(r => r.json()),
76-
fetch(`${import.meta.env.BASE_URL}/data/categories.json`).then(r => r.json()),
77-
fetch(`${import.meta.env.BASE_URL}/data/key-events.json`).then(r => r.json()),
75+
fetch(`${import.meta.env.BASE_URL}data/skills-timeline.json`).then(r => r.json()),
76+
fetch(`${import.meta.env.BASE_URL}data/categories.json`).then(r => r.json()),
77+
fetch(`${import.meta.env.BASE_URL}data/key-events.json`).then(r => r.json()),
7878
]).then(([skillData, catData, eventsData]) => {
7979
setSkills(skillData.skills);
8080
setCategories(catData);

0 commit comments

Comments
 (0)