Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion astro.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const locales = {
fr: { label: 'Français', lang: 'fr' },
// it: { label: 'Italiano', lang: 'it' },
// id: { label: 'Bahasa Indonesia', lang: 'id' },
// 'zh-cn': { label: '简体中文', lang: 'zh-CN' },
'zh-cn': { label: '简体中文', lang: 'zh-CN' },
// 'pt-br': { label: 'Português do Brasil', lang: 'pt-BR' },
// 'pt-pt': { label: 'Português', lang: 'pt-PT' },
ko: { label: '한국어', lang: 'ko' },
Expand Down
14 changes: 7 additions & 7 deletions lunaria.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ export default defineConfig({
// tag: 'id',
// },
// },
// {
// label: '简体中文',
// lang: 'zh-cn',
// parameters: {
// tag: 'zh-CN',
// },
// },
{
label: '简体中文',
lang: 'zh-cn',
parameters: {
tag: 'zh-CN',
},
},
Comment thread
Adammatthiesen marked this conversation as resolved.
// {
// label: 'Português do Brasil',
// lang: 'pt-br',
Expand Down
227 changes: 227 additions & 0 deletions src/content/docs/zh-cn/config-reference/dashboard.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
---
i18nReady: true
title: "仪表板配置"
description: "StudioCMSOptions dashboardConfig 参考文档"
sidebar:
order: 6
---

import ReadMore from '~/components/ReadMore.astro';

StudioCMS 集成配置选项架构参考

```ts twoslash title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
dashboardEnabled: true,
dashboardRouteOverride: 'dashboard',
developerConfig: {},
faviconURL: '/favicon.svg',
inject404Route: true,
versionCheck: true,
AuthConfig: {},
},
});
```

## `dashboardEnabled`

`dashboardEnabled` 是用于确定是否启用仪表板的布尔值。

- **类型:** `boolean`
- **默认值:** `true`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
dashboardEnabled: true, // 默认值 - 启用仪表板
}
})
```

## `DashboardRouteOverride`

`DashboardRouteOverride` 是用于设置仪表板路由路径的字符串。

- **类型:** `string`
- **默认值:** `'dashboard'`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
dashboardRouteOverride: 'dashboard', // 默认值 - 设置仪表板路由为 /dashboard
}
})
```

## `developerConfig`

`developerConfig` 是用于配置仪表板开发者设置的对象。

### 用法示例

```ts twoslash {3-5} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
developerConfig: {
demoMode: false, // 默认值 - 禁用演示模式
},
}
})
```

## `faviconURL`

`faviconURL` 是用于设置仪表板网站图标的路径字符串。

- **类型:** `string`
- **默认值:** `'/favicon.svg'`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
faviconURL: '/favicon.svg', // 默认值 - 设置仪表板网站图标
}
})
```

## `inject404Route`

`inject404Route` 是用于确定是否注入404路由的布尔值。

- **类型:** `boolean`
- **默认值:** `true`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
inject404Route: true, // 默认值 - 注入404路由
}
})
```

## `versionCheck`

`versionCheck` 是用于确定是否启用版本检查的布尔值。

- **类型:** `boolean`
- **默认值:** `true`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
versionCheck: true, // 默认值 - 启用版本检查
}
})
```

## `AuthConfig`

`AuthConfig` 是用于配置仪表板认证设置的对象。

### 用法示例

```ts twoslash {3-5} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
AuthConfig: {
enabled: true, // 默认值 - 启用认证功能
},
}
})
```

### `providers`

`providers` 是用于配置仪表板认证提供商的对象。

- **类型:** [`AuthProviders`](#authprovider)
- **默认值:** `{}`

#### 用法示例

```ts twoslash {4-11} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
AuthConfig: {
providers: {
google: true,
github: true,
discord: true,
auth0: true,
usernameAndPassword: true,
usernameAndPasswordConfig: {},
},
},
},
})
```

#### `usernameAndPasswordConfig`

`usernameAndPasswordConfig` 是用于配置用户名密码认证设置的对象。

- **类型:** `{ allowUserRegistration?: boolean }`
- **默认值:** `{}`

##### 用法示例

```ts twoslash {5-8} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
dashboardConfig: {
AuthConfig: {
providers: {
usernameAndPassword: true,
usernameAndPasswordConfig: {
allowUserRegistration: true, // 默认值 - 允许用户注册
},
},
},
},
})
```

###### `AuthProvider`

```ts
type AuthProviders: {
github?: boolean | undefined;
discord?: boolean | undefined;
google?: boolean | undefined;
auth0?: boolean | undefined;
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined
```
119 changes: 119 additions & 0 deletions src/content/docs/zh-cn/config-reference/default-frontend-config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
i18nReady: true
title: "默认前端配置"
description: "StudioCMSOptions defaultFrontEndConfig 参考文档"
sidebar:
order: 5
---

import ReadMore from '~/components/ReadMore.astro';

StudioCMS 集成配置选项架构参考

```ts twoslash title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
defaultFrontEndConfig: {
favicon: '/favicon.svg',
htmlDefaultLanguage: 'en',
htmlDefaultHead: [],
injectQuickActionsMenu: true,
},
});
```

## `favicon`

`favicon` 是用于设置网站图标路径的字符串。

- **类型:** `string`
- **默认值:** `'/favicon.svg'`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
defaultFrontEndConfig: {
favicon: '/favicon.svg', // 默认值 - 使用默认网站图标
}
})
```

## `htmlDefaultLanguage`

`htmlDefaultLanguage` 是用于设置网站默认语言的字符串。

- **类型:** `string`
- **默认值:** `'en'`

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
defaultFrontEndConfig: {
htmlDefaultLanguage: 'en', // 默认值 - 使用默认语言
}
})
```

## `htmlDefaultHead`

**类型:** [`HeadConfig[]`](#headconfig)

向网站头部区域添加自定义标签。适用于添加分析工具脚本和第三方资源。

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
defaultFrontEndConfig: {
htmlDefaultHead: [
// 示例:添加 Fathom 分析脚本
{
tag: 'script',
attrs: {
src: 'https://cdn.usefathom.com/script.js',
'data-site': 'MY-FATHOM-ID',
defer: true,
},
},
],
},
});
```

`htmlDefaultHead` 中的内容会直接转换为 HTML 元素,不会经过 Astro 的 [脚本处理](https://docs.astro.build/zh-cn/guides/client-side-scripts/#script-processing) 或 [样式处理](https://docs.astro.build/zh-cn/guides/styling/#styling-in-astro)。

#### `HeadConfig`

```ts
interface HeadConfig {
tag: string; // HTML标签名
attrs?: Record<string, string | boolean | undefined>; // 标签属性
content?: string; // 标签内容
}
```

## `injectQuickActionsMenu`

**类型:** `boolean`
**默认值:** `true`

在网站右下角注入快速操作菜单界面,允许用户快速访问 StudioCMS 管理后台。

### 用法示例

```ts twoslash {3} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
defaultFrontEndConfig: {
injectQuickActionsMenu: true, // 默认值 - 注入快速操作菜单
}
})
```
Loading
Loading