pull/588/head
Georges Gomes 4 years ago
parent 507287fff2
commit 78ff8d240f

@ -5,16 +5,16 @@ export default defineConfig({
title: 'VitePress', title: 'VitePress',
description: 'Vite & Vue powered static site generator.', description: 'Vite & Vue powered static site generator.',
lastUpdated: true, lastUpdated: true,
head: ()=>[ head: () => [
['meta', { name: 'author', content: 'divRIOTS' }], ['meta', { name: 'author', content: 'divRIOTS' }],
[ [
'meta', 'meta',
{ {
name: 'keywords', name: 'keywords',
content: content:
'designsystems, design-systems, react, vue, svelte, angular, webcomponent, webcomponents, web-component, web-components', 'designsystems, design-systems, react, vue, svelte, angular, webcomponent, webcomponents, web-component, web-components'
}, }
], ]
], ],
//cleanUrls: true, //cleanUrls: true,

@ -98,7 +98,7 @@ export async function renderPage(
? `${pageData.title} | ${siteData.title}` ? `${pageData.title} | ${siteData.title}`
: siteData.title : siteData.title
const head = processHead(siteData.head, pageData); const head = processHead(siteData.head, pageData)
let inlinedScript = '' let inlinedScript = ''
if (config.mpa && result) { if (config.mpa && result) {

@ -1,4 +1,9 @@
import { HeadConfig, LocaleConfig, SiteData, PageData } from '../../types/shared' import {
HeadConfig,
LocaleConfig,
SiteData,
PageData
} from '../../types/shared'
export type { export type {
SiteData, SiteData,
@ -99,6 +104,9 @@ function cleanRoute(siteData: SiteData, route: string): string {
/** /**
* Process `head` configuration. * Process `head` configuration.
*/ */
export function processHead(head: HeadConfig[] | ((pageData: PageData) => HeadConfig[]), pageData: PageData) : HeadConfig[] { export function processHead(
return !head ? [] : typeof head === 'function' ? head(pageData) : head; head: HeadConfig[] | ((pageData: PageData) => HeadConfig[]),
pageData: PageData
): HeadConfig[] {
return !head ? [] : typeof head === 'function' ? head(pageData) : head
} }

2
types/shared.d.ts vendored

@ -20,7 +20,7 @@ export interface SiteData<ThemeConfig = any> {
lang: string lang: string
title: string title: string
description: string description: string
head: HeadConfig[] | ( (pageData: PageData) => HeadConfig[]) head: HeadConfig[] | ((pageData: PageData) => HeadConfig[])
themeConfig: ThemeConfig themeConfig: ThemeConfig
scrollOffset: number | string scrollOffset: number | string
locales: Record<string, LocaleConfig> locales: Record<string, LocaleConfig>

Loading…
Cancel
Save