Skip to content

Commit

Permalink
refactor(docs): refine vitepress config
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Dec 13, 2024
1 parent b4bd8bc commit 56fbafd
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 133 deletions.
94 changes: 49 additions & 45 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from 'vitepress';
import { type LocaleConfig } from './types';

export const en = defineConfig({
export const en: LocaleConfig = {
lang: 'en-US',
label: 'English',
description: 'A very simple, high performance, edge WebRTC SFU',

themeConfig: {
Expand All @@ -11,48 +12,51 @@ export const en = defineConfig({
],

sidebar: {
'/guide/': { base: '/guide/', items: [
{
text: 'Introduction',
collapsed: false,
items: [
{ text: 'What is live777 ?', link: 'what-is-live777' },
{ text: 'Installation', link: 'installation' },
{ text: 'Getting Started', link: 'getting-started' },
{ text: 'For developer', link: 'developer' },
]
},
{
text: 'Components',
collapsed: false,
items: [
{ text: 'Live777', link: 'live777' },
{ text: 'Web UI', link: 'webui' },
{ text: 'LiveMan', link: 'liveman' },
{ text: 'WhipInto', link: 'whipinto' },
{ text: 'WhepFrom', link: 'whepfrom' },
{ text: 'NET4MQTT', link: 'net4mqtt' },
]
},
{
text: 'Example',
collapsed: false,
items: [
{ text: 'OBS Studio', link: 'obs-studio' },
{ text: 'FFmpeg', link: 'ffmpeg' },
{ text: 'Gstreamer', link: 'gstreamer' },
{ text: 'VLC', link: 'vlc' },
]
},
{
text: 'Reference',
collapsed: false,
items: [
{ text: 'Live777 API', link: 'live777-api' },
{ text: 'LiveMan API', link: 'liveman-api' },
]
}
]},
'/guide/': {
base: '/guide/',
items: [
{
text: 'Introduction',
collapsed: false,
items: [
{ text: 'What is live777 ?', link: 'what-is-live777' },
{ text: 'Installation', link: 'installation' },
{ text: 'Getting Started', link: 'getting-started' },
{ text: 'For developer', link: 'developer' },
]
},
{
text: 'Components',
collapsed: false,
items: [
{ text: 'Live777', link: 'live777' },
{ text: 'Web UI', link: 'webui' },
{ text: 'LiveMan', link: 'liveman' },
{ text: 'WhipInto', link: 'whipinto' },
{ text: 'WhepFrom', link: 'whepfrom' },
{ text: 'NET4MQTT', link: 'net4mqtt' },
]
},
{
text: 'Example',
collapsed: false,
items: [
{ text: 'OBS Studio', link: 'obs-studio' },
{ text: 'FFmpeg', link: 'ffmpeg' },
{ text: 'Gstreamer', link: 'gstreamer' },
{ text: 'VLC', link: 'vlc' },
]
},
{
text: 'Reference',
collapsed: false,
items: [
{ text: 'Live777 API', link: 'live777-api' },
{ text: 'LiveMan API', link: 'liveman-api' },
]
}
]
},
},
}
});
};
49 changes: 44 additions & 5 deletions docs/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
import { defineConfig } from 'vitepress';
import { shared } from './shared';

import { en } from './en';
import { zh } from './zh';

// https://vitepress.dev/reference/site-config
/**
* @see https://vitepress.dev/reference/site-config
*/
export default defineConfig({
...shared,
title: 'Live777',

lastUpdated: true,
cleanUrls: true,
metaChunk: true,

head: [
['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
['meta', { name: 'theme-color', content: '#5f67ee' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:locale', content: 'en' }],
['meta', { property: 'og:title', content: 'Live777 | A very simple, high performance, edge WebRTC SFU' }],
['meta', { property: 'og:site_name', content: 'VitePress' }],
['meta', { property: 'og:image', content: 'https://live777.binbat.com/logo.svg' }],
['meta', { property: 'og:url', content: 'https://live777.binbat.com/' }],
],

themeConfig: {
logo: { src: '/logo.svg', width: 24, height: 24 },

socialLinks: [
{ icon: 'github', link: 'https://github.com/binbat/live777' }
],

footer: {
message: 'Released under the MPL-2.0 License.',
copyright: 'Copyright © 2023-present BinBat LTD'
}
},

locales: {
root: { label: 'English', ...en },
zh: { label: '简体中文', ...zh },
root: en,
zh,
},

vite: {
css: {
postcss: {
// don't need postcss in docs
}
}
}
});
34 changes: 0 additions & 34 deletions docs/.vitepress/config/shared.ts

This file was deleted.

6 changes: 6 additions & 0 deletions docs/.vitepress/config/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'vitepress';

type LocalesType = NonNullable<Parameters<typeof defineConfig>[0]['locales']>;
type LocalesValueType = LocalesType[keyof LocalesType];

export type LocaleConfig = LocalesValueType;
100 changes: 51 additions & 49 deletions docs/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
import { type LocaleConfig } from './types';

import { defineConfig } from 'vitepress';

export const zh = defineConfig({
export const zh: LocaleConfig = {
lang: 'zh-Hans',
label: '简体中文',
description: '简单,高性能,WebRTC SFU',

themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: '指引', link: '/guide/what-is-live777' }
{ text: '主页', link: '/zh/' },
{ text: '指引', link: '/zh/guide/what-is-live777' }
],


sidebar: {
'/zh/guide/': { base: '/zh/guide/', items: [
{
text: '简介',
collapsed: false,
items: [
{ text: '什么是 Live777 ?', link: 'what-is-live777' },
{ text: '安装部署', link: 'installation' },
{ text: '快速开始', link: 'getting-started' },
{ text: '开发者', link: 'developer' },
]
},
{
text: '组件',
collapsed: false,
items: [
{ text: 'Live777', link: 'live777' },
{ text: 'Web UI', link: 'webui' },
{ text: 'LiveMan', link: 'liveman' },
{ text: 'WhipInto', link: 'whipinto' },
{ text: 'WhepFrom', link: 'whepfrom' },
{ text: 'NET4MQTT', link: 'net4mqtt' },
]
},
{
text: '例子',
collapsed: false,
items: [
{ text: 'OBS Studio', link: 'obs-studio' },
{ text: 'FFmpeg', link: 'ffmpeg' },
{ text: 'Gstreamer', link: 'gstreamer' },
{ text: 'VLC', link: 'vlc' },
]
},
{
text: '参考',
collapsed: false,
items: [
{ text: 'Live777 API', link: 'live777-api' },
{ text: 'LiveMan API', link: 'liveman-api' },
]
}
]},
'/zh/guide/': {
base: '/zh/guide/',
items: [
{
text: '简介',
collapsed: false,
items: [
{ text: '什么是 Live777 ?', link: 'what-is-live777' },
{ text: '安装部署', link: 'installation' },
{ text: '快速开始', link: 'getting-started' },
{ text: '开发者', link: 'developer' },
]
},
{
text: '组件',
collapsed: false,
items: [
{ text: 'Live777', link: 'live777' },
{ text: 'Web UI', link: 'webui' },
{ text: 'LiveMan', link: 'liveman' },
{ text: 'WhipInto', link: 'whipinto' },
{ text: 'WhepFrom', link: 'whepfrom' },
{ text: 'NET4MQTT', link: 'net4mqtt' },
]
},
{
text: '例子',
collapsed: false,
items: [
{ text: 'OBS Studio', link: 'obs-studio' },
{ text: 'FFmpeg', link: 'ffmpeg' },
{ text: 'Gstreamer', link: 'gstreamer' },
{ text: 'VLC', link: 'vlc' },
]
},
{
text: '参考',
collapsed: false,
items: [
{ text: 'Live777 API', link: 'live777-api' },
{ text: 'LiveMan API', link: 'liveman-api' },
]
}
]
},
},
}
});
};

0 comments on commit 56fbafd

Please sign in to comment.