2022-11-23 13:18:43 +08:00
|
|
|
|
# 配置
|
|
|
|
|
|
|
|
|
|
## 配置文件
|
|
|
|
|
|
2022-11-24 19:07:00 +08:00
|
|
|
|
本项目使用 `/src/lib/config/` 作为配置文件目录,但多数配置在一般情况下无需修改。
|
2022-11-23 13:18:43 +08:00
|
|
|
|
|
2022-11-24 19:07:00 +08:00
|
|
|
|
### site.ts | 站点信息
|
2022-11-23 13:18:43 +08:00
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
export const site: SiteConfig = {
|
2023-04-11 20:59:41 +08:00
|
|
|
|
protocol: import.meta.env.URARA_SITE_PROTOCOL ?? import.meta.env.DEV ? 'http://' : 'https://', // 协议(一般无需更改)
|
|
|
|
|
domain: import.meta.env.URARA_SITE_DOMAIN ?? 'urara-demo.netlify.app', // 域名
|
2022-11-23 13:18:43 +08:00
|
|
|
|
title: 'Urara', // 标题
|
|
|
|
|
subtitle: 'Sweet & Powerful SvelteKit Blog Template', // 副标题
|
2023-04-11 20:43:56 +08:00
|
|
|
|
lang: 'zh-CN', // 语言
|
2022-11-23 13:18:43 +08:00
|
|
|
|
descr: 'Powered by SvelteKit/Urara', // 描述
|
|
|
|
|
author: {
|
|
|
|
|
name: 'John Doe', // 作者名称
|
2022-11-23 14:03:08 +08:00
|
|
|
|
avatar: '/assets/maskable@512.png', // 作者图片
|
2022-11-23 13:18:43 +08:00
|
|
|
|
status: '🌸', // 作者状态
|
|
|
|
|
bio: 'lorem ipsum dolor sit amet, consectetur adipiscing elit.' // 作者描述
|
|
|
|
|
},
|
|
|
|
|
themeColor: '#3D4451' // 主题颜色(目前仅用于 Manifest)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2023-01-13 02:20:53 +08:00
|
|
|
|
### icon.ts | 图标
|
|
|
|
|
|
|
|
|
|
默认提供一些图标以兼容 Web app manifests 及现代浏览器,可以自行替换。
|
|
|
|
|
|
2023-02-27 20:03:52 +08:00
|
|
|
|
```
|
2023-01-13 02:20:53 +08:00
|
|
|
|
/urara/favicon.png - 网站图标,32x32
|
|
|
|
|
/urara/assets/any@180.png - 网站图标,180x180
|
|
|
|
|
/urara/assets/any@192.png - 网站 / Manifest 图标,192x192
|
|
|
|
|
/urara/assets/any@512.png - Manifest 图标,512x512
|
|
|
|
|
/urara/assets/manifest@192.png - Manifest 遮罩图标,192x192
|
|
|
|
|
/urara/assets/manifest@512.png - Manifest 遮罩图标,512x512
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
也可以通过修改 `/src/lib/config/icon.ts` 替换图标数量及路径。
|
|
|
|
|
|
2022-11-24 19:07:00 +08:00
|
|
|
|
### general.ts | 主题
|
2022-11-23 13:18:43 +08:00
|
|
|
|
|
2022-11-24 19:07:00 +08:00
|
|
|
|
```ts
|
|
|
|
|
export const theme: ThemeConfig = [
|
|
|
|
|
{
|
|
|
|
|
name: 'light', // 主题变量名
|
|
|
|
|
text: '🌕 Light' // 主题显示名,可随意修改
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'dark',
|
|
|
|
|
text: '🌑 Dark'
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2023-01-13 21:57:01 +08:00
|
|
|
|
本项目使用了 [**daisyUI**](https://daisyui.com/) 主题,查看可用的 [**daisyUI 主题**](https://daisyui.com/docs/themes/?lang=zh_cn)。
|
2022-11-24 19:07:00 +08:00
|
|
|
|
|
|
|
|
|
### general.ts | 标题栏
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
export const header: HeaderConfig = {
|
|
|
|
|
nav: [
|
|
|
|
|
{
|
|
|
|
|
text: 'Get Started', // 按钮名称
|
|
|
|
|
link: '/hello-world' // 指向的网页,可以填写其他网页
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Elements',
|
|
|
|
|
link: '/hello-world/elements'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
还可以根据下面的格式在标题栏添加下拉菜单。
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
{
|
|
|
|
|
text: 'Hello World',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
text: 'Get Started',
|
|
|
|
|
link: '/hello-world'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Elements',
|
|
|
|
|
link: '/hello-world/elements'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'ToC Disabled',
|
|
|
|
|
link: '/hello-world/toc-disabled'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### general.ts | 页脚
|
|
|
|
|
|
|
|
|
|
大致与标题相同,下拉菜单除外。
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
export const footer: FooterConfig = {
|
|
|
|
|
nav: [
|
|
|
|
|
{
|
|
|
|
|
text: 'Feed', // 超链接名称
|
|
|
|
|
link: '/atom.xml' // 指向的页面,可以填写其他网页
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Sitemap',
|
|
|
|
|
link: '/sitemap.xml'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### general.ts | 日期格式
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
export const date: DateConfig = {
|
2023-04-11 20:43:56 +08:00
|
|
|
|
locales: 'zh-CN', // 语言,可参考 IETF 语言标签
|
2022-11-24 19:07:00 +08:00
|
|
|
|
options: {
|
2023-01-25 21:19:56 +08:00
|
|
|
|
year: '2-digit', // 年份: numeric / 2-digit
|
|
|
|
|
weekday: 'long', // 星期: narrow / short / long
|
|
|
|
|
month: 'short', // 月份: numeric / 2-digit / narrow / short / long
|
|
|
|
|
day: 'numeric' // 日期: numeric / 2-digit
|
2022-11-24 19:07:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2023-01-13 21:57:01 +08:00
|
|
|
|
要添加其他选项,请参考 [**Intl.DateTimeFormat - JavaScript | MDN**](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)。
|