Skip to content

Commit

Permalink
Merge ac5a341 into a33ca46
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Apr 15, 2024
2 parents a33ca46 + ac5a341 commit cb77b0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/client/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ export const resolvers = reactive({
* It would merge the locales fields to the root fields
*/
resolveSiteLocaleData: (
siteData: SiteData,
{ base, locales, ...siteData }: SiteData,
routeLocale: RouteLocale,
): SiteLocaleData => ({
...siteData,
...siteData.locales[routeLocale],
...locales[routeLocale],
head: [
// when merging head, the locales head should be placed before root head
// to get higher priority
...(siteData.locales[routeLocale]?.head ?? []),
...(locales[routeLocale]?.head ?? []),
...(siteData.head ?? []),
],
}),
Expand Down
11 changes: 9 additions & 2 deletions packages/client/src/types/clientData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
PageFrontmatter,
PageHeader,
SiteData,
SiteLocaleData,
} from '@vuepress/shared'
import type { Component, ComputedRef, Ref } from 'vue'
import type {
Expand All @@ -12,7 +13,14 @@ import type {
} from '../constants.js'
import type { Redirects, Routes } from './routes.js'

export type { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData }
export type {
HeadConfig,
PageData,
PageFrontmatter,
PageHeader,
SiteData,
SiteLocaleData,
}

export interface Layouts {
[LAYOUT_NAME_DEFAULT]: Component
Expand All @@ -26,7 +34,6 @@ export type PageLang = string
export type PageLayout = Component
export type RoutePath = string
export type RouteLocale = string
export type SiteLocaleData = SiteData

export type LayoutsRef = ComputedRef<Layouts>
export type PageComponentRef = ComputedRef<PageComponent>
Expand Down

0 comments on commit cb77b0d

Please sign in to comment.