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({ export default defineConfig({
site: 'https://fuwari.vercel.app/',
base: '/',
integrations: [ integrations: [
tailwind(), tailwind(),
icon({ icon({

View File

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

View File

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

View File

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