Skip to content

Commit

Permalink
doc(book): add additional metadata to each page
Browse files Browse the repository at this point in the history
Apply a few metadata improvements reported in Lighthouse, as well as
increasing the information for OpenGraph display.

This allows for a richer link display on several platforms when shared.
  • Loading branch information
dnaka91 committed Jan 8, 2024
1 parent b51681f commit 601ac4c
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions book/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,30 @@ export default defineConfig({
preserveSymlinks: true,
},
},
head: [["link", { rel: "icon", type: "image/svg+xml", href: "/mabo/logo.svg" }]],
head: [
["link", { rel: "icon", type: "image/svg+xml", href: "/mabo/logo.svg" }],
["meta", { name: "color-scheme", content: "dark light" }],
["meta", { name: "theme-color", content: "#d95a00" }],
["meta", { name: "og:type", content: "website" }],
["meta", { name: "og:locale", content: "en" }],
["meta", { name: "og:site_name", content: "Mabo" }],
],
transformPageData(pageData, ctx) {
pageData.frontmatter.head ??= [];
pageData.frontmatter.head.push([
"meta",
{
name: "og:title",
content:
pageData.frontmatter.layout === "home"
? ctx.siteConfig.site.title
: `${pageData.title} | ${ctx.siteConfig.site.title}`,
},
]);
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: "/logo.svg",
logo: { src: "/logo.svg", width: 24, height: 24 },
editLink: {
pattern: "https://github.com/dnaka91/mabo/edit/main/book/src/:path",
text: "Edit this page on GitHub",
Expand Down

0 comments on commit 601ac4c

Please sign in to comment.