-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d1b468
commit 4eaef3d
Showing
1 changed file
with
21 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { defineConfig } from "vitepress"; | ||
import { defineConfig, type HeadConfig } from "vitepress"; | ||
import { transformerTwoslash } from "@shikijs/vitepress-twoslash"; | ||
import { Sidebar } from "../../utils/utils"; | ||
|
||
|
@@ -22,22 +22,32 @@ export const shared = defineConfig({ | |
}, | ||
}, | ||
|
||
head: [ | ||
head: [...googleFonts(), ...googleAnalytics("G-LWNNLXVF0K")], | ||
}); | ||
|
||
function googleAnalytics(tagManagerId: string): HeadConfig[] { | ||
return [ | ||
["script", { async: "", src: `https://www.googletagmanager.com/gtag/js?id=${tagManagerId}` }], | ||
[ | ||
"script", | ||
{}, | ||
`window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '${tagManagerId}');`, | ||
], | ||
]; | ||
} | ||
|
||
function googleFonts(): HeadConfig[] { | ||
return [ | ||
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }], | ||
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }], | ||
[ | ||
"link", | ||
{ href: "https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:[email protected]&display=swap", rel: "stylesheet" }, | ||
], | ||
], | ||
}); | ||
|
||
interface SidebarOptions { | ||
isCollapsed?: boolean; | ||
/** | ||
* @default '' (Means en for English) | ||
*/ | ||
locale?: string; | ||
]; | ||
} | ||
|
||
export const baseSidebar = new Sidebar({ | ||
|