Skip to content

Commit 61c069f

Browse files
committed
deploy to github pages
1 parent 4ddc319 commit 61c069f

File tree

6 files changed

+73
-21
lines changed

6 files changed

+73
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
# Using a different branch name? Replace `main` with your branch’s name
6+
push:
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
# Allow this job to clone the repo and create a page deployment
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout your repository using git
22+
uses: actions/checkout@v4
23+
- name: Install, build, and upload your site
24+
uses: withastro/action@v3
25+
# with:
26+
# path: . # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
29+
30+
deploy:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v4

astro.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export default defineConfig({
1111
vite: {
1212
plugins: [tailwindcss()]
1313
},
14-
14+
site: 'https://saezlab.github.io',
15+
base: '/saezlab.org-new',
16+
trailingSlash: 'always',
1517
integrations: [react(), mdx()]
1618
});

src/components/MobileNav.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from 'react';
22
import { Menu } from 'lucide-react';
3+
import { getInternalLink } from '../lib/utils';
34

45
export default function MobileNav() {
56
const [isOpen, setIsOpen] = useState(false);
@@ -19,43 +20,43 @@ export default function MobileNav() {
1920
<div className="relative z-20 grid gap-6 rounded-md bg-popover p-4 text-popover-foreground shadow-md">
2021
<nav className="grid grid-flow-row auto-rows-max text-sm">
2122
<a
22-
href="/research"
23+
href={getInternalLink('/research')}
2324
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
2425
>
2526
Research
2627
</a>
2728
<a
28-
href="/publications"
29+
href={getInternalLink('/publications')}
2930
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
3031
>
3132
Publications
3233
</a>
3334
<a
34-
href="/team"
35+
href={getInternalLink('/team')}
3536
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
3637
>
3738
Team
3839
</a>
3940
<a
40-
href="/software"
41+
href={getInternalLink('/software')}
4142
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
4243
>
4344
Software
4445
</a>
4546
<a
46-
href="/partners"
47+
href={getInternalLink('/partners')}
4748
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
4849
>
4950
Partners & Funding
5051
</a>
5152
<a
52-
href="/jobs"
53+
href={getInternalLink('/jobs')}
5354
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
5455
>
5556
Jobs
5657
</a>
5758
<a
58-
href="/contact"
59+
href={getInternalLink('/contact')}
5960
className="flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline"
6061
>
6162
Contact

src/components/NewsCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Calendar } from 'lucide-react';
2+
import { getInternalLink } from '../lib/utils';
23

34
interface NewsCardProps {
45
title: string;
@@ -25,7 +26,7 @@ export default function NewsCard({
2526
<time dateTime={date}>{new Date(date).toLocaleDateString()}</time>
2627
</div>
2728
<h2 className="text-2xl font-bold">
28-
<a href={`/news/${slug}`} className="hover:underline">
29+
<a href={getInternalLink(`/news/${slug}`)} className="hover:underline">
2930
{title}
3031
</a>
3132
</h2>
@@ -34,15 +35,15 @@ export default function NewsCard({
3435
{image && (
3536
<div className="relative aspect-video overflow-hidden rounded-lg">
3637
<img
37-
src={image}
38+
src={getInternalLink(image)}
3839
alt={title}
3940
className="h-full w-full object-cover"
4041
/>
4142
</div>
4243
)}
4344
<p className="flex-1">{excerpt}</p>
4445
<a
45-
href={`/news/${slug}`}
46+
href={getInternalLink(`/news/${slug}`)}
4647
className="inline-flex items-center text-sm font-medium text-primary hover:underline"
4748
>
4849
Read more

src/layouts/Layout.astro

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { ClientRouter } from 'astro:transitions';
33
import '../styles/global.css';
44
import MobileNav from '../components/MobileNav.tsx';
5+
import { getInternalLink } from '../lib/utils';
56
67
type Props = {
78
title: string;
@@ -16,40 +17,40 @@ const { title } = Astro.props;
1617
<meta charset="UTF-8" />
1718
<meta name="description" content="Saez Lab - Systems Biology and Bioinformatics Research" />
1819
<meta name="viewport" content="width=device-width" />
19-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
20+
<link rel="icon" type="image/svg+xml" href={getInternalLink('/favicon.svg')} />
2021
<meta name="generator" content={Astro.generator} />
2122
<title>{title} | Saez Lab</title>
2223
<ClientRouter />
2324
</head>
2425
<body class="min-h-screen bg-background font-sans antialiased">
2526
<div class="relative flex min-h-screen flex-col">
2627
<header class="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
27-
<div class="container mx-auto px-4 flex items-center justify-between h-16">
28-
<a class="flex items-center space-x-2" href="/">
28+
<div class="container flex h-16 items-center space-x-4 sm:justify-between sm:space-x-0">
29+
<a class="flex items-center space-x-2" href={getInternalLink('/')}>
2930
<span class="font-bold">
3031
Saez Lab
3132
</span>
3233
</a>
3334
<nav class="hidden items-center space-x-6 text-sm font-medium md:flex">
34-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/research">
35+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/research')}>
3536
Research
3637
</a>
37-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/publications">
38+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/publications')}>
3839
Publications
3940
</a>
40-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/team">
41+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/team')}>
4142
Team
4243
</a>
43-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/software">
44+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/software')}>
4445
Software
4546
</a>
46-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/partners">
47+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/partners')}>
4748
Partners
4849
</a>
49-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/jobs">
50+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/jobs')}>
5051
Jobs
5152
</a>
52-
<a class="transition-colors hover:text-foreground/80 text-foreground" href="/contact">
53+
<a class="transition-colors hover:text-foreground/80 text-foreground" href={getInternalLink('/contact')}>
5354
Contact
5455
</a>
5556
</nav>

src/lib/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ import { twMerge } from "tailwind-merge"
44
export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs))
66
}
7+
8+
export const BASE_PATH = '/saezlab.org-new';
9+
10+
export function getInternalLink(path: string): string {
11+
// Remove leading slash if present
12+
const cleanPath = path.startsWith('/') ? path.slice(1) : path;
13+
return `${BASE_PATH}/${cleanPath}`;
14+
}

0 commit comments

Comments
 (0)