feat: add base path

This commit is contained in:
log101 2024-05-13 10:28:52 +03:00
parent c67bab514b
commit 5da44976cd
3 changed files with 12 additions and 10 deletions

View File

@ -2,5 +2,7 @@ import { defineConfig } from "astro/config";
// https://astro.build/config
export default defineConfig({
site: "https://log101.dev",
base: "/blog",
integrations: [],
});

View File

@ -1,7 +1,5 @@
---
console.log(import.meta.env.DEV);
const host = import.meta.env.HOST_NAME;
const base = import.meta.env.BASE_URL;
---
<style>
@ -89,7 +87,7 @@ const host = import.meta.env.HOST_NAME;
<div class="title-and-nav">
<div class="title-and-gol">
<a href={host}><h1 class="main-title">log101</h1></a>
<a href={base}><h1 class="main-title">log101</h1></a>
<div id="board" class="board"></div>
</div>
<div>
@ -98,16 +96,16 @@ const host = import.meta.env.HOST_NAME;
(
<>
<li>
<a href={`/category/fikir`}>Fikir</a>
<a href={`${base}/category/fikir`}>Fikir</a>
</li>
<li>
<a href={`/category/teknik`}>Teknik</a>
<a href={`${base}/category/teknik`}>Teknik</a>
</li>
<li>
<a href={`/category/edebiyat`}>Babür'ün Serüvenleri</a>
<a href={`${base}/category/edebiyat`}>Babür'ün Serüvenleri</a>
</li>
<li>
<a href={`/category/ansiklopedi`}>Ansiklopedi</a>
<a href={`${base}/category/ansiklopedi`}>Ansiklopedi</a>
</li>
</>
)

View File

@ -33,7 +33,9 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
year: "numeric",
});
const postLink = `/category/${post.data.category}/${post.slug}`;
const base = import.meta.env.BASE_URL;
const postLink = `${base}/category/${post.data.category}/${post.slug}`;
const { Content } = await post.render();
---
@ -178,7 +180,7 @@ const { Content } = await post.render();
{post.body.length > 500 && (
<a
class="read-more"
href={`/category/${post.data.category}/${post.slug}`}
href={`${base}/category/${post.data.category}/${post.slug}`}
>
Devamını Oku
</a>