Skip to content

Commit b9cd15c

Browse files
brabojclaude
andcommitted
fix: add base path for GitHub Pages deployment
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0007c4d commit b9cd15c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

astro-site/astro.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { defineConfig } from 'astro/config';
33

44
// https://astro.build/config
55
export default defineConfig({
6+
site: 'https://braboj.github.io',
7+
base: '/tutorial-git/',
68
trailingSlash: 'always',
79
markdown: {
810
syntaxHighlight: false,

astro-site/src/components/Header.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
import site from "../data/site.json";
33
const { currentPath = "/" } = Astro.props;
4+
const base = import.meta.env.BASE_URL;
45
---
56

67
<div class="site-header-bar">
78
<header class="site-header">
8-
<a href="/" class="site-header-title">
9+
<a href={base} class="site-header-title">
910
<svg class="site-header-icon" viewBox="0 0 92 92" width="22" height="22" fill="currentColor" aria-hidden="true">
1011
<path d="M90.156 41.965 50.036 1.848a5.913 5.913 0 0 0-8.368 0l-8.332 8.332 10.566 10.566a7.03 7.03 0 0 1 7.23 1.684 7.043 7.043 0 0 1 1.673 7.277l10.183 10.184a7.026 7.026 0 0 1 7.278 1.672 7.04 7.04 0 0 1 0 9.957 7.045 7.045 0 0 1-9.961 0 7.038 7.038 0 0 1-1.532-7.66l-9.5-9.497V59.36a7.04 7.04 0 0 1 1.86 11.29 7.04 7.04 0 0 1-9.957 0 7.04 7.04 0 0 1 0-9.958 7.06 7.06 0 0 1 2.304-1.539V35.71a7.04 7.04 0 0 1-3.82-9.234L29.242 16.07 1.73 43.583a5.918 5.918 0 0 0 0 8.37l40.121 40.118a5.916 5.916 0 0 0 8.369 0l39.936-39.934a5.925 5.925 0 0 0 0-8.372"/>
1112
</svg>
@@ -32,13 +33,13 @@ const { currentPath = "/" } = Astro.props;
3233
<div class="site-tabs-bar">
3334
<nav class="site-tabs" aria-label="Main navigation">
3435
{site.tabs.map((tab) => {
35-
// Match by section prefix: /operations/help/ highlights for any /operations/* path
3636
const tabSection = tab.href.split("/").filter(Boolean)[0];
3737
const currentSection = currentPath.split("/").filter(Boolean)[0];
3838
const isActive = tab.href === "/" ? currentPath === "/" : tabSection === currentSection;
39+
const href = tab.href === "/" ? base : `${base}${tab.href.slice(1)}`;
3940
return (
4041
<a
41-
href={tab.href}
42+
href={href}
4243
class:list={[{ active: isActive }]}
4344
aria-current={isActive ? "page" : undefined}
4445
>

0 commit comments

Comments
 (0)