Skip to content

Commit 6af199a

Browse files
fix: deploy project website to github pages
1 parent b61e15f commit 6af199a

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ jobs:
6666
run: pnpm install
6767
working-directory: ./afterpython/_website
6868

69-
- name: Debug BASE_PATH
70-
run: echo "BASE_PATH will be set to /${{ github.event.repository.name }}"
71-
7269
- name: Build website
7370
run: ap build
7471
env:

afterpython/_website/src/lib/components/Logo.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script lang="ts">
2+
import { resolve } from '$app/paths';
3+
24
type LogoProps = {
35
class?: string;
46
size?: 'sm' | 'md' | 'lg' | 'xl';
@@ -36,9 +38,9 @@
3638
</script>
3739

3840
{#if hasLogo}
39-
<a href="/" class="flex items-center {className}">
41+
<a href={resolve('/')} class="flex items-center {className}">
4042
<img
41-
src="/logo.svg"
43+
src={resolve(`/logo.svg`)}
4244
alt="Logo"
4345
class="{sizeClasses[size]} w-auto"
4446
onerror={handleImageError}

afterpython/_website/src/routes/+layout.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import type { LayoutProps } from './$types';
44
import ThemeToggle from '$components/ThemeToggle.svelte';
55
import Logo from '$components/Logo.svelte';
6-
import Footer from '$components/Footer.svelte';
6+
// import Footer from '$components/Footer.svelte';
77
import { dev } from '$app/environment';
88
import { env } from '$env/dynamic/public';
9+
import { resolve } from '$app/paths';
910
1011
let { data: metadataJson, children }: LayoutProps = $props();
1112
@@ -28,7 +29,7 @@
2829
<Logo size="md" />
2930
<ul class="flex gap-18 justify-center flex-1">
3031
<li>
31-
<a href={dev ? env.PUBLIC_DOC_URL : "/doc"} target="_blank" rel="external noopener noreferrer">
32+
<a href={dev ? env.PUBLIC_DOC_URL : resolve("/doc")} target="_blank" rel="external noopener noreferrer">
3233
Documentation
3334
</a>
3435
</li>
@@ -60,5 +61,5 @@
6061

6162
{@render children()}
6263

63-
<Footer projectName={metadataJson.name} projectSummary={metadataJson.summary} {repositoryUrl} />
64+
<!-- <Footer projectName={metadataJson.name} projectSummary={metadataJson.summary} {repositoryUrl} /> -->
6465
</div>

afterpython/cli/commands/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ def build(ctx, dev: bool, execute: bool):
159159

160160
click.echo(f"Building {content_type}/...")
161161
# NOTE: needs to set BASE_URL so that the project website can link to the content pages correctly at e.g. localhost:5173/doc
162-
build_env = {**node_env, "BASE_URL": f"/{content_type}"}
162+
# BASE_PATH is set by the GitHub Actions workflow
163+
base_path = os.getenv("BASE_PATH", "")
164+
build_env = {**node_env, "BASE_URL": f"{base_path}/{content_type}"}
163165
result = subprocess.run(
164166
[
165167
"myst",

0 commit comments

Comments
 (0)