-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
66 lines (62 loc) · 1.74 KB
/
astro.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { defineConfig, passthroughImageService } from "astro/config"
import mdx from "@astrojs/mdx"
import sitemap from "@astrojs/sitemap"
import AutoImport from "astro-auto-import"
import tailwind from "@astrojs/tailwind"
import react from "@astrojs/react"
import icon from "astro-icon"
import pagefind from "astro-pagefind"
console.log(`process.env.CF_PAGES: ${process.env.CF_PAGES}`)
console.log(`process.env.CF_PAGES_BRANCH: ${process.env.CF_PAGES_BRANCH}`)
// ローカル開発時は画像サービスをパススルー
const imageServiceConfig =
process.env.CF_PAGES === "1" && process.env.CF_PAGES_BRANCH === "master"
? {
entrypoint: "./src/entrypoint/cfImageService",
config: {
maxWidth: 800
}
}
: passthroughImageService()
// プロダクションブランチのみ固定のURLをsiteに設定する
const siteUrl =
process.env.CF_PAGES_BRANCH === "master"
? "https://blog.gensobunya.net/"
: (process.env.CF_PAGES_URL ?? "https://blog.gensobunya.net/")
// https://astro.build/config
export default defineConfig({
site: siteUrl,
image: {
service: imageServiceConfig
},
integrations: [
AutoImport({
imports: [
"./src/components/mdx/LinkCard.astro",
"./src/components/mdx/Amzn.astro",
"./src/components/mdx/SimpleLinkCard.astro",
{
"./src/components/mdx/positive.tsx": ["PositiveBox"],
"./src/components/mdx/negative.tsx": ["NegativeBox"]
}
]
}),
mdx(),
sitemap(),
tailwind(),
react(),
icon({
include: {
mdi: [
"calendar",
"twitter",
"instagram",
"youtube",
"web",
"open-in-new"
]
}
}),
pagefind()
]
})