workaround to redirect trailing slashes

This commit is contained in:
Orion Reed 2023-08-12 18:32:58 +01:00
parent cacfb0f329
commit 3f16d2fe1d
4 changed files with 7 additions and 32 deletions

View File

@ -1,30 +0,0 @@
# .github/workflows/publish.yml
name: Generate build on branch
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
steps:
- name: git-checkout
uses: actions/checkout@v3
- name: Install all dependencies
run: npm install
- name: Build
run: npm run build
- name: Push
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: build # The branch name where you want to push the assets
FOLDER: dist # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Build: ({sha}) {msg}" # The commit message

View File

@ -10,6 +10,11 @@
href="https://fonts.googleapis.com/css2?family=Alegreya+Sans:ital,wght@0,300;0,400;0,500;0,700;0,800;0,900;1,300;1,400;1,500;1,700;1,800;1,900&family=Alegreya:ital,wght@0,400..900;1,400..900&family=IBM+Plex+Mono:ital,wght@0,200;0,300;0,400;0,500;0,600;1,200;1,300;1,400;1,500;1,600&display=swap"
rel="stylesheet">
<title>Orion Reed</title>
<script>
if (window.location.pathname.slice(-1) === '/' && window.location.pathname.length > 1) {
window.location = window.location.toString().replace(/\/$/, '');
}
</script>
</head>
<body>
<div id="app"></div>

View File

@ -5,7 +5,7 @@
"scripts": {
"dev": "vite",
"prebuild": "node scripts/prebuild.mjs",
"build": "node scripts/prebuild.mjs && vite build",
"build": "node scripts/prebuild.mjs && vite build && cp dist/index.html dist/404.html",
"preview": "vite preview"
},
"dependencies": {

View File

@ -26,7 +26,7 @@ export function Header({ dark }: { dark?: boolean }) {
<Container size="40em">
<Group align="end">
<Anchor href="/" className={classes.home}>
orion reed
orion reed 0
</Anchor>
<Anchor href="/posts" className={classes.link}>
posts