Skip to content

Commit 83559d9

Browse files
committed
chore(docs): add VitePress site config
1 parent ffb8d62 commit 83559d9

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

docs/.vitepress/config.js

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { defineConfig } from "vitepress";
2+
import {
3+
groupIconMdPlugin,
4+
localIconLoader,
5+
groupIconVitePlugin,
6+
} from "vitepress-plugin-group-icons";
7+
8+
const repoUrl = "https://github.com/BlueLua";
9+
const siteOrigin = "https://BlueLua.github.io";
10+
const siteBasePath = "/";
11+
const siteUrl = `${siteOrigin}${siteBasePath}`;
12+
const assetBasePath = process.argv.includes("dev") ? "/" : siteBasePath;
13+
const siteTitle = "BlueLua";
14+
const siteDescription = "Pure standalone Lua modules.";
15+
const siteImage = `${siteUrl}og.svg`;
16+
const siteImageAlt = "BlueLua documentations";
17+
const groupIcons = Object.fromEntries(
18+
[".lua", "luarocks"].map((iconName) => [
19+
iconName,
20+
localIconLoader(
21+
import.meta.url,
22+
`../src/assets/${iconName.replace(/^\./, "")}.svg`,
23+
),
24+
]),
25+
);
26+
const websiteJsonLd = {
27+
"@context": "https://schema.org",
28+
"@type": "WebSite",
29+
name: siteTitle,
30+
url: siteUrl,
31+
description: siteDescription,
32+
};
33+
34+
export default defineConfig({
35+
srcDir: "./src",
36+
title: "BlueLua",
37+
description: "Centralized docs for BlueLua",
38+
base: siteBasePath,
39+
appearance: true,
40+
markdown: {
41+
config(md) {
42+
md.use(groupIconMdPlugin);
43+
},
44+
},
45+
vite: {
46+
plugins: [groupIconVitePlugin({ customIcon: groupIcons })],
47+
},
48+
// prettier-ignore
49+
head: [
50+
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }],
51+
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }],
52+
["link", { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&display=swap" }],
53+
["link", { rel: "icon", type: "image/svg+xml", href: `${assetBasePath}logo.svg` }],
54+
["link", { rel: "icon", type: "image/png", sizes: "512x512", href: `${assetBasePath}logo.png` }],
55+
["meta", { property: "og:type", content: "website" }],
56+
["meta", { property: "og:site_name", content: siteTitle }],
57+
["meta", { property: "og:title", content: siteTitle }],
58+
["meta", { property: "og:description", content: siteDescription }],
59+
["meta", { property: "og:locale", content: "en_US" }],
60+
["meta", { property: "og:url", content: siteUrl }],
61+
["meta", { property: "og:image", content: siteImage }],
62+
["meta", { property: "og:image:alt", content: siteImageAlt }],
63+
["meta", { name: "twitter:card", content: "summary_large_image" }],
64+
["meta", { name: "twitter:title", content: siteTitle }],
65+
["meta", { name: "twitter:description", content: siteDescription }],
66+
["meta", { name: "twitter:url", content: siteUrl }],
67+
["meta", { name: "twitter:image", content: siteImage }],
68+
["meta", { name: "twitter:image:alt", content: siteImageAlt }],
69+
["meta", { name: "robots", content: "index,follow" }],
70+
["link", { rel: "canonical", href: siteUrl }],
71+
["script", { type: "application/ld+json" }, JSON.stringify(websiteJsonLd)],
72+
],
73+
themeConfig: {
74+
logo: "/logo.svg",
75+
outline: [2, 5], // show h2-h5
76+
search: { provider: "local" },
77+
socialLinks: [{ icon: "github", link: repoUrl }],
78+
nav: [
79+
{ text: "Home", link: "/" },
80+
{
81+
text: "Projects",
82+
items: [
83+
{ text: "evdev", link: "evdev" },
84+
{ text: "timeutil", link: "timeutil" },
85+
{ text: "tty", link: "tty" },
86+
],
87+
},
88+
{ text: "GitHub", link: "https://github.com/BlueLua" },
89+
{
90+
text: "🇵🇸 Free Palestine",
91+
link: "https://techforpalestine.org/learn-more",
92+
},
93+
],
94+
},
95+
});

0 commit comments

Comments
 (0)