mirror of
https://github.com/wavetermdev/docusaurus-og.git
synced 2026-08-05 13:46:35 -07:00
allow partial overriding of the theme config.
This commit is contained in:
@@ -8,6 +8,7 @@ import { themeConfigs } from './theme-config/index'
|
||||
import { PluginOptions, ThemeNames } from './types'
|
||||
import { createCommonDataDir, createTeamFile } from './utils/data.utils'
|
||||
import { findDocInstances, validateDocPluginOptions } from './utils/docs.utils'
|
||||
import { defaultsDeep } from './utils/object.utils'
|
||||
|
||||
const makeSearchPluginConfig = (
|
||||
plugins: PluginConfig[],
|
||||
@@ -53,7 +54,10 @@ export default function logosPreset(
|
||||
siteConfigs[options.businessUnit],
|
||||
)
|
||||
|
||||
context.siteConfig.themeConfig = themeConfigs[options.businessUnit]
|
||||
context.siteConfig.themeConfig = defaultsDeep(
|
||||
[{}, context.siteConfig.themeConfig, themeConfigs[options.businessUnit]],
|
||||
false,
|
||||
)
|
||||
|
||||
createCommonDataDir()
|
||||
createTeamFile(context, options)
|
||||
|
||||
@@ -9,16 +9,7 @@ export const wakuThemeConfig: typeof baseThemeConfig = {
|
||||
src: 'theme/image/logo.svg',
|
||||
height: 26,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
to: 'blog',
|
||||
label: 'Blog',
|
||||
},
|
||||
{
|
||||
type: 'localeDropdown',
|
||||
position: 'right',
|
||||
},
|
||||
],
|
||||
items: [],
|
||||
},
|
||||
metadata: [
|
||||
{ name: 'keywords', content: 'waku, web3' },
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
export type ThemeConfig = {}
|
||||
import { NavbarItem } from '@docusaurus/theme-common'
|
||||
|
||||
export type ThemeConfig = {
|
||||
navbar?: {
|
||||
items?: NavbarItem[]
|
||||
}
|
||||
}
|
||||
|
||||
export type { PluginOptions as DefaultThemeOptions } from '@acid-info/logos-docusaurus-theme/src'
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as _ from 'lodash'
|
||||
|
||||
export const defaultsDeep = (objects: any[], mergeArrays: boolean = false) => {
|
||||
if (mergeArrays) return _.defaultsDeep(...(objects as [any, any]))
|
||||
|
||||
let output = {}
|
||||
|
||||
objects.reverse().forEach((item) => {
|
||||
_.mergeWith(output, item, (objectValue, sourceValue) => {
|
||||
return Array.isArray(sourceValue) ? sourceValue : undefined
|
||||
})
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
Reference in New Issue
Block a user