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

@ -5,16 +5,16 @@ export default defineConfig({
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
lastUpdated: true,
head: ()=>[
head: () => [
['meta', { name: 'author', content: 'divRIOTS' }],
[
'meta',
{
name: 'keywords',
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,

@ -98,7 +98,7 @@ export async function renderPage(
? `${pageData.title} | ${siteData.title}`
: siteData.title
const head = processHead(siteData.head, pageData);
const head = processHead(siteData.head, pageData)
let inlinedScript = ''
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 {
SiteData,
@ -97,8 +102,11 @@ function cleanRoute(siteData: SiteData, route: string): string {
}
/**
* Process `head` configuration.
* Process `head` configuration.
*/
export function processHead(head: HeadConfig[] | ((pageData: PageData) => HeadConfig[]), pageData: PageData) : HeadConfig[] {
return !head ? [] : typeof head === 'function' ? head(pageData) : head;
export function processHead(
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
title: string
description: string
head: HeadConfig[] | ( (pageData: PageData) => HeadConfig[])
head: HeadConfig[] | ((pageData: PageData) => HeadConfig[])
themeConfig: ThemeConfig
scrollOffset: number | string
locales: Record<string, LocaleConfig>

Loading…
Cancel
Save