1
mirror of https://github.com/importantimport/urara-docs.git synced 2024-09-19 18:08:40 +08:00
urara-docs/zh/getting-started/configuration.md

131 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2022-02-11 23:04:51 +08:00
# 配置
## 配置文件
本項目使用 `/src/lib/config/` 作爲配置文件目錄,但多數配置在一般情況下無需修改。
### site.ts | 網站信息
2022-02-11 23:04:51 +08:00
```ts
export const site: SiteConfig = {
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-02-11 23:04:51 +08:00
title: 'Urara', // 標題
subtitle: 'Sweet & Powerful SvelteKit Blog Template', // 副標題
2023-04-11 20:43:56 +08:00
lang: 'zh-TW', // 語言
2022-02-11 23:04:51 +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-02-11 23:04:51 +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` 替換圖示數量及路徑。
### general.ts | 主題
```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_tw)。
### 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-TW', // 語言,可參考 IETF 語言標籤
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
}
}
```
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)。