Skip to content

feat: Update OG title and description from pagedata #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vitepress/shared.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from "vitepress";
import { defineConfig, HeadConfig } from "vitepress";
import { search as koSearch } from "./ko.mts";

export const shared = defineConfig({
Expand Down Expand Up @@ -28,6 +28,17 @@ export const shared = defineConfig({
]
],

transformHead: ({ pageData }) => {
const head: HeadConfig[] = [];
const title = pageData.frontmatter.title || 'Frontend Fundamentals';
const description = pageData.frontmatter.description || 'Guidelines for easily modifiable frontend code';

head.push(['meta', { property: 'og:title', content: title }]);
head.push(['meta', { property: 'og:description', content: description }]);

return head;
},

themeConfig: {
logo: "/images/ff-symbol.svg",

Expand Down