Skip to content

Commit 5936bd8

Browse files
committed
update info
1 parent 1e010c1 commit 5936bd8

7 files changed

Lines changed: 29 additions & 17 deletions

File tree

astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { defineConfig } from 'astro/config';
22
import tailwind from '@astrojs/tailwind';
33

44
export default defineConfig({
5-
site: 'https://ivikramsahu.github.io',
5+
site: 'https://ivikramsahu.github.io/vikramsahu-blog',
6+
base: '/vikramsahu-blog',
67
trailingSlash: 'always',
78
integrations: [
89
tailwind({

src/layouts/BaseLayout.astro

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type Props = {
88
};
99
1010
const { title, description, containerClass = 'max-w-6xl' } = Astro.props;
11+
const base = import.meta.env.BASE_URL;
1112
const siteName = "Vikram's Focushours";
1213
const metaTitle = title ? `${title} | ${siteName}` : siteName;
1314
const metaDescription = description ?? 'Writing and notes.';
@@ -109,9 +110,9 @@ const metaDescription = description ?? 'Writing and notes.';
109110
})();
110111
</script>
111112

112-
<link rel="icon" href="/favicon.svg" type="image/svg+xml" sizes="any" />
113-
<link rel="shortcut icon" href="/favicon.svg" />
114-
<link rel="apple-touch-icon" href="/favicon.svg" />
113+
<link rel="icon" href={`${base}favicon.svg`} type="image/svg+xml" sizes="any" />
114+
<link rel="shortcut icon" href={`${base}favicon.svg`} />
115+
<link rel="apple-touch-icon" href={`${base}favicon.svg`} />
115116

116117
<link rel="preconnect" href="https://fonts.googleapis.com" />
117118
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@@ -121,28 +122,29 @@ const metaDescription = description ?? 'Writing and notes.';
121122
/>
122123

123124
<title>{metaTitle}</title>
125+
<style is:inline>{`:root{--base-url:${base};}`}</style>
124126
</head>
125127
<body class="min-h-screen font-sans flex flex-col bg-zinc-50 text-zinc-900 transition-colors duration-300 dark:bg-zinc-950 dark:text-zinc-50">
126128
<header class="sticky top-0 z-50 border-b border-zinc-200 bg-white/70 backdrop-blur transition-colors duration-300 dark:border-zinc-800 dark:bg-zinc-950/70">
127129
<div class={`mx-auto flex ${containerClass} flex-wrap items-center justify-between gap-4 px-4 py-4`}>
128-
<a href="/" class="flex min-w-0 items-center gap-3 no-underline">
130+
<a href={base} class="flex min-w-0 items-center gap-3 no-underline">
129131
<picture>
130-
<source srcset="/mascot.png" type="image/png" />
131-
<img src="/mascot.svg" alt="Vikram mascot" class="h-[75px] w-[75px]" />
132+
<source srcset={`${base}mascot.png`} type="image/png" />
133+
<img src={`${base}mascot.svg`} alt="Vikram mascot" class="h-[75px] w-[75px]" />
132134
</picture>
133135
<span class="truncate text-[32px] leading-none font-semibold tracking-tight text-black dark:text-zinc-50">
134136
{siteName}
135137
</span>
136138
</a>
137139
<nav class="flex shrink-0 items-center gap-4 text-sm">
138140
<a
139-
href="/"
141+
href={base}
140142
class="no-underline text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white"
141143
>
142144
Blog
143145
</a>
144146
<a
145-
href="/about/"
147+
href={`${base}about/`}
146148
class="no-underline text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white"
147149
>
148150
About

src/pages/about.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import BaseLayout from '../layouts/BaseLayout.astro';
3+
const base = import.meta.env.BASE_URL;
34
---
45

56
<BaseLayout title="About" description="About this site." containerClass="max-w-6xl">
@@ -8,7 +9,7 @@ import BaseLayout from '../layouts/BaseLayout.astro';
89

910
<div class="not-prose my-6">
1011
<img
11-
src="/about.png"
12+
src={`${base}about.png`}
1213
alt="Vikram Sahu"
1314
class="w-full rounded-2xl border border-zinc-200 shadow-sm dark:border-zinc-800"
1415
loading="lazy"

src/pages/blog/[...slug].astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
import { getCollection } from 'astro:content';
4+
const base = import.meta.env.BASE_URL;
45
56
export async function getStaticPaths() {
67
const posts = (await getCollection('blog')).filter((p) => !p.data.draft);
@@ -79,7 +80,7 @@ function renderInlineCode(input: string) {
7980
<article class="prose prose-zinc prose-lg dark:prose-invert max-w-none">
8081
<div class="not-prose mb-8 space-y-3">
8182
<a
82-
href="/"
83+
href={base}
8384
class="text-sm text-zinc-600 no-underline hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white"
8485
>
8586
← Back

src/pages/index.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import BaseLayout from '../layouts/BaseLayout.astro';
33
import { getCollection } from 'astro:content';
44
import SnakesAndLadders from '../components/SnakesAndLadders.astro';
55
import QuotesWidget from '../components/QuotesWidget.astro';
6+
const base = import.meta.env.BASE_URL;
67
78
const posts = (await getCollection('blog'))
89
.filter((p) => !p.data.draft)
@@ -79,7 +80,7 @@ function renderInlineCode(input: string) {
7980

8081
return (
8182
<a
82-
href={`/blog/${post.slug}/`}
83+
href={`${base}blog/${post.slug}/`}
8384
class="block p-[30px] no-underline hover:bg-zinc-50 dark:hover:bg-zinc-800"
8485
>
8586
<div class="space-y-4">
@@ -161,7 +162,7 @@ function renderInlineCode(input: string) {
161162
Prev
162163
</span>
163164
<a
164-
href="/page/2/"
165+
href={`${base}page/2/`}
165166
class="rounded-lg border border-zinc-200 px-3 py-2 text-sm text-zinc-700 no-underline hover:bg-zinc-50 dark:border-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-900"
166167
>
167168
Next

src/pages/page/[page].astro

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { getCollection } from 'astro:content';
44
import SnakesAndLadders from '../../components/SnakesAndLadders.astro';
55
import QuotesWidget from '../../components/QuotesWidget.astro';
66
7+
const base = import.meta.env.BASE_URL;
8+
79
const pageSize = 10;
810
911
export async function getStaticPaths() {
@@ -35,8 +37,12 @@ const start = (currentPage - 1) * pageSize;
3537
const pagePosts = posts.slice(start, start + pageSize);
3638
3739
const prevHref =
38-
currentPage <= 1 ? null : currentPage === 2 ? '/' : `/page/${currentPage - 1}/`;
39-
const nextHref = currentPage >= totalPages ? null : `/page/${currentPage + 1}/`;
40+
currentPage <= 1
41+
? null
42+
: currentPage === 2
43+
? base
44+
: `${base}page/${currentPage - 1}/`;
45+
const nextHref = currentPage >= totalPages ? null : `${base}page/${currentPage + 1}/`;
4046
4147
function estimateReadTimeMinutes(text: string) {
4248
const words = text.split(/\s+/).filter(Boolean).length;
@@ -104,7 +110,7 @@ function renderInlineCode(input: string) {
104110

105111
return (
106112
<a
107-
href={`/blog/${post.slug}/`}
113+
href={`${base}blog/${post.slug}/`}
108114
class="block p-[30px] no-underline hover:bg-zinc-50 dark:hover:bg-zinc-800"
109115
>
110116
<div class="space-y-4">

src/styles/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
@font-face {
66
font-family: 'Agave';
7-
src: url('/font/Agave-Regular.ttf') format('truetype');
7+
src: url('/vikramsahu-blog/font/Agave-Regular.ttf') format('truetype');
88
font-weight: 400;
99
font-style: normal;
1010
font-display: swap;

0 commit comments

Comments
 (0)