fix: site url and base dir should be set in astro.config.mjs

This commit is contained in:
saicaca 2023-11-08 19:03:35 +08:00
parent d918a2ef3d
commit b0d265b42b
4 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,8 @@ const oklchToHex = function (str) {
}
export default defineConfig({
site: 'https://fuwari.vercel.app/',
base: '/',
integrations: [
tailwind(),
icon({

View File

@ -4,7 +4,6 @@ import {LinkPreset} from "./types/config.ts";
export const siteConfig: SiteConfig = {
title: 'Fuwari',
subtitle: 'Demo Site',
url: 'https://fuwari.vercel.app/',
lang: 'en',
themeHue: 250,
banner: {

View File

@ -1,7 +1,6 @@
export type SiteConfig = {
title: string,
subtitle: string,
url: string,
lang: string,

View File

@ -1,4 +1,5 @@
import {siteConfig} from "../config.ts";
import astroConfig from "../../astro.config.mjs"
export function pathsEqual(path1: string, path2: string) {
const normalizedPath1 = path1.replace(/^\/|\/$/g, '').toLowerCase();
@ -24,5 +25,5 @@ export function getCategoryUrl(category: string): string | null {
}
export function getFullUrl(path: string): string {
return joinUrl(siteConfig.url, path);
return joinUrl(astroConfig.site || "", astroConfig.base || "", path);
}