Skip to content

Commit

Permalink
fix: use BASE_URL consistently
Browse files Browse the repository at this point in the history
luandro committed Sep 6, 2024
1 parent 1aa2327 commit 0e1833a
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yaml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ jobs:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
DATABASE_ID: ${{ secrets.DATABASE_ID }}
WEBSITE_TAG: ${{ secrets.WEBSITE_TAG }}
BASE_URL: /${{ github.event.repository.name }}/
BASE_URL: /${{ github.event.repository.name }}
run: bun run build --no-cache

- name: List build directory contents
3 changes: 1 addition & 2 deletions src/components/Link.jsx
Original file line number Diff line number Diff line change
@@ -2,8 +2,7 @@ import React from 'react';
import { Link as RouterLink } from 'react-router-dom';

const Link = ({ to, children, ...props }) => {
const baseUrl = import.meta.env.BASE_URL;
const adjustedTo = to.startsWith('/') ? `${baseUrl}${to.slice(1)}` : to;
const adjustedTo = to.startsWith('/') ? `${import.meta.env.BASE_URL}${to.slice(1)}` : to;

return (
<RouterLink to={adjustedTo} {...props}>
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ export default defineConfig({
host: "::",
port: "8080",
},
base: process.env.GITHUB_ACTIONS ? process.env.BASE_URL : '/',
base: process.env.BASE_URL || '/',
plugins: [react()],
resolve: {
alias: [

0 comments on commit 0e1833a

Please sign in to comment.