-
Notifications
You must be signed in to change notification settings - Fork 0
/
_config.ts
98 lines (90 loc) · 2.45 KB
/
_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import lume from "lume/mod.ts"
import highlight from "lume/plugins/code_highlight.ts"
import jsx from "lume/plugins/jsx.ts"
import mdx from "lume/plugins/mdx.ts"
import metas from "lume/plugins/metas.ts"
import multilanguage from "lume/plugins/multilanguage.ts"
import postcss from "lume/plugins/postcss.ts"
import redirects from "lume/plugins/redirects.ts"
import robots from "lume/plugins/robots.ts"
import sitemap from "lume/plugins/sitemap.ts"
import tailwindcss from "lume/plugins/tailwindcss.ts"
import transformImages from "lume/plugins/transform_images.ts"
import typography from "@tailwindcss/typography"
const site = lume({
dest: "./public",
src: "./src",
location: new URL("https://akimo.dev"),
})
site.copy("icon")
site.use(highlight({
theme: {
name: "atom-one-dark",
path: "/code_highlight.css",
},
}))
site.copy("/code_highlight.css")
site.use(jsx())
site.use(mdx())
site.use(metas())
site.use(redirects())
site.use(tailwindcss({
options: {
plugins: [typography],
theme: {
fontFamily: {
sans: ["Atkinson Hyperlegible", "sans-serif"],
mono: ["monospace"],
},
extend: {
content: {
"open-in-new": "url('/icon/open_in_new_16dp_2563EB.svg')",
"open-in-new-gray": "url('/icon/open_in_new_16dp_6B7280.svg')",
},
typography: (theme: (s: string) => string) => ({
DEFAULT: {
css: {
"code:not(pre > code)": {
backgroundColor: theme("colors.gray.100"),
borderRadius: "0.25rem",
margin: "0.125rem",
padding: "0.125rem 0.25rem",
},
},
},
}),
},
},
},
}))
site.use(postcss())
site.use(robots({
rules: [
{
userAgent: "*",
disallow: "/external/",
},
],
}))
site.use(transformImages({
extensions: [".jpg", ".jpeg", ".png", ".webp", ".gif"],
}))
site.use(multilanguage({
defaultLanguage: "ja",
languages: ["ja", "en"],
}))
site.use(sitemap({
query: "externalUrl=undefined",
}))
interface Token {
attrGet: (name: string) => string
}
site.hooks.addMarkdownItRule("link_open", (tokens: Token[], idx: number) => {
const href = tokens[idx].attrGet("href")
const isExternal = href.startsWith("http")
const additionalAttributes = isExternal
? `target="_blank" rel="noopener noreferrer" class="after:content-open-in-new"`
: ""
return `<a href=${href} ${additionalAttributes}>`
})
export default site