i18n(ja): add japanese reference pages

pull/4969/head
Kenzo-Wada 11 months ago
parent 0233972a2f
commit 4582e3d9e4

@ -1,73 +1,73 @@
# Command Line Interface
# コマンドラインインターフェイス
## `vitepress dev`
Start VitePress dev server using designated directory as root. Defaults to current directory. The `dev` command can also be omitted when running in current directory.
指定したディレクトリをルートとして VitePress の開発サーバーを起動します。既定はカレントディレクトリです。カレントディレクトリで実行する場合、`dev` コマンドは省略できます。
### Usage
### 使い方
```sh
# start in current directory, omitting `dev`
vitepress
```sh
# カレントディレクトリで起動(`dev` を省略)
vitepress
# start in sub directory
vitepress dev [root]
```
# サブディレクトリで起動
vitepress dev [root]
```
### Options
### オプション
| Option | Description |
| --------------- | ----------------------------------------------------------------- |
| `--open [path]` | Open browser on startup (`boolean \| string`) |
| `--port <port>` | Specify port (`number`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `--cors` | Enable CORS |
| `--strictPort` | Exit if specified port is already in use (`boolean`) |
| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) |
| オプション | 説明 |
| ------------------ | -------------------------------------------------------------------- |
| `--open [path]` | 起動時にブラウザを開く(`boolean \| string` |
| `--port <port>` | ポート番号を指定(`number` |
| `--base <path>` | 公開時のベースパス(既定: `/``string` |
| `--cors` | CORS を有効化 |
| `--strictPort` | 指定ポートが使用中なら終了(`boolean` |
| `--force` | 最適化時にキャッシュを無視して再バンドル(`boolean` |
## `vitepress build`
Build the VitePress site for production.
本番用に VitePress サイトをビルドします。
### Usage
### 使い方
```sh
vitepress build [root]
```
```sh
vitepress build [root]
```
### Options
### オプション
| Option | Description |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| `--mpa` (experimental) | Build in [MPA mode](../guide/mpa-mode) without client-side hydration (`boolean`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `--target <target>` | Transpile target (default: `"modules"`) (`string`) |
| `--outDir <dir>` | Output directory relative to **cwd** (default: `<root>/.vitepress/dist`) (`string`) |
| `--assetsInlineLimit <number>` | Static asset base64 inline threshold in bytes (default: `4096`) (`number`) |
| オプション | 説明 |
| ----------------------------- | -------------------------------------------------------------------------------------------------- |
| `--mpa`(実験的) | クライアント側ハイドレーションなしの [MPA モード](../guide/mpa-mode) でビルド(`boolean` |
| `--base <path>` | 公開時のベースパス(既定: `/``string` |
| `--target <target>` | トランスパイルターゲット(既定: `"modules"``string` |
| `--outDir <dir>` | 出力先ディレクトリ(**cwd** からの相対)(既定: `<root>/.vitepress/dist``string` |
| `--assetsInlineLimit <number>`| 静的アセットを base64 インライン化する閾値(バイト)(既定: `4096``number` |
## `vitepress preview`
Locally preview the production build.
本番ビルドをローカルでプレビューします。
### Usage
### 使い方
```sh
vitepress preview [root]
```
```sh
vitepress preview [root]
```
### Options
### オプション
| Option | Description |
| --------------- | ------------------------------------------ |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `--port <port>` | Specify port (`number`) |
| オプション | 説明 |
| ------------------ | ----------------------------------------- |
| `--base <path>` | 公開時のベースパス(既定: `/``string` |
| `--port <port>` | ポート番号を指定(`number` |
## `vitepress init`
Start the [Setup Wizard](../guide/getting-started#setup-wizard) in current directory.
カレントディレクトリで [セットアップウィザード](../guide/getting-started#setup-wizard) を起動します。
### Usage
### 使い方
```sh
vitepress init
```
```sh
vitepress init
```

@ -1,69 +1,69 @@
# Badge
# バッジ
The badge lets you add status to your headers. For example, it could be useful to specify the section's type, or supported version.
バッジを使うと、見出しにステータスを追加できます。たとえば、そのセクションの種類や対応バージョンを示すのに便利です。
## Usage
## 使い方
You may use the `Badge` component which is globally available.
グローバルに利用可能な `Badge` コンポーネントを使用します。
```html
### Title <Badge type="info" text="default" />
### Title <Badge type="tip" text="^1.9.0" />
### Title <Badge type="warning" text="beta" />
### Title <Badge type="danger" text="caution" />
```
```html
### Title <Badge type="info" text="default" />
### Title <Badge type="tip" text="^1.9.0" />
### Title <Badge type="warning" text="beta" />
### Title <Badge type="danger" text="caution" />
```
Code above renders like:
上記のコードは次のように表示されます:
### Title <Badge type="info" text="default" />
### Title <Badge type="tip" text="^1.9.0" />
### Title <Badge type="warning" text="beta" />
### Title <Badge type="danger" text="caution" />
## Custom Children
## 子要素のカスタマイズ
`<Badge>` accept `children`, which will be displayed in the badge.
`<Badge>` は子要素(`children`)を受け取り、バッジ内に表示できます。
```html
### Title <Badge type="info">custom element</Badge>
```
```html
### Title <Badge type="info">custom element</Badge>
```
### Title <Badge type="info">custom element</Badge>
## Customize Type Color
## 種類ごとの色をカスタマイズ
You can customize the style of badges by overriding css variables. The following are the default values:
CSS 変数を上書きすることで、バッジのスタイルをカスタマイズできます。以下はデフォルト値です:
```css
:root {
--vp-badge-info-border: transparent;
--vp-badge-info-text: var(--vp-c-text-2);
--vp-badge-info-bg: var(--vp-c-default-soft);
```css
:root {
--vp-badge-info-border: transparent;
--vp-badge-info-text: var(--vp-c-text-2);
--vp-badge-info-bg: var(--vp-c-default-soft);
--vp-badge-tip-border: transparent;
--vp-badge-tip-text: var(--vp-c-brand-1);
--vp-badge-tip-bg: var(--vp-c-brand-soft);
--vp-badge-tip-border: transparent;
--vp-badge-tip-text: var(--vp-c-brand-1);
--vp-badge-tip-bg: var(--vp-c-brand-soft);
--vp-badge-warning-border: transparent;
--vp-badge-warning-text: var(--vp-c-warning-1);
--vp-badge-warning-bg: var(--vp-c-warning-soft);
--vp-badge-warning-border: transparent;
--vp-badge-warning-text: var(--vp-c-warning-1);
--vp-badge-warning-bg: var(--vp-c-warning-soft);
--vp-badge-danger-border: transparent;
--vp-badge-danger-text: var(--vp-c-danger-1);
--vp-badge-danger-bg: var(--vp-c-danger-soft);
}
```
--vp-badge-danger-border: transparent;
--vp-badge-danger-text: var(--vp-c-danger-1);
--vp-badge-danger-bg: var(--vp-c-danger-soft);
}
```
## `<Badge>`
`<Badge>` component accepts following props:
`<Badge>` コンポーネントは次の props を受け取ります。
```ts
interface Props {
// When `<slot>` is passed, this value gets ignored.
text?: string
```ts
interface Props {
// `<slot>` が渡された場合、この値は無視されます。
text?: string
// Defaults to `tip`.
type?: 'info' | 'tip' | 'warning' | 'danger'
}
```
// 既定値は `tip`
type?: 'info' | 'tip' | 'warning' | 'danger'
}
```

@ -1,22 +1,22 @@
# Carbon Ads
# Carbon 広告
VitePress has built in native support for [Carbon Ads](https://www.carbonads.net/). By defining the Carbon Ads credentials in config, VitePress will display ads on the page.
VitePress は [Carbon Ads](https://www.carbonads.net/) をネイティブにサポートしています。設定で Carbon Ads の認証情報を定義すると、ページ上に広告が表示されます。
```js
export default {
themeConfig: {
carbonAds: {
code: 'your-carbon-code',
placement: 'your-carbon-placement'
}
}
}
```
```js
export default {
themeConfig: {
carbonAds: {
code: 'your-carbon-code',
placement: 'your-carbon-placement'
}
}
}
```
These values are used to call carbon CDN script as shown below.
これらの値は、次のように Carbon の CDN スクリプトを呼び出すために使用されます。
```js
`//cdn.carbonads.com/carbon.js?serve=${code}&placement=${placement}`
```
```js
`//cdn.carbonads.com/carbon.js?serve=${code}&placement=${placement}`
```
To learn more about Carbon Ads configuration, please visit [Carbon Ads website](https://www.carbonads.net/).
Carbon Ads の設定について詳しくは、[Carbon Ads のウェブサイト](https://www.carbonads.net/)を参照してください。

@ -1,494 +1,494 @@
# Default Theme Config
# デフォルトテーマの設定
Theme config lets you customize your theme. You can define theme config via the `themeConfig` option in the config file:
テーマ設定では、テーマのカスタマイズができます。設定ファイルの `themeConfig` オプションで定義します。
```ts
export default {
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
```ts
export default {
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
// Theme related configurations.
themeConfig: {
logo: '/logo.svg',
nav: [...],
sidebar: { ... }
}
}
```
// テーマ関連の設定
themeConfig: {
logo: '/logo.svg',
nav: [...],
sidebar: { ... }
}
}
```
**The options documented on this page only apply to the default theme.** Different themes expect different theme config. When using a custom theme, the theme config object will be passed to the theme so the theme can define conditional behavior based on it.
**このページで説明するオプションは、デフォルトテーマにのみ適用されます。** テーマによって期待する設定は異なります。カスタムテーマを使用する場合、ここで定義したテーマ設定オブジェクトはテーマへ渡され、テーマ側がそれに基づいて条件付きの挙動を定義できます。
## i18nRouting
- Type: `boolean`
- : `boolean`
Changing locale to say `zh` will change the URL from `/foo` (or `/en/foo/`) to `/zh/foo`. You can disable this behavior by setting `themeConfig.i18nRouting` to `false`.
ロケールを `zh` のように切り替えると、URL は `/foo`(または `/en/foo/`)から `/zh/foo` に変わります。`themeConfig.i18nRouting` を `false` に設定すると、この挙動を無効化できます。
## logo
- Type: `ThemeableImage`
- : `ThemeableImage`
Logo file to display in nav bar, right before the site title. Accepts a path string, or an object to set a different logo for light/dark mode.
サイトタイトルの直前に、ナビゲーションバーに表示されるロゴ。パス文字列、またはライト/ダークモードで異なるロゴを設定するオブジェクトを受け取ります。
```ts
export default {
themeConfig: {
logo: '/logo.svg'
}
}
```
```ts
export default {
themeConfig: {
logo: '/logo.svg'
}
}
```
```ts
type ThemeableImage =
| string
| { src: string; alt?: string }
| { light: string; dark: string; alt?: string }
```
```ts
type ThemeableImage =
| string
| { src: string; alt?: string }
| { light: string; dark: string; alt?: string }
```
## siteTitle
- Type: `string | false`
- : `string | false`
You can customize this item to replace the default site title (`title` in app config) in nav. When set to `false`, title in nav will be disabled. Useful when you have `logo` that already contains the site title text.
ナビゲーション内の既定サイトタイトル(アプリ設定の `title`)を置き換えます。`false` の場合、ナビのタイトルを非表示にします。ロゴ自体にサイト名が含まれている場合に便利です。
```ts
export default {
themeConfig: {
siteTitle: 'Hello World'
}
}
```
```ts
export default {
themeConfig: {
siteTitle: 'Hello World'
}
}
```
## nav
- Type: `NavItem`
The configuration for the nav menu item. More details in [Default Theme: Nav](./default-theme-nav#navigation-links).
```ts
export default {
themeConfig: {
nav: [
{ text: 'Guide', link: '/guide' },
{
text: 'Dropdown Menu',
items: [
{ text: 'Item A', link: '/item-1' },
{ text: 'Item B', link: '/item-2' },
{ text: 'Item C', link: '/item-3' }
]
}
]
}
}
```
```ts
type NavItem = NavItemWithLink | NavItemWithChildren
interface NavItemWithLink {
text: string
link: string | ((payload: PageData) => string)
activeMatch?: string
target?: string
rel?: string
noIcon?: boolean
}
interface NavItemChildren {
text?: string
items: NavItemWithLink[]
}
interface NavItemWithChildren {
text?: string
items: (NavItemChildren | NavItemWithLink)[]
activeMatch?: string
}
```
- : `NavItem`
ナビゲーションメニューの設定。[デフォルトテーマ: ナビ](./default-theme-nav#navigation-links) を参照してください。
```ts
export default {
themeConfig: {
nav: [
{ text: 'Guide', link: '/guide' },
{
text: 'Dropdown Menu',
items: [
{ text: 'Item A', link: '/item-1' },
{ text: 'Item B', link: '/item-2' },
{ text: 'Item C', link: '/item-3' }
]
}
]
}
}
```
```ts
type NavItem = NavItemWithLink | NavItemWithChildren
interface NavItemWithLink {
text: string
link: string | ((payload: PageData) => string)
activeMatch?: string
target?: string
rel?: string
noIcon?: boolean
}
interface NavItemChildren {
text?: string
items: NavItemWithLink[]
}
interface NavItemWithChildren {
text?: string
items: (NavItemChildren | NavItemWithLink)[]
activeMatch?: string
}
```
## sidebar
- Type: `Sidebar`
The configuration for the sidebar menu item. More details in [Default Theme: Sidebar](./default-theme-sidebar).
```ts
export default {
themeConfig: {
sidebar: [
{
text: 'Guide',
items: [
{ text: 'Introduction', link: '/introduction' },
{ text: 'Getting Started', link: '/getting-started' },
...
]
}
]
}
}
```
```ts
export type Sidebar = SidebarItem[] | SidebarMulti
export interface SidebarMulti {
[path: string]: SidebarItem[] | { items: SidebarItem[]; base: string }
}
export type SidebarItem = {
/**
* The text label of the item.
*/
text?: string
/**
* The link of the item.
*/
link?: string
/**
* The children of the item.
*/
items?: SidebarItem[]
/**
* If not specified, group is not collapsible.
*
* If `true`, group is collapsible and collapsed by default
*
* If `false`, group is collapsible but expanded by default
*/
collapsed?: boolean
/**
* Base path for the children items.
*/
base?: string
/**
* Customize text that appears on the footer of previous/next page.
*/
docFooterText?: string
rel?: string
target?: string
}
```
- : `Sidebar`
サイドバーメニューの設定。[デフォルトテーマ: サイドバー](./default-theme-sidebar) を参照してください。
```ts
export default {
themeConfig: {
sidebar: [
{
text: 'Guide',
items: [
{ text: 'Introduction', link: '/introduction' },
{ text: 'Getting Started', link: '/getting-started' },
...
]
}
]
}
}
```
```ts
export type Sidebar = SidebarItem[] | SidebarMulti
export interface SidebarMulti {
[path: string]: SidebarItem[] | { items: SidebarItem[]; base: string }
}
export type SidebarItem = {
/**
* 項目のテキストラベル
*/
text?: string
/**
* 項目のリンク
*/
link?: string
/**
* 子項目
*/
items?: SidebarItem[]
/**
* 指定しない場合、グループは折りたたみ不可。
*
* `true` なら折りたたみ可能でデフォルト折りたたみ
*
* `false` なら折りたたみ可能だがデフォルト展開
*/
collapsed?: boolean
/**
* 子項目のベースパス
*/
base?: string
/**
* 前/次リンクのフッターに表示するテキストをカスタマイズ
*/
docFooterText?: string
rel?: string
target?: string
}
```
## aside
- Type: `boolean | 'left'`
- Default: `true`
- Can be overridden per page via [frontmatter](./frontmatter-config#aside)
- : `boolean | 'left'`
- 既定値: `true`
- ページごとに [frontmatter](./frontmatter-config#aside) で上書き可能
Setting this value to `false` prevents rendering of aside container.\
Setting this value to `true` renders the aside to the right.\
Setting this value to `left` renders the aside to the left.
`false` でサイドコンテナの描画を無効化。\
`true` で右側に表示。\
`left` で左側に表示。
If you want to disable it for all viewports, you should use `outline: false` instead.
すべてのビューポートで無効にしたい場合は、代わりに `outline: false` を使用してください。
## outline
- Type: `Outline | Outline['level'] | false`
- Level can be overridden per page via [frontmatter](./frontmatter-config#outline)
Setting this value to `false` prevents rendering of outline container. Refer this interface for more details:
```ts
interface Outline {
/**
* The levels of headings to be displayed in the outline.
* Single number means only headings of that level will be displayed.
* If a tuple is passed, the first number is the minimum level and the second number is the maximum level.
* `'deep'` is same as `[2, 6]`, which means all headings from `<h2>` to `<h6>` will be displayed.
*
* @default 2
*/
level?: number | [number, number] | 'deep'
/**
* The title to be displayed on the outline.
*
* @default 'On this page'
*/
label?: string
}
```
- : `Outline | Outline['level'] | false`
- レベルはページごとに [frontmatter](./frontmatter-config#outline) で上書き可能
`false` でアウトラインコンテナの描画を無効化。詳細は以下を参照:
```ts
interface Outline {
/**
* アウトラインに表示する見出しレベル
* 単一の数値なら、そのレベルのみ表示
* タプルなら最小レベルと最大レベル
* `'deep'``[2, 6]` と同じ(`<h2>` 〜 `<h6>` を表示)
*
* @default 2
*/
level?: number | [number, number] | 'deep'
/**
* アウトラインに表示するタイトル
*
* @default 'On this page'
*/
label?: string
}
```
## socialLinks
- Type: `SocialLink[]`
You may define this option to show your social account links with icons in nav.
```ts
export default {
themeConfig: {
socialLinks: [
// You can add any icon from simple-icons (https://simpleicons.org/):
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
{ icon: 'twitter', link: '...' },
// You can also add custom icons by passing SVG as string:
{
icon: {
svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Dribbble</title><path d="M12...6.38z"/></svg>'
},
link: '...',
// You can include a custom label for accessibility too (optional but recommended):
ariaLabel: 'cool link'
}
]
}
}
```
```ts
interface SocialLink {
icon: string | { svg: string }
link: string
ariaLabel?: string
}
```
- : `SocialLink[]`
ナビゲーションにアイコン付きのソーシャルリンクを表示します。
```ts
export default {
themeConfig: {
socialLinks: [
// simple-icons (https://simpleicons.org/) の任意のアイコンを指定可能
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
{ icon: 'twitter', link: '...' },
// SVG 文字列を渡してカスタムアイコンも可
{
icon: {
svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Dribbble</title><path d="M12...6.38z"/></svg>'
},
link: '...',
// アクセシビリティ向けにカスタムラベルも指定可(推奨)
ariaLabel: 'cool link'
}
]
}
}
```
```ts
interface SocialLink {
icon: string | { svg: string }
link: string
ariaLabel?: string
}
```
## footer
- Type: `Footer`
- Can be overridden per page via [frontmatter](./frontmatter-config#footer)
Footer configuration. You can add a message or copyright text on the footer, however, it will only be displayed when the page doesn't contain a sidebar. This is due to design concerns.
```ts
export default {
themeConfig: {
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2019-present Evan You'
}
}
}
```
```ts
export interface Footer {
message?: string
copyright?: string
}
```
- : `Footer`
- ページごとに [frontmatter](./frontmatter-config#footer) で上書き可能
フッター設定。メッセージや著作権表示を追加できますが、ページにサイドバーがある場合はデザイン上表示されません。
```ts
export default {
themeConfig: {
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2019-present Evan You'
}
}
}
```
```ts
export interface Footer {
message?: string
copyright?: string
}
```
## editLink
- Type: `EditLink`
- Can be overridden per page via [frontmatter](./frontmatter-config#editlink)
Edit Link lets you display a link to edit the page on Git management services such as GitHub, or GitLab. See [Default Theme: Edit Link](./default-theme-edit-link) for more details.
```ts
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
}
}
}
```
```ts
export interface EditLink {
pattern: string
text?: string
}
```
- : `EditLink`
- ページごとに [frontmatter](./frontmatter-config#editlink) で上書き可能
「このページを編集」リンクを表示しますGitHub/GitLab など)。詳細は [デフォルトテーマ: 編集リンク](./default-theme-edit-link) を参照。
```ts
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
}
}
}
```
```ts
export interface EditLink {
pattern: string
text?: string
}
```
## lastUpdated
- Type: `LastUpdatedOptions`
Allows customization for the last updated text and date format.
```ts
export default {
themeConfig: {
lastUpdated: {
text: 'Updated at',
formatOptions: {
dateStyle: 'full',
timeStyle: 'medium'
}
}
}
}
```
```ts
export interface LastUpdatedOptions {
/**
* @default 'Last updated'
*/
text?: string
/**
* @default
* { dateStyle: 'short', timeStyle: 'short' }
*/
formatOptions?: Intl.DateTimeFormatOptions & { forceLocale?: boolean }
}
```
- : `LastUpdatedOptions`
最終更新の文言と日付フォーマットをカスタマイズします。
```ts
export default {
themeConfig: {
lastUpdated: {
text: 'Updated at',
formatOptions: {
dateStyle: 'full',
timeStyle: 'medium'
}
}
}
}
```
```ts
export interface LastUpdatedOptions {
/**
* @default 'Last updated'
*/
text?: string
/**
* @default
* { dateStyle: 'short', timeStyle: 'short' }
*/
formatOptions?: Intl.DateTimeFormatOptions & { forceLocale?: boolean }
}
```
## algolia
- Type: `AlgoliaSearch`
- : `AlgoliaSearch`
An option to support searching your docs site using [Algolia DocSearch](https://docsearch.algolia.com/docs/what-is-docsearch). Learn more in [Default Theme: Search](./default-theme-search)
[Algolia DocSearch](https://docsearch.algolia.com/docs/what-is-docsearch) によるサイト内検索の設定。[デフォルトテーマ: 検索](./default-theme-search) を参照。
```ts
export interface AlgoliaSearchOptions extends DocSearchProps {
locales?: Record<string, Partial<DocSearchProps>>
}
```
```ts
export interface AlgoliaSearchOptions extends DocSearchProps {
locales?: Record<string, Partial<DocSearchProps>>
}
```
View full options [here](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts).
完全なオプションは[こちら](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts)。
## carbonAds {#carbon-ads}
- Type: `CarbonAdsOptions`
- : `CarbonAdsOptions`
An option to display [Carbon Ads](https://www.carbonads.net/).
[Carbon Ads](https://www.carbonads.net/) を表示します。
```ts
export default {
themeConfig: {
carbonAds: {
code: 'your-carbon-code',
placement: 'your-carbon-placement'
}
}
}
```
```ts
export default {
themeConfig: {
carbonAds: {
code: 'your-carbon-code',
placement: 'your-carbon-placement'
}
}
}
```
```ts
export interface CarbonAdsOptions {
code: string
placement: string
}
```
```ts
export interface CarbonAdsOptions {
code: string
placement: string
}
```
Learn more in [Default Theme: Carbon Ads](./default-theme-carbon-ads)
詳細は [デフォルトテーマ: Carbon Ads](./default-theme-carbon-ads) を参照。
## docFooter
- Type: `DocFooter`
- : `DocFooter`
Can be used to customize text appearing above previous and next links. Helpful if not writing docs in English. Also can be used to disable prev/next links globally. If you want to selectively enable/disable prev/next links, you can use [frontmatter](./default-theme-prev-next-links).
前/次リンクの上に表示される文言をカスタマイズします。英語以外のドキュメントで便利。前/次リンク自体をグローバルに無効化することも可能。ページごとに切り替えたい場合は [frontmatter](./default-theme-prev-next-links) を使用します。
```ts
export default {
themeConfig: {
docFooter: {
prev: 'Pagina prior',
next: 'Proxima pagina'
}
}
}
```
```ts
export default {
themeConfig: {
docFooter: {
prev: 'Pagina prior',
next: 'Proxima pagina'
}
}
}
```
```ts
export interface DocFooter {
prev?: string | false
next?: string | false
}
```
```ts
export interface DocFooter {
prev?: string | false
next?: string | false
}
```
## darkModeSwitchLabel
- Type: `string`
- Default: `Appearance`
- : `string`
- 既定値: `Appearance`
Can be used to customize the dark mode switch label. This label is only displayed in the mobile view.
ダークモード切替スイッチのラベル(モバイル表示のみ)をカスタマイズします。
## lightModeSwitchTitle
- Type: `string`
- Default: `Switch to light theme`
- : `string`
- 既定値: `Switch to light theme`
Can be used to customize the light mode switch title that appears on hovering.
ホバー時に表示されるライトモード切替のタイトルをカスタマイズします。
## darkModeSwitchTitle
- Type: `string`
- Default: `Switch to dark theme`
- : `string`
- 既定値: `Switch to dark theme`
Can be used to customize the dark mode switch title that appears on hovering.
ホバー時に表示されるダークモード切替のタイトルをカスタマイズします。
## sidebarMenuLabel
- Type: `string`
- Default: `Menu`
- : `string`
- 既定値: `Menu`
Can be used to customize the sidebar menu label. This label is only displayed in the mobile view.
サイドバーメニューのラベル(モバイル表示のみ)をカスタマイズします。
## returnToTopLabel
- Type: `string`
- Default: `Return to top`
- : `string`
- 既定値: `Return to top`
Can be used to customize the label of the return to top button. This label is only displayed in the mobile view.
トップに戻るボタンのラベル(モバイル表示のみ)をカスタマイズします。
## langMenuLabel
- Type: `string`
- Default: `Change language`
- : `string`
- 既定値: `Change language`
Can be used to customize the aria-label of the language toggle button in navbar. This is only used if you're using [i18n](../guide/i18n).
ナビバーの言語切替ボタンの aria-label をカスタマイズします。[i18n](../guide/i18n) を使う場合に有効です。
## skipToContentLabel
- Type: `string`
- Default: `Skip to content`
- : `string`
- 既定値: `Skip to content`
Can be used to customize the label of the skip to content link. This link is shown when the user is navigating the site using a keyboard.
コンテンツへスキップリンクのラベルをカスタマイズします。キーボード操作時に表示されます。
## externalLinkIcon
- Type: `boolean`
- Default: `false`
- : `boolean`
- 既定値: `false`
Whether to show an external link icon next to external links in markdown.
Markdown 内の外部リンクの横に外部リンクアイコンを表示するかどうか。
## `useLayout` <Badge type="info" text="composable" />
Returns layout-related data. The returned object has the following type:
レイアウト関連のデータを返します。返り値の型は次のとおりです。
```ts
interface {
isHome: ComputedRef<boolean>
```ts
interface {
isHome: ComputedRef<boolean>
sidebar: Readonly<ShallowRef<DefaultTheme.SidebarItem[]>>
sidebarGroups: ComputedRef<DefaultTheme.SidebarItem[]>
hasSidebar: ComputedRef<boolean>
isSidebarEnabled: ComputedRef<boolean>
sidebar: Readonly<ShallowRef<DefaultTheme.SidebarItem[]>>
sidebarGroups: ComputedRef<DefaultTheme.SidebarItem[]>
hasSidebar: ComputedRef<boolean>
isSidebarEnabled: ComputedRef<boolean>
hasAside: ComputedRef<boolean>
leftAside: ComputedRef<boolean>
hasAside: ComputedRef<boolean>
leftAside: ComputedRef<boolean>
headers: Readonly<ShallowRef<DefaultTheme.OutlineItem[]>>
hasLocalNav: ComputedRef<boolean>
}
```
headers: Readonly<ShallowRef<DefaultTheme.OutlineItem[]>>
hasLocalNav: ComputedRef<boolean>
}
```
**Example:**
**:**
```vue
<script setup>
import { useLayout } from 'vitepress/theme'
```vue
<script setup>
import { useLayout } from 'vitepress/theme'
const { hasSidebar } = useLayout()
</script>
const { hasSidebar } = useLayout()
</script>
<template>
<div v-if="hasSidebar">Only show when sidebar exists</div>
</template>
```
<template>
<div v-if="hasSidebar">サイドバーがあるときだけ表示</div>
</template>
```

@ -1,60 +1,60 @@
# Edit Link
## Site-Level Config
Edit Link lets you display a link to edit the page on Git management services such as GitHub, or GitLab. To enable it, add `themeConfig.editLink` options to your config.
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
}
}
}
```
The `pattern` option defines the URL structure for the link, and `:path` is going to be replaced with the page path.
You can also put a pure function that accepts [`PageData`](./runtime-api#usedata) as the argument and returns the URL string.
```js
export default {
themeConfig: {
editLink: {
pattern: ({ filePath }) => {
if (filePath.startsWith('packages/')) {
return `https://github.com/acme/monorepo/edit/main/${filePath}`
} else {
return `https://github.com/acme/monorepo/edit/main/docs/${filePath}`
}
}
}
}
}
```
It should not have side-effects nor access anything outside of its scope since it will be serialized and executed in the browser.
By default, this will add the link text "Edit this page" at the bottom of the doc page. You may customize this text by defining the `text` option.
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
}
}
}
```
## Frontmatter Config
This can be disabled per-page using the `editLink` option on frontmatter:
```yaml
---
editLink: false
---
```
# 編集リンク
## サイトレベルの設定
編集リンクは、GitHub や GitLab などの Git 管理サービスでそのページを編集できるリンクを表示します。有効化するには、設定に `themeConfig.editLink` オプションを追加します。
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
}
}
}
```
`pattern` オプションはリンクの URL 構造を定義します。`:path` はページパスに置き換えられます。
また、引数に [`PageData`](./runtime-api#usedata) を受け取り、URL 文字列を返す純粋関数を指定することもできます。
```js
export default {
themeConfig: {
editLink: {
pattern: ({ filePath }) => {
if (filePath.startsWith('packages/')) {
return `https://github.com/acme/monorepo/edit/main/${filePath}`
} else {
return `https://github.com/acme/monorepo/edit/main/docs/${filePath}`
}
}
}
}
}
```
この関数はブラウザでシリアライズされ実行されるため、副作用を持たず、スコープ外のものへアクセスしないでください。
既定では、ドキュメント下部に「Edit this page」というリンクテキストが表示されます。`text` オプションでこの文言をカスタマイズできます。
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'GitHub でこのページを編集'
}
}
}
```
## フロントマターでの設定
ページごとに無効化するには、フロントマターで `editLink` オプションを使用します。
```yaml
---
editLink: false
---
```

@ -1,6 +1,6 @@
# Footer
# フッター
VitePress will display global footer at the bottom of the page when `themeConfig.footer` is present.
`themeConfig.footer` を設定すると、ページ下部にグローバルフッターが表示されます。
```ts
export default {
@ -15,15 +15,15 @@ export default {
```ts
export interface Footer {
// The message shown right before copyright.
// 著作権表示の直前に表示されるメッセージ
message?: string
// The actual copyright text.
// 実際の著作権表記
copyright?: string
}
```
The above configuration also supports HTML strings. So, for example, if you want to configure footer text to have some links, you can adjust the configuration as follows:
上記の設定は HTML 文字列にも対応しています。たとえば、フッター内のテキストにリンクを含めたい場合は、次のように設定できます。
```ts
export default {
@ -37,14 +37,16 @@ export default {
```
::: warning
Only inline elements can be used in `message` and `copyright` as they are rendered inside a `<p>` element. If you want to add block elements, consider using [`layout-bottom`](../guide/extending-default-theme#layout-slots) slot instead.
`message``copyright``<p>` 要素内にレンダリングされるため、
使用できるのはインライン要素のみです。ブロック要素を追加したい場合は、
[`layout-bottom`](../guide/extending-default-theme#layout-slots) スロットの利用を検討してください。
:::
Note that footer will not be displayed when the [SideBar](./default-theme-sidebar) is visible.
なお、[SideBar](./default-theme-sidebar) が表示されている場合はフッターは表示されません。
## Frontmatter Config
## フロントマターでの設定
This can be disabled per-page using the `footer` option on frontmatter:
ページ単位で無効化するには、フロントマターの `footer` オプションを使用します。
```yaml
---

@ -1,6 +1,6 @@
# Home Page
# ホームページ
VitePress default theme provides a homepage layout, which you can also see used on [the homepage of this site](../). You may use it on any of your pages by specifying `layout: home` in the [frontmatter](./frontmatter-config).
VitePress のデフォルトテーマにはホームページ用レイアウトが用意されています([このサイトのトップページ](../) でも使われています)。[フロントマター](./frontmatter-config) に `layout: home` を指定すれば、任意のページで利用できます。
```yaml
---
@ -8,11 +8,11 @@ layout: home
---
```
However, this option alone wouldn't do much. You can add several different pre templated "sections" to the homepage by setting additional other options such as `hero` and `features`.
ただし、この指定だけでは多くのことは起きません。`hero` や `features` などの追加オプションを設定して、ホームページにあらかじめ用意された複数の「セクション」を配置できます。
## Hero Section
## ヒーローセクション
The Hero section comes at the top of the homepage. Here's how you can configure the Hero section.
ヒーローセクションはホームページの最上部に表示されます。設定例は次のとおりです。
```yaml
---
@ -21,37 +21,36 @@ layout: home
hero:
name: VitePress
text: Vite & Vue powered static site generator.
tagline: Lorem ipsum...
tagline: 概要テキスト...
image:
src: /logo.png
alt: VitePress
actions:
- theme: brand
text: Get Started
text: はじめる
link: /guide/what-is-vitepress
- theme: alt
text: View on GitHub
text: GitHub で見る
link: https://github.com/vuejs/vitepress
---
```
```ts
interface Hero {
// The string shown top of `text`. Comes with brand color
// and expected to be short, such as product name.
// `text` の上に表示される短い文字列。ブランドカラーで表示。
// 製品名のような短い文言を想定。
name?: string
// The main text for the hero section. This will be defined
// as `h1` tag.
// ヒーローセクションのメインテキスト。`h1` として出力。
text: string
// Tagline displayed below `text`.
// `text` の下に表示されるタグライン。
tagline?: string
// The image is displayed next to the text and tagline area.
// テキストとタグラインの横に表示する画像。
image?: ThemeableImage
// Action buttons to display in home hero section.
// ヒーローに表示するアクションボタン。
actions?: HeroAction[]
}
@ -61,26 +60,26 @@ type ThemeableImage =
| { light: string; dark: string; alt?: string }
interface HeroAction {
// Color theme of the button. Defaults to `brand`.
// ボタンのカラーテーマ。既定は `brand`
theme?: 'brand' | 'alt'
// Label of the button.
// ボタンのラベル。
text: string
// Destination link of the button.
// ボタンのリンク先。
link: string
// Link target attribute.
// a 要素の target 属性。
target?: string
// Link rel attribute.
// a 要素の rel 属性。
rel?: string
}
```
### Customizing the name color
### name の色をカスタマイズする
VitePress uses the brand color (`--vp-c-brand-1`) for the `name`. However, you may customize this color by overriding `--vp-home-hero-name-color` variable.
`name` にはブランドカラー(`--vp-c-brand-1`)が使われますが、`--vp-home-hero-name-color` 変数を上書きして色を変更できます。
```css
:root {
@ -88,7 +87,7 @@ VitePress uses the brand color (`--vp-c-brand-1`) for the `name`. However, you m
}
```
Also you may customize it further by combining `--vp-home-hero-name-background` to give the `name` gradient color.
さらに、`--vp-home-hero-name-background` を組み合わせると、`name` にグラデーションを適用できます。
```css
:root {
@ -97,11 +96,11 @@ Also you may customize it further by combining `--vp-home-hero-name-background`
}
```
## Features Section
## フィーチャーセクション
In Features section, you can list any number of features you would like to show right after the Hero section. To configure it, pass `features` option to the frontmatter.
フィーチャーセクションでは、ヒーロー直下に任意の数の機能説明を並べられます。フロントマターに `features` オプションを指定して設定します。
You can provide an icon for each feature, which can be an emoji or any type of image. When the configured icon is an image (svg, png, jpeg...), you must provide the icon with the proper width and height; you can also provide the description, its intrinsic size as well as its variants for dark and light theme when required.
各フィーチャーにはアイコン絵文字または画像を指定できます。アイコンが画像svg, png, jpeg など)の場合は、**適切な幅・高さ** を指定してください。必要に応じて説明テキストや実サイズ、ライト/ダーク用の差し替えも指定できます。
```yaml
---
@ -109,49 +108,48 @@ layout: home
features:
- icon: 🛠️
title: Simple and minimal, always
details: Lorem ipsum...
title: いつでもシンプル&ミニマル
details: 概要テキスト...
- icon:
src: /cool-feature-icon.svg
title: Another cool feature
details: Lorem ipsum...
title: もうひとつの便利機能
details: 概要テキスト...
- icon:
dark: /dark-feature-icon.svg
light: /light-feature-icon.svg
title: Another cool feature
details: Lorem ipsum...
title: さらに別の機能
details: 概要テキスト...
---
```
```ts
interface Feature {
// Show icon on each feature box.
// 各フィーチャーボックスに表示するアイコン。
icon?: FeatureIcon
// Title of the feature.
// フィーチャーのタイトル。
title: string
// Details of the feature.
// フィーチャーの詳細説明。
details: string
// Link when clicked on feature component. The link can
// be both internal or external.
// フィーチャーをクリックしたときのリンク(内部・外部どちらも可)。
//
// e.g. `guide/reference/default-theme-home-page` or `https://example.com`
// 例: `guide/reference/default-theme-home-page` `https://example.com`
link?: string
// Link text to be shown inside feature component. Best
// used with `link` option.
// フィーチャー内に表示するリンクテキスト。
// `link` と併用するのが最適。
//
// e.g. `Learn more`, `Visit page`, etc.
// 例: `Learn more`, `Visit page` など
linkText?: string
// Link rel attribute for the `link` option.
// `link` 用の rel 属性。
//
// e.g. `external`
// 例: `external`
rel?: string
// Link target attribute for the `link` option.
// `link` 用の target 属性。
target?: string
}
@ -167,9 +165,9 @@ type FeatureIcon =
}
```
## Markdown Content
## Markdown コンテンツ
You can add additional content to your site's homepage just by adding Markdown below the `---` frontmatter divider.
`---` で区切るフロントマターの下に Markdown を書くだけで、ホームページに追加コンテンツを表示できます。
````md
---
@ -180,16 +178,11 @@ hero:
text: Vite & Vue powered static site generator.
---
## Getting Started
## はじめに
You can get started using VitePress right away using `npx`!
`npx` を使えば、すぐに VitePress を始められます!
```sh
npm init
npx vitepress init
```
````
::: info
VitePress didn't always auto-style the extra content of the `layout: home` page. To revert to older behavior, you can add `markdownStyles: false` to the frontmatter.
:::

@ -1,13 +1,13 @@
# Last Updated
# 最終更新日時
The update time of the last content will be displayed in the lower right corner of the page. To enable it, add `lastUpdated` options to your config.
ページ右下に、コンテンツの最終更新時刻を表示できます。有効化するには、設定に `lastUpdated` オプションを追加します。
::: info
VitePress displays the "last updated" time using the timestamp of the most recent Git commit for each file. To enable this, the Markdown file must be committed to Git.
VitePress は各ファイルの **直近の Git コミットのタイムスタンプ** を用いて「最終更新」を表示します。これを有効にするには、対象の Markdown ファイルが Git にコミットされている必要があります。
Internally, VitePress runs `git log -1 --pretty="%ai"` on each file to retrieve its timestamp. If all pages show the same update time, it's likely due to shallow cloning (common in CI environments), which limits Git history.
内部的には、各ファイルに対して `git log -1 --pretty="%ai"` を実行してタイムスタンプを取得します。すべてのページで同じ更新時刻が表示される場合、CI 環境でよくある)**浅いクローンshallow clone** により Git の履歴が取得できていない可能性があります。
To fix this in **GitHub Actions**, use the following in your workflow:
**GitHub Actions** での修正例は次のとおりです。
```yaml{4}
- name: Checkout
@ -16,16 +16,16 @@ To fix this in **GitHub Actions**, use the following in your workflow:
fetch-depth: 0
```
Other CI/CD platforms have similar settings.
他の CI/CD プラットフォームでも同様の設定が用意されています。
If such options aren't available, you can prepend the `docs:build` command in your `package.json` with a manual fetch:
もしそのようなオプションが使えない場合は、`package.json` のビルドスクリプトで手動フェッチを前置してください。
```json
"docs:build": "git fetch --unshallow && vitepress build docs"
```
:::
## Site-Level Config
## サイトレベルの設定
```js
export default {
@ -33,9 +33,9 @@ export default {
}
```
## Frontmatter Config
## フロントマターでの設定
This can be disabled per-page using the `lastUpdated` option on frontmatter:
ページ単位で無効化するには、フロントマターで `lastUpdated` を指定します。
```yaml
---
@ -43,4 +43,4 @@ lastUpdated: false
---
```
Also refer [Default Theme: Last Updated](./default-theme-config#lastupdated) for more details. Any truthy value at theme-level will also enable the feature unless explicitly disabled at site or page level.
より詳しくは [デフォルトテーマ: 最終更新](./default-theme-config#lastupdated) を参照してください。テーマレベルで truthy な値を設定すると、サイトまたはページで明示的に無効化しない限り、この機能は有効になります。

@ -1,6 +1,6 @@
# Layout
# レイアウト
You may choose the page layout by setting `layout` option to the page [frontmatter](./frontmatter-config). There are 3 layout options, `doc`, `page`, and `home`. If nothing is specified, then the page is treated as `doc` page.
ページの [フロントマター](./frontmatter-config) の `layout` オプションでページのレイアウトを選択できます。利用可能なレイアウトは `doc`、`page`、`home` の 3 種類です。何も指定しない場合は `doc` として扱われます。
```yaml
---
@ -8,38 +8,38 @@ layout: doc
---
```
## Doc Layout
## Doc レイアウト
Option `doc` is the default layout and it styles the whole Markdown content into "documentation" look. It works by wrapping whole content within `vp-doc` css class, and applying styles to elements underneath it.
`doc` は既定のレイアウトで、Markdown 全体を「ドキュメント」風にスタイリングします。コンテンツ全体を `vp-doc` という CSS クラスでラップし、その配下の要素にスタイルを適用します。
Almost all generic elements such as `p`, or `h2` get special styling. Therefore, keep in mind that if you add any custom HTML inside a Markdown content, those will get affected by those styles as well.
`p``h2` などほぼすべての汎用要素に特別なスタイルが当たります。そのため、Markdown 内にカスタム HTML を追加した場合も、これらのスタイルの影響を受ける点に注意してください。
It also provides documentation specific features listed below. These features are only enabled in this layout.
また、以下のようなドキュメント特有の機能も提供します。これらはこのレイアウトでのみ有効になります。
- Edit Link
- Prev Next Link
- Outline
- [Carbon Ads](./default-theme-carbon-ads)
- 編集リンク(Edit Link
- 前後リンク(Prev / Next Link
- アウトライン(Outline
- [Carbon 広告](./default-theme-carbon-ads)
## Page Layout
## Page レイアウト
Option `page` is treated as "blank page". The Markdown will still be parsed, and all of the [Markdown Extensions](../guide/markdown) work as same as `doc` layout, but it wouldn't get any default stylings.
`page` は「ブランクページ」として扱われます。Markdown はパースされ、[Markdown 拡張](../guide/markdown) も `doc` と同様に機能しますが、既定のスタイルは適用されません。
The page layout will let you style everything by you without VitePress theme affecting the markup. This is useful when you want to create your own custom page.
このレイアウトでは、VitePress テーマにマークアップを干渉させず、すべてを自分でスタイルできます。独自のカスタムページを作成したい場合に便利です。
Note that even in this layout, sidebar will still show up if the page has a matching sidebar config.
なお、このレイアウトでも、ページがサイドバー設定に一致する場合はサイドバーが表示されます。
## Home Layout
## Home レイアウト
Option `home` will generate templated "Homepage". In this layout, you can set extra options such as `hero` and `features` to customize the content further. Please visit [Default Theme: Home Page](./default-theme-home-page) for more details.
`home` はテンプレート化された「ホームページ」を生成します。このレイアウトでは、`hero` や `features` などの追加オプションでコンテンツをさらにカスタマイズできます。詳しくは [デフォルトテーマ: ホームページ](./default-theme-home-page) を参照してください。
## No Layout
## レイアウトなし
If you don't want any layout, you can pass `layout: false` through frontmatter. This option is helpful if you want a fully-customizable landing page (without any sidebar, navbar, or footer by default).
レイアウトを一切適用したくない場合は、フロントマターで `layout: false` を指定します。これは(既定でサイドバー/ナビバー/フッターなしの)完全にカスタマイズ可能なランディングページを作りたい場合に役立ちます。
## Custom Layout
## カスタムレイアウト
You can also use a custom layout:
カスタムレイアウトを使用することもできます。
```md
---
@ -47,7 +47,7 @@ layout: foo
---
```
This will look for a component named `foo` registered in context. For example, you can register your component globally in `.vitepress/theme/index.ts`:
これは、コンテキストに登録された `foo` という名前のコンポーネントを探します。たとえば、`.vitepress/theme/index.ts` でグローバル登録できます。
```ts
import DefaultTheme from 'vitepress/theme'

@ -1,10 +1,10 @@
# Nav
# ナビゲーション
The Nav is the navigation bar displayed on top of the page. It contains the site title, global menu links, etc.
ナビはページ上部に表示されるナビゲーションバーです。サイトタイトル、グローバルメニューリンクなどを含みます。
## Site Title and Logo
## サイトタイトルとロゴ
By default, nav shows the title of the site referencing [`config.title`](./site-config#title) value. If you would like to change what's displayed on nav, you may define custom text in `themeConfig.siteTitle` option.
既定では、ナビには [`config.title`](./site-config#title) の値が表示されます。ナビに表示する文字列を変更したい場合は、`themeConfig.siteTitle` にカスタム文字列を指定します。
```js
export default {
@ -14,7 +14,7 @@ export default {
}
```
If you have a logo for your site, you can display it by passing in the path to the image. You should place the logo within `public` directly, and define the absolute path to it.
サイトのロゴがある場合は、画像へのパスを渡すと表示できます。ロゴは `public` 直下に配置し、絶対パスで指定してください。
```js
export default {
@ -24,7 +24,7 @@ export default {
}
```
When adding a logo, it gets displayed along with the site title. If your logo is all you need and if you would like to hide the site title text, set `false` to the `siteTitle` option.
ロゴを追加すると、サイトタイトルと並んで表示されます。ロゴだけを表示したい場合は、`siteTitle` を `false` に設定してタイトル文字列を非表示にできます。
```js
export default {
@ -35,11 +35,11 @@ export default {
}
```
You can also pass an object as logo if you want to add `alt` attribute or customize it based on dark/light mode. Refer [`themeConfig.logo`](./default-theme-config#logo) for details.
ダーク/ライトモードでロゴを切り替えたり、`alt` 属性を付けたい場合は、ロゴにオブジェクトを渡すこともできます。詳細は [`themeConfig.logo`](./default-theme-config#logo) を参照してください。
## Navigation Links
## ナビゲーションリンク
You may define `themeConfig.nav` option to add links to your nav.
`themeConfig.nav` オプションでナビにリンクを追加できます。
```js
export default {
@ -53,11 +53,11 @@ export default {
}
```
The `text` is the actual text displayed in nav, and the `link` is the link that will be navigated to when the text is clicked. For the link, set path to the actual file without `.md` prefix, and always start with `/`.
`text` はナビに表示される文字列、`link` はクリック時に遷移するリンクです。内部リンクは `.md` 拡張子を付けず、必ず `/` で始めるようにしてください。
The `link` can also be a function that accepts [`PageData`](./runtime-api#usedata) as the argument and returns the path.
`link` には、[`PageData`](./runtime-api#usedata) を受け取ってパスを返す関数を指定することもできます。
Nav links can also be dropdown menus. To do this, set `items` key on link option.
ナビリンクはドロップダウンメニューにもできます。リンクオプションに `items` を設定してください。
```js
export default {
@ -77,9 +77,9 @@ export default {
}
```
Note that dropdown menu title (`Dropdown Menu` in the above example) can not have `link` property since it becomes a button to open dropdown dialog.
なお、ドロップダウンのタイトル(上の例の `Dropdown Menu`)には `link` は設定できません。ドロップダウンを開くボタンになるためです。
You may further add "sections" to the dropdown menu items as well by passing in more nested items.
さらに、ドロップダウン内を「セクション」に分けることもできます(入れ子の `items` を使います)。
```js
export default {
@ -90,7 +90,7 @@ export default {
text: 'Dropdown Menu',
items: [
{
// Title for the section.
// セクションのタイトル
text: 'Section A Title',
items: [
{ text: 'Section A Item A', link: '...' },
@ -103,7 +103,7 @@ export default {
text: 'Dropdown Menu',
items: [
{
// You may also omit the title.
// タイトルは省略することも可能
items: [
{ text: 'Section A Item A', link: '...' },
{ text: 'Section B Item B', link: '...' }
@ -116,16 +116,15 @@ export default {
}
```
### Customize link's "active" state
### リンクの「アクティブ」状態をカスタマイズ
Nav menu items will be highlighted when the current page is under the matching path. if you would like to customize the path to be matched, define `activeMatch` property and regex as a string value.
現在のページが特定のパス配下にあるとき、該当するナビ項目がハイライトされます。一致させるパスをカスタマイズしたい場合は、`activeMatch` に **正規表現文字列** を指定します。
```js
export default {
themeConfig: {
nav: [
// This link gets active state when the user is
// on `/config/` path.
// ユーザーが `/config/` 配下にいるときにアクティブになる
{
text: 'Guide',
link: '/guide',
@ -137,12 +136,12 @@ export default {
```
::: warning
`activeMatch` is expected to be a regex string, but you must define it as a string. We can't use actual RegExp object here because it isn't serializable during the build time.
`activeMatch` は正規表現 **オブジェクト** ではなく、**文字列** で指定してください。ビルド時のシリアライズの都合で `RegExp` は使用できません。
:::
### Customize link's "target" and "rel" attributes
### リンクの `target``rel` をカスタマイズ
By default, VitePress automatically determines `target` and `rel` attributes based on whether the link is an external link. But if you want, you can customize them too.
既定では、リンクが外部かどうかに応じて VitePress が `target``rel` を自動設定します。必要であれば明示的に指定することもできます。
```js
export default {
@ -159,13 +158,13 @@ export default {
}
```
## Social Links
## ソーシャルリンク
Refer [`socialLinks`](./default-theme-config#sociallinks).
[`socialLinks`](./default-theme-config#sociallinks) を参照してください。
## Custom Components
## カスタムコンポーネント
You can include custom components in the navigation bar by using the `component` option. The `component` key should be the Vue component name, and must be registered globally using [Theme.enhanceApp](../guide/custom-theme#theme-interface).
`component` オプションを使って、ナビゲーションバーにカスタムコンポーネントを配置できます。`component` には Vue コンポーネント名を指定し、[Theme.enhanceApp](../guide/custom-theme#theme-interface) で **グローバル登録** しておく必要があります。
```js [.vitepress/config.js]
export default {
@ -176,7 +175,7 @@ export default {
items: [
{
component: 'MyCustomComponent',
// Optional props to pass to the component
// コンポーネントに渡す任意の props
props: {
title: 'My Custom Component'
}
@ -191,7 +190,7 @@ export default {
}
```
Then, you need to register the component globally:
次に、コンポーネントをグローバル登録します。
```js [.vitepress/theme/index.js]
import DefaultTheme from 'vitepress/theme'
@ -209,8 +208,8 @@ export default {
}
```
Your component will be rendered in the navigation bar. VitePress will provide the following additional props to the component:
コンポーネントはナビゲーションバー内にレンダリングされます。VitePress は次の追加 props をコンポーネントに提供します。
- `screenMenu`: an optional boolean indicating whether the component is inside mobile navigation menu
- `screenMenu`: モバイルのナビメニュー内にあるかどうかを示す任意の boolean
You can check an example in the e2e tests [here](https://github.com/vuejs/vitepress/tree/main/__tests__/e2e/.vitepress).
e2e テスト内の例は[こちら](https://github.com/vuejs/vitepress/tree/main/__tests__/e2e/.vitepress)を参照してください。

@ -1,18 +1,18 @@
# Prev Next Links
# 前/次リンク
You can customize the text and link for the previous and next pages (shown at doc footer). This is helpful if you want a different text there than what you have on your sidebar. Additionally, you may find it useful to disable the footer or link to a page that is not included in your sidebar.
ドキュメントのフッターに表示される「前のページ」「次のページ」のテキストとリンクをカスタマイズできます。サイドバーに表示しているタイトルとは別の文言を使いたい場合や、フッターを無効化したり、サイドバーに含まれていないページへリンクしたい場合に便利です。
## prev
- Type: `string | false | { text?: string; link?: string }`
- : `string | false | { text?: string; link?: string }`
- Details:
- 詳細:
Specifies the text/link to show on the link to the previous page. If you don't set this in frontmatter, the text/link will be inferred from the sidebar config.
前のページへのリンクに表示するテキスト/リンクを指定します。フロントマターで設定しない場合は、サイドバー設定から自動推測されます。
- Examples:
- :
- To customize only the text:
- テキストだけをカスタマイズ:
```yaml
---
@ -20,7 +20,7 @@ You can customize the text and link for the previous and next pages (shown at do
---
```
- To customize both text and link:
- テキストとリンクの両方をカスタマイズ:
```yaml
---
@ -30,7 +30,7 @@ You can customize the text and link for the previous and next pages (shown at do
---
```
- To hide previous page:
- 前のページを非表示にする:
```yaml
---
@ -40,4 +40,4 @@ You can customize the text and link for the previous and next pages (shown at do
## next
Same as `prev` but for the next page.
`prev` と同様ですが、次のページ用の設定です。

@ -2,11 +2,11 @@
outline: deep
---
# Search
# 検索
## Local Search
## ローカル検索
VitePress supports fuzzy full-text search using an in-browser index thanks to [minisearch](https://github.com/lucaong/minisearch/). To enable this feature, simply set the `themeConfig.search.provider` option to `'local'` in your `.vitepress/config.ts` file:
VitePress は、[minisearch](https://github.com/lucaong/minisearch/) によるブラウザ内インデックスを使った曖昧一致の全文検索をサポートします。有効化するには、`.vitepress/config.ts` で `themeConfig.search.provider``'local'` に設定します。
```ts
import { defineConfig } from 'vitepress'
@ -20,11 +20,11 @@ export default defineConfig({
})
```
Example result:
表示例:
![screenshot of the search modal](/search.png)
Alternatively, you can use [Algolia DocSearch](#algolia-search) or some community plugins like:
代わりに [Algolia DocSearch](#algolia-search) や、次のコミュニティ製プラグインを使うこともできます。
- <https://www.npmjs.com/package/vitepress-plugin-search>
- <https://www.npmjs.com/package/vitepress-plugin-pagefind>
@ -32,7 +32,7 @@ Alternatively, you can use [Algolia DocSearch](#algolia-search) or some communit
### i18n {#local-search-i18n}
You can use a config like this to use multilingual search:
多言語検索を行う設定例です。
```ts
import { defineConfig } from 'vitepress'
@ -43,7 +43,7 @@ export default defineConfig({
provider: 'local',
options: {
locales: {
zh: { // make this `root` if you want to translate the default locale
zh: { // 既定ロケールの文言も翻訳したい場合はこれを `root`
translations: {
button: {
buttonText: '搜索',
@ -73,9 +73,9 @@ export default defineConfig({
})
```
### miniSearch options
### miniSearch のオプション
You can configure MiniSearch like this:
MiniSearch の設定例です。
```ts
import { defineConfig } from 'vitepress'
@ -107,11 +107,11 @@ export default defineConfig({
})
```
Learn more in [MiniSearch docs](https://lucaong.github.io/minisearch/classes/MiniSearch.MiniSearch.html).
詳しくは [MiniSearch のドキュメント](https://lucaong.github.io/minisearch/classes/MiniSearch.MiniSearch.html) を参照してください。
### Custom content renderer
### コンテンツレンダラーのカスタマイズ
You can customize the function used to render the markdown content before indexing it:
インデックス前に Markdown コンテンツをレンダリングする関数をカスタマイズできます。
```ts
import { defineConfig } from 'vitepress'
@ -127,7 +127,7 @@ export default defineConfig({
* @param {import('markdown-it-async')} md
*/
async _render(src, env, md) {
// return html string
// HTML 文字列を返す
}
}
}
@ -135,11 +135,11 @@ export default defineConfig({
})
```
This function will be stripped from client-side site data, so you can use Node.js APIs in it.
この関数はクライアント側のサイトデータからは除外されるため、Node.js の API を使用できます。
#### Example: Excluding pages from search
#### 例: 検索対象からページを除外する
You can exclude pages from search by adding `search: false` to the frontmatter of the page. Alternatively:
フロントマターに `search: false` を追加すると、そのページを検索対象から除外できます。あるいは次のようにもできます。
```ts
import { defineConfig } from 'vitepress'
@ -161,11 +161,11 @@ export default defineConfig({
})
```
::: warning Note
In case a custom `_render` function is provided, you need to handle the `search: false` frontmatter yourself. Also, the `env` object won't be completely populated before `md.renderAsync` is called, so any checks on optional `env` properties like `frontmatter` should be done after that.
::: warning 注意
カスタムの `_render` 関数を提供する場合、`search: false` の処理は自分で行う必要があります。また、`env` は `md.renderAsync` の呼び出し前には完全ではないため、`frontmatter` などの任意プロパティのチェックはその後に行ってください。
:::
#### Example: Transforming content - adding anchors
#### 例: コンテンツの変換 — 見出しアンカーを追加
```ts
import { defineConfig } from 'vitepress'
@ -187,9 +187,9 @@ export default defineConfig({
})
```
## Algolia Search
## Algolia 検索
VitePress supports searching your docs site using [Algolia DocSearch](https://docsearch.algolia.com/docs/what-is-docsearch). Refer their getting started guide. In your `.vitepress/config.ts` you'll need to provide at least the following to make it work:
VitePress は [Algolia DocSearch](https://docsearch.algolia.com/docs/what-is-docsearch) によるサイト検索をサポートします。導入は公式のガイドを参照してください。`.vitepress/config.ts` では最低限次の設定が必要です。
```ts
import { defineConfig } from 'vitepress'
@ -210,7 +210,7 @@ export default defineConfig({
### i18n {#algolia-search-i18n}
You can use a config like this to use multilingual search:
多言語検索の設定例です。
```ts
import { defineConfig } from 'vitepress'
@ -303,11 +303,11 @@ export default defineConfig({
})
```
[These options](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) can be overridden. Refer official Algolia docs to learn more about them.
[これらのオプション](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) は上書きできます。詳細は Algolia の公式ドキュメントを参照してください。
### Algolia Ask AI Support {#ask-ai}
### Algolia Ask AI のサポート {#ask-ai}
If you would like to include **Ask AI**, pass the `askAi` option (or any of the partial fields) inside `options`:
**Ask AI** を有効にするには、`options` 内に `askAi` オプション(またはその一部)を指定します。
```ts
import { defineConfig } from 'vitepress'
@ -321,11 +321,11 @@ export default defineConfig({
apiKey: '...',
indexName: '...',
// askAi: "YOUR-ASSISTANT-ID"
// OR
// または
askAi: {
// at minimum you must provide the assistantId you received from Algolia
// 少なくとも Algolia から受け取った assistantId を指定
assistantId: 'XXXYYY',
// optional overrides if omitted, the top-level appId/apiKey/indexName values are reused
// 任意の上書き — 省略時は上位の appId/apiKey/indexName を再利用
// apiKey: '...',
// appId: '...',
// indexName: '...'
@ -336,15 +336,15 @@ export default defineConfig({
})
```
::: warning Note
If want to default to keyword search and do not want to use Ask AI, just omit the `askAi` property
::: warning 注意
キーワード検索を既定にして Ask AI を使わない場合は、`askAi` を指定しないでください。
:::
The translations for the Ask AI UI live under `options.translations.modal.askAiScreen` and `options.translations.resultsScreen` — see the [type definitions](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) for all keys.
Ask AI UI の翻訳は `options.translations.modal.askAiScreen``options.translations.resultsScreen` にあります。すべてのキーは[型定義](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts)を参照してください。
### Crawler Config
### クローラー設定
Here is an example config based on what this site uses:
このサイトで使用している設定を元にした例です。
```ts
new Crawler({

@ -1,6 +1,6 @@
# Sidebar
# サイドバー
The sidebar is the main navigation block for your documentation. You can configure the sidebar menu in [`themeConfig.sidebar`](./default-theme-config#sidebar).
サイドバーはドキュメントの主要なナビゲーションブロックです。[`themeConfig.sidebar`](./default-theme-config#sidebar) でメニューを設定できます。
```js
export default {
@ -19,9 +19,9 @@ export default {
}
```
## The Basics
## 基本
The simplest form of the sidebar menu is passing in a single array of links. The first level item defines the "section" for the sidebar. It should contain `text`, which is the title of the section, and `items` which are the actual navigation links.
最もシンプルな構成は、リンクの配列を 1 つ渡す方法です。第 1 階層のアイテムがサイドバーの「セクション」を表します。各セクションは `text`(セクションのタイトル)と、実際のナビゲーションリンクである `items` を持ちます。
```js
export default {
@ -48,7 +48,7 @@ export default {
}
```
Each `link` should specify the path to the actual file starting with `/`. If you add trailing slash to the end of link, it will show `index.md` of the corresponding directory.
`link``/` で始まる実ファイルへのパスを指定します。リンクの末尾を `/` で終わらせると、対応するディレクトリの `index.md` が表示されます。
```js
export default {
@ -57,7 +57,7 @@ export default {
{
text: 'Guide',
items: [
// This shows `/guide/index.md` page.
// `/guide/index.md` を表示
{ text: 'Introduction', link: '/guide/' }
]
}
@ -66,7 +66,7 @@ export default {
}
```
You may further nest the sidebar items up to 6 level deep counting up from the root level. Note that deeper than 6 level of nested items gets ignored and will not be displayed on the sidebar.
サイドバーのアイテムは、ルートから数えて最大 6 階層まで入れ子にできます。7 階層以上は無視され、表示されません。
```js
export default {
@ -93,11 +93,11 @@ export default {
}
```
## Multiple Sidebars
## 複数のサイドバー
You may show different sidebar depending on the page path. For example, as shown on this site, you might want to create a separate sections of content in your documentation like "Guide" page and "Config" page.
ページのパスに応じて異なるサイドバーを表示できます。たとえば、このサイトのように「Guide」セクションと「Config」セクションでナビゲーションを分けたい場合に便利です。
To do so, first organize your pages into directories for each desired section:
まず、対象のセクションごとにディレクトリを分けてページを配置します。
```
.
@ -111,14 +111,13 @@ To do so, first organize your pages into directories for each desired section:
└─ four.md
```
Then, update your configuration to define your sidebar for each section. This time, you should pass an object instead of an array.
次に、各セクション用のサイドバーを設定します。この場合、配列ではなくオブジェクトを渡します。
```js
export default {
themeConfig: {
sidebar: {
// This sidebar gets displayed when a user
// is on `guide` directory.
// ユーザーが `guide` ディレクトリ配下にいるときに表示
'/guide/': [
{
text: 'Guide',
@ -130,8 +129,7 @@ export default {
}
],
// This sidebar gets displayed when a user
// is on `config` directory.
// ユーザーが `config` ディレクトリ配下にいるときに表示
'/config/': [
{
text: 'Config',
@ -147,9 +145,9 @@ export default {
}
```
## Collapsible Sidebar Groups
## 折りたたみ可能なサイドバーグループ
By adding `collapsed` option to the sidebar group, it shows a toggle button to hide/show each section.
サイドバーグループに `collapsed` オプションを追加すると、各セクションの開閉トグルが表示されます。
```js
export default {
@ -165,7 +163,7 @@ export default {
}
```
All sections are "open" by default. If you would like them to be "closed" on initial page load, set `collapsed` option to `true`.
既定ではすべてのセクションが「開いた」状態です。初回表示時に「閉じた」状態にしたい場合は、`collapsed` を `true` に設定します。
```js
export default {

@ -23,13 +23,13 @@ const members = [
]
</script>
# Team Page
# チームページ
If you would like to introduce your team, you may use Team components to construct the Team Page. There are two ways of using these components. One is to embed it in doc page, and another is to create a full Team Page.
チームを紹介したい場合は、Team コンポーネント群を使ってチームページを構成できます。使い方は 2 通りあり、ドキュメントページに埋め込む方法と、専用のチームページを作成する方法があります。
## Show team members in a page
## ページ内にメンバー一覧を表示する
You may use `<VPTeamMembers>` component exposed from `vitepress/theme` to display a list of team members on any page.
任意のページでチームメンバーの一覧を表示するには、`vitepress/theme` からエクスポートされている `<VPTeamMembers>` コンポーネントを使用します。
```html
<script setup>
@ -49,28 +49,28 @@ const members = [
]
</script>
# Our Team
# 私たちのチーム
Say hello to our awesome team.
私たちの素晴らしいチームを紹介します。
<VPTeamMembers size="small" :members />
```
The above will display a team member in card looking element. It should display something similar to below.
上記のように、カード風の要素でメンバーが表示されます。下図のような見た目になります。
<VPTeamMembers size="small" :members />
`<VPTeamMembers>` component comes in 2 different sizes, `small` and `medium`. While it boils down to your preference, usually `small` size should fit better when used in doc page. Also, you may add more properties to each member such as adding "description" or "sponsor" button. Learn more about it in [`<VPTeamMembers>`](#vpteammembers).
`<VPTeamMembers>` コンポーネントには `small``medium` の 2 種類のサイズがあります。好みによりますが、ドキュメントページ内で使う場合は `small` が馴染みやすいことが多いでしょう。各メンバーに「説明文」や「スポンサー」ボタンなど、追加のプロパティを付けることもできます。詳細は [`<VPTeamMembers>`](#vpteammembers) を参照してください。
Embedding team members in doc page is good for small size team where having dedicated full team page might be too much, or introducing partial members as a reference to documentation context.
小規模なチームで専用ページまでは不要な場合や、文脈上の参考として一部のメンバーのみを紹介したい場合は、ドキュメントページへ埋め込む方法が適しています。
If you have large number of members, or simply would like to have more space to show team members, consider [creating a full team page](#create-a-full-team-page).
メンバーが多い場合や、より広いスペースで紹介したい場合は、[専用のチームページを作成する](#専用のチームページを作成する) ことを検討してください。
## Create a full Team Page
## 専用のチームページを作成する
Instead of adding team members to doc page, you may also create a full Team Page, similar to how you can create a custom [Home Page](./default-theme-home-page).
ドキュメントページにメンバーを追加する代わりに、カスタムの [ホームページ](./default-theme-home-page) と同様、専用のチームページを作成することもできます。
To create a team page, first, create a new md file. The file name doesn't matter, but here lets call it `team.md`. In this file, set frontmatter option `layout: page`, and then you may compose your page structure using `TeamPage` components.
まず新しい md ファイルを作成します。ファイル名は任意ですが、ここでは `team.md` とします。このファイルでフロントマターに `layout: page` を設定し、その後 `TeamPage` コンポーネント群を使ってページを構成します。
```html
---
@ -100,28 +100,28 @@ const members = [
<VPTeamPage>
<VPTeamPageTitle>
<template #title>
Our Team
私たちのチーム
</template>
<template #lead>
The development of VitePress is guided by an international
team, some of whom have chosen to be featured below.
VitePress の開発は国際的なチームによって主導されています。
その一部を以下に紹介します。
</template>
</VPTeamPageTitle>
<VPTeamMembers :members />
</VPTeamPage>
```
When creating a full team page, remember to wrap all components with `<VPTeamPage>` component. This component will ensure all nested team related components get the proper layout structure like spacings.
専用のチームページを作る際は、必ずすべてのチーム関連コンポーネントを `<VPTeamPage>` でラップしてください。レイアウトや余白などが適切に適用されます。
`<VPPageTitle>` component adds the page title section. The title being `<h1>` heading. Use `#title` and `#lead` slot to document about your team.
`<VPPageTitle>` はページタイトルのセクションを追加します。タイトルは `<h1>` 見出しになります。`#title` と `#lead` スロットでチームについて説明を書きましょう。
`<VPMembers>` works as same as when used in a doc page. It will display list of members.
`<VPMembers>` はドキュメントページで使う場合と同様に、メンバー一覧を表示します。
### Add sections to divide team members
### セクションを追加してメンバーを分ける
You may add "sections" to the team page. For example, you may have different types of team members such as Core Team Members and Community Partners. You can divide these members into sections to better explain the roles of each group.
チームページに「セクション」を追加できます。たとえば、コアメンバーとコミュニティパートナーなど、役割ごとにメンバーを分けて説明しやすくできます。
To do so, add `<VPTeamPageSection>` component to the `team.md` file we created previously.
そのためには、先ほど作成した `team.md``<VPTeamPageSection>` コンポーネントを追加します。
```html
---
@ -141,12 +141,12 @@ const partners = [...]
<VPTeamPage>
<VPTeamPageTitle>
<template #title>Our Team</template>
<template #title>私たちのチーム</template>
<template #lead>...</template>
</VPTeamPageTitle>
<VPTeamMembers size="medium" :members="coreMembers" />
<VPTeamPageSection>
<template #title>Partners</template>
<template #title>パートナー</template>
<template #lead>...</template>
<template #members>
<VPTeamMembers size="small" :members="partners" />
@ -155,13 +155,13 @@ const partners = [...]
</VPTeamPage>
```
The `<VPTeamPageSection>` component can have `#title` and `#lead` slot similar to `VPTeamPageTitle` component, and also `#members` slot for displaying team members.
`<VPTeamPageSection>``VPTeamPageTitle` と同様に `#title``#lead` のスロットを持ち、さらにメンバー表示用の `#members` スロットを備えます。
Remember to put in `<VPTeamMembers>` component within `#members` slot.
`#members` スロット内に `<VPTeamMembers>` を配置するのを忘れないでください。
## `<VPTeamMembers>`
The `<VPTeamMembers>` component displays a given list of members.
`<VPTeamMembers>` コンポーネントは、与えられたメンバー配列を表示します。
```html
<VPTeamMembers
@ -176,63 +176,62 @@ The `<VPTeamMembers>` component displays a given list of members.
```ts
interface Props {
// Size of each members. Defaults to `medium`.
// 各メンバーカードのサイズ。既定は `medium`
size?: 'small' | 'medium'
// List of members to display.
// 表示するメンバー一覧。
members: TeamMember[]
}
interface TeamMember {
// Avatar image for the member.
// メンバーのアバター画像
avatar: string
// Name of the member.
// メンバー名
name: string
// Title to be shown below member's name.
// e.g. Developer, Software Engineer, etc.
// 名前の下に表示する肩書き(例: Developer, Software Engineer など)
title?: string
// Organization that the member belongs.
// 所属組織名
org?: string
// URL for the organization.
// 所属組織への URL
orgLink?: string
// Description for the member.
// メンバーの説明
desc?: string
// Social links. e.g. GitHub, Twitter, etc. You may pass in
// the Social Links object here.
// See: https://vitepress.dev/reference/default-theme-config.html#sociallinks
// ソーシャルリンク(例: GitHub, Twitter など)
// Social Links オブジェクトを渡せます。
// 参照: https://vitepress.dev/reference/default-theme-config.html#sociallinks
links?: SocialLink[]
// URL for the sponsor page for the member.
// メンバーのスポンサー用 URL
sponsor?: string
// Text for the sponsor link. Defaults to 'Sponsor'.
// スポンサーボタンのテキスト。既定は 'Sponsor'
actionText?: string
}
```
## `<VPTeamPage>`
The root component when creating a full team page. It only accepts a single slot. It will style all passed in team related components.
専用のチームページを作成する際のルートコンポーネントです。単一のスロットのみを受け取り、渡されたチーム関連コンポーネント全体に適切なスタイルを適用します。
## `<VPTeamPageTitle>`
Adds "title" section of the page. Best use at the very beginning under `<VPTeamPage>`. It accepts `#title` and `#lead` slot.
ページの「タイトル」セクションを追加します。`<VPTeamPage>` の直下に置くのが最適です。`#title` と `#lead` のスロットを受け取ります。
```html
<VPTeamPage>
<VPTeamPageTitle>
<template #title>
Our Team
私たちのチーム
</template>
<template #lead>
The development of VitePress is guided by an international
team, some of whom have chosen to be featured below.
VitePress の開発は国際的なチームによって主導されています。
その一部を以下に紹介します。
</template>
</VPTeamPageTitle>
</VPTeamPage>
@ -240,13 +239,13 @@ Adds "title" section of the page. Best use at the very beginning under `<VPTeamP
## `<VPTeamPageSection>`
Creates a "section" with in team page. It accepts `#title`, `#lead`, and `#members` slot. You may add as many sections as you like inside `<VPTeamPage>`.
チームページ内に「セクション」を作成します。`#title`、`#lead`、`#members` の各スロットを受け取ります。`<VPTeamPage>` の中に必要な数だけ追加できます。
```html
<VPTeamPage>
...
<VPTeamPageSection>
<template #title>Partners</template>
<template #title>パートナー</template>
<template #lead>Lorem ipsum...</template>
<template #members>
<VPTeamMembers :members="data" />

@ -2,11 +2,11 @@
outline: deep
---
# Frontmatter Config
# フロントマター設定
Frontmatter enables page based configuration. In every markdown file, you can use frontmatter config to override site-level or theme-level config options. Also, there are config options which you can only define in frontmatter.
フロントマターはページ単位の設定を可能にします。各 Markdown ファイルで、サイト全体やテーマレベルの設定を上書きできます。フロントマターでしか定義できない項目もあります。
Example usage:
使用例:
```md
---
@ -15,7 +15,7 @@ editLink: true
---
```
You can access frontmatter data via the `$frontmatter` global in Vue expressions:
Vue の式内では、グローバル `$frontmatter` を介してフロントマターデータにアクセスできます。
```md
{{ $frontmatter.title }}
@ -23,9 +23,9 @@ You can access frontmatter data via the `$frontmatter` global in Vue expressions
## title
- Type: `string`
- : `string`
Title for the page. It's same as [config.title](./site-config#title), and it overrides the site-level config.
ページのタイトルです。[config.title](./site-config#title) と同じ意味で、サイトレベルの設定を上書きします。
```yaml
---
@ -35,9 +35,9 @@ title: VitePress
## titleTemplate
- Type: `string | boolean`
- : `string | boolean`
The suffix for the title. It's same as [config.titleTemplate](./site-config#titletemplate), and it overrides the site-level config.
タイトルのサフィックスです。[config.titleTemplate](./site-config#titletemplate) と同じ意味で、サイトレベルの設定を上書きします。
```yaml
---
@ -48,9 +48,9 @@ titleTemplate: Vite & Vue powered static site generator
## description
- Type: `string`
- : `string`
Description for the page. It's same as [config.description](./site-config#description), and it overrides the site-level config.
ページの説明です。[config.description](./site-config#description) と同じ意味で、サイトレベルの設定を上書きします。
```yaml
---
@ -60,9 +60,9 @@ description: VitePress
## head
- Type: `HeadConfig[]`
- : `HeadConfig[]`
Specify extra head tags to be injected for the current page. Will be appended after head tags injected by site-level config.
現在のページに追加で挿入する `<head>` タグを指定します。サイトレベル設定で挿入されたタグの後に追加されます。
```yaml
---
@ -82,20 +82,20 @@ type HeadConfig =
| [string, Record<string, string>, string]
```
## Default Theme Only
## デフォルトテーマ専用
The following frontmatter options are only applicable when using the default theme.
以下のフロントマター項目は、デフォルトテーマ使用時にのみ適用されます。
### layout
- Type: `doc | home | page`
- Default: `doc`
- : `doc | home | page`
- 既定値: `doc`
Determines the layout of the page.
ページのレイアウトを決めます。
- `doc` - It applies default documentation styles to the markdown content.
- `home` - Special layout for "Home Page". You may add extra options such as `hero` and `features` to rapidly create beautiful landing page.
- `page` - Behave similar to `doc` but it applies no styles to the content. Useful when you want to create a fully custom page.
- `doc` — Markdown コンテンツにドキュメント向けの既定スタイルを適用します。
- `home` — 「ホームページ」用の特別なレイアウト。`hero` や `features` を追加指定して、ランディングページを素早く構築できます。
- `page` `doc` と似ていますが、コンテンツにスタイルを適用しません。完全にカスタムなページを作りたい場合に便利です。
```yaml
---
@ -103,20 +103,20 @@ layout: doc
---
```
### hero <Badge type="info" text="home page only" />
### hero <Badge type="info" text="home ページ専用" />
Defines contents of home hero section when `layout` is set to `home`. More details in [Default Theme: Home Page](./default-theme-home-page).
`layout: home` のときのヒーローセクションの内容を定義します。詳しくは [デフォルトテーマ: ホームページ](./default-theme-home-page) を参照。
### features <Badge type="info" text="home page only" />
### features <Badge type="info" text="home ページ専用" />
Defines items to display in features section when `layout` is set to `home`. More details in [Default Theme: Home Page](./default-theme-home-page).
`layout: home` のときのフィーチャーセクションに表示する項目を定義します。詳しくは [デフォルトテーマ: ホームページ](./default-theme-home-page) を参照。
### navbar
- Type: `boolean`
- Default: `true`
- : `boolean`
- 既定値: `true`
Whether to display [navbar](./default-theme-nav).
[ナビゲーションバー](./default-theme-nav) を表示するかどうか。
```yaml
---
@ -126,10 +126,10 @@ navbar: false
### sidebar
- Type: `boolean`
- Default: `true`
- : `boolean`
- 既定値: `true`
Whether to display [sidebar](./default-theme-sidebar).
[サイドバー](./default-theme-sidebar) を表示するかどうか。
```yaml
---
@ -139,14 +139,14 @@ sidebar: false
### aside
- Type: `boolean | 'left'`
- Default: `true`
- : `boolean | 'left'`
- 既定値: `true`
Defines the location of the aside component in the `doc` layout.
`doc` レイアウトでの aside コンポーネントの位置を定義します。
Setting this value to `false` prevents rendering of aside container.\
Setting this value to `true` renders the aside to the right.\
Setting this value to `'left'` renders the aside to the left.
この値を `false` にすると aside コンテナを表示しません。\
`true` にすると右側に表示します。\
`'left'` にすると左側に表示します。
```yaml
---
@ -156,10 +156,10 @@ aside: false
### outline
- Type: `number | [number, number] | 'deep' | false`
- Default: `2`
- : `number | [number, number] | 'deep' | false`
- 既定値: `2`
The levels of header in the outline to display for the page. It's same as [config.themeConfig.outline.level](./default-theme-config#outline), and it overrides the value set in site-level config.
ページのアウトラインに表示する見出しレベルです。[config.themeConfig.outline.level](./default-theme-config#outline) と同じ意味で、サイトレベルの設定を上書きします。
```yaml
---
@ -169,10 +169,10 @@ outline: [2, 4]
### lastUpdated
- Type: `boolean | Date`
- Default: `true`
- : `boolean | Date`
- 既定値: `true`
Whether to display [last updated](./default-theme-last-updated) text in the footer of the current page. If a datetime is specified, it will be displayed instead of the last git modified timestamp.
現在のページのフッターに[最終更新](./default-theme-last-updated)を表示するかどうか。日時を指定した場合は、その日時が Git の最終更新時刻の代わりに表示されます。
```yaml
---
@ -182,10 +182,10 @@ lastUpdated: false
### editLink
- Type: `boolean`
- Default: `true`
- : `boolean`
- 既定値: `true`
Whether to display [edit link](./default-theme-edit-link) in the footer of the current page.
現在のページのフッターに[編集リンク](./default-theme-edit-link)を表示するかどうか。
```yaml
---
@ -195,10 +195,10 @@ editLink: false
### footer
- Type: `boolean`
- Default: `true`
- : `boolean`
- 既定値: `true`
Whether to display [footer](./default-theme-footer).
[フッター](./default-theme-footer) を表示するかどうか。
```yaml
---
@ -208,9 +208,9 @@ footer: false
### pageClass
- Type: `string`
- : `string`
Add extra class name to a specific page.
特定のページに追加のクラス名を付与します。
```yaml
---
@ -218,20 +218,20 @@ pageClass: custom-page-class
---
```
Then you can customize styles of this specific page in `.vitepress/theme/custom.css` file:
その後、`.vitepress/theme/custom.css` でこのページ専用のスタイルを記述できます。
```css
.custom-page-class {
/* page-specific styles */
/* ページ固有のスタイル */
}
```
### isHome
- Type: `boolean`
- : `boolean`
The default theme relies on checks like `frontmatter.layout === 'home'` to determine if the current page is the home page.\
This is useful when you want to force show the home page elements in a custom layout.
デフォルトテーマは通常、`frontmatter.layout === 'home'` のチェックに基づいてホームページかどうかを判断します。\
カスタムレイアウトでホームページ用の要素を強制的に表示したい場合に便利です。
```yaml
---

@ -1,35 +1,35 @@
# Runtime API
# ランタイム API
VitePress offers several built-in APIs to let you access app data. VitePress also comes with a few built-in components that can be used globally.
VitePress には、アプリのデータへアクセスするための組み込み API がいくつか用意されています。さらに、グローバルに使用できる組み込みコンポーネントも提供されています。
The helper methods are globally importable from `vitepress` and are typically used in custom theme Vue components. However, they are also usable inside `.md` pages because markdown files are compiled into Vue [Single-File Components](https://vuejs.org/guide/scaling-up/sfc.html).
ヘルパーメソッドは `vitepress` からグローバルインポートでき、主にカスタムテーマの Vue コンポーネントで使われます。Markdown ファイルは Vue の [Single File Component](https://vuejs.org/guide/scaling-up/sfc.html) にコンパイルされるため、`.md` ファイル内でも使用できます。
Methods that start with `use*` indicates that it is a [Vue 3 Composition API](https://vuejs.org/guide/introduction.html#composition-api) function ("Composable") that can only be used inside `setup()` or `<script setup>`.
`use*` で始まるメソッドは [Vue 3 Composition API](https://vuejs.org/guide/introduction.html#composition-api) の関数Composableで、`setup()` または `<script setup>` の中でのみ使用できます。
## `useData` <Badge type="info" text="composable" />
Returns page-specific data. The returned object has the following type:
ページ固有のデータを返します。戻り値の型は次のとおりです。
```ts
interface VitePressData<T = any> {
/**
* Site-level metadata
* サイト全体のメタデータ
*/
site: Ref<SiteData<T>>
/**
* themeConfig from .vitepress/config.js
* .vitepress/config.js の themeConfig
*/
theme: Ref<T>
/**
* Page-level metadata
* ページ単位のメタデータ
*/
page: Ref<PageData>
/**
* Page frontmatter
* ページのフロントマター
*/
frontmatter: Ref<PageData['frontmatter']>
/**
* Dynamic route params
* 動的ルートのパラメータ
*/
params: Ref<PageData['params']>
title: Ref<string>
@ -39,7 +39,7 @@ interface VitePressData<T = any> {
dir: Ref<string>
localeIndex: Ref<string>
/**
* Current location hash
* 現在の location hash
*/
hash: Ref<string>
}
@ -58,7 +58,7 @@ interface PageData {
}
```
**Example:**
**使用例:**
```vue
<script setup>
@ -74,7 +74,7 @@ const { theme } = useData()
## `useRoute` <Badge type="info" text="composable" />
Returns the current route object with the following type:
現在のルートオブジェクトを返します。型は次のとおりです。
```ts
interface Route {
@ -86,33 +86,33 @@ interface Route {
## `useRouter` <Badge type="info" text="composable" />
Returns the VitePress router instance so you can programmatically navigate to another page.
VitePress のルーターインスタンスを返し、プログラムで別ページへ遷移できます。
```ts
interface Router {
/**
* Current route.
* 現在のルート
*/
route: Route
/**
* Navigate to a new URL.
* 新しい URL へ遷移
*/
go: (to?: string) => Promise<void>
/**
* Called before the route changes. Return `false` to cancel the navigation.
* ルートが変わる前に呼ばれる。`false` を返すと遷移をキャンセル
*/
onBeforeRouteChange?: (to: string) => Awaitable<void | boolean>
/**
* Called before the page component is loaded (after the history state is updated).
* Return `false` to cancel the navigation.
* ページコンポーネントが読み込まれる前(履歴が更新された後)に呼ばれる。
* `false` を返すと遷移をキャンセル
*/
onBeforePageLoad?: (to: string) => Awaitable<void | boolean>
/**
* Called after the page component is loaded (before the page component is updated).
* ページコンポーネントが読み込まれた後(更新前)に呼ばれる
*/
onAfterPageLoad?: (to: string) => Awaitable<void>
/**
* Called after the route changes.
* ルートが変わった後に呼ばれる
*/
onAfterRouteChange?: (to: string) => Awaitable<void>
}
@ -120,13 +120,13 @@ interface Router {
## `withBase` <Badge type="info" text="helper" />
- **Type**: `(path: string) => string`
- **型**: `(path: string) => string`
Appends the configured [`base`](./site-config#base) to a given URL path. Also see [Base URL](../guide/asset-handling#base-url).
設定された [`base`](./site-config#base) を指定の URL パスに付与します。[Base URL](../guide/asset-handling#base-url) も参照。
## `<Content />` <Badge type="info" text="component" />
The `<Content />` component displays the rendered markdown contents. Useful [when creating your own theme](../guide/custom-theme).
レンダリング済みの Markdown コンテンツを表示します。[独自テーマの作成時](../guide/custom-theme) に便利です。
```vue
<template>
@ -137,11 +137,11 @@ The `<Content />` component displays the rendered markdown contents. Useful [whe
## `<ClientOnly />` <Badge type="info" text="component" />
The `<ClientOnly />` component renders its slot only at client side.
スロット内容をクライアント側でのみレンダリングします。
Because VitePress applications are server-rendered in Node.js when generating static builds, any Vue usage must conform to the universal code requirements. In short, make sure to only access Browser / DOM APIs in beforeMount or mounted hooks.
VitePress アプリは静的ビルド時に Node.js 上でサーバーレンダリングされるため、Vue の使用はユニバーサルコードの要件に従う必要があります。要するに、ブラウザDOM API へのアクセスは beforeMount / mounted フック内に限定してください。
If you are using or demoing components that are not SSR-friendly (for example, contain custom directives), you can wrap them inside the `ClientOnly` component.
SSR 非対応(例: カスタムディレクティブを含む)なコンポーネントを使用・デモする場合は、`ClientOnly` でラップできます。
```vue-html
<ClientOnly>
@ -149,11 +149,11 @@ If you are using or demoing components that are not SSR-friendly (for example, c
</ClientOnly>
```
- Related: [SSR Compatibility](../guide/ssr-compat)
- 関連: [SSR 互換性](../guide/ssr-compat)
## `$frontmatter` <Badge type="info" text="template global" />
Directly access current page's [frontmatter](../guide/frontmatter) data in Vue expressions.
Vue の式内で現在ページの [フロントマター](../guide/frontmatter) に直接アクセスします。
```md
---
@ -165,7 +165,7 @@ title: Hello
## `$params` <Badge type="info" text="template global" />
Directly access current page's [dynamic route params](../guide/routing#dynamic-routes) in Vue expressions.
Vue の式内で現在ページの [動的ルートのパラメータ](../guide/routing#dynamic-routes) に直接アクセスします。
```md
- package name: {{ $params.pkg }}

@ -2,21 +2,21 @@
outline: deep
---
# Site Config
# サイト設定
Site config is where you can define the global settings of the site. App config options define settings that apply to every VitePress site, regardless of what theme it is using. For example, the base directory or the title of the site.
サイト設定では、サイト全体のグローバル設定を定義します。アプリ設定オプションは、使用するテーマに関係なく、すべての VitePress サイトに適用されます。たとえば、ベースディレクトリやサイトのタイトルなどです。
## Overview
## 概要
### Config Resolution
### 設定ファイルの解決
The config file is always resolved from `<root>/.vitepress/config.[ext]`, where `<root>` is your VitePress [project root](../guide/routing#root-and-source-directory), and `[ext]` is one of the supported file extensions. TypeScript is supported out of the box. Supported extensions include `.js`, `.ts`, `.mjs`, and `.mts`.
設定ファイルは常に `<root>/.vitepress/config.[ext]` から解決されます。`<root>` は VitePress の[プロジェクトルート](../guide/routing#root-and-source-directory)で、`[ext]` にはサポートされる拡張子が入ります。TypeScript はそのまま使えます。サポートされる拡張子は `.js`、`.ts`、`.mjs`、`.mts` です。
It is recommended to use ES modules syntax in config files. The config file should default export an object:
設定ファイルでは ES Modules 構文の使用を推奨します。設定オブジェクトをデフォルトエクスポートしてください。
```ts
export default {
// app level config options
// アプリレベルの設定
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
@ -24,9 +24,9 @@ export default {
}
```
::: details Dynamic (Async) Config
::: details 動的(非同期)設定
If you need to dynamically generate the config, you can also default export a function. For example:
設定を動的に生成する必要がある場合は、関数をデフォルトエクスポートすることもできます。例:
```ts
import { defineConfig } from 'vitepress'
@ -35,12 +35,12 @@ export default async () => {
const posts = await (await fetch('https://my-cms.com/blog-posts')).json()
return defineConfig({
// app level config options
// アプリレベル設定
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
// theme level config options
// テーマレベル設定
themeConfig: {
sidebar: [
...posts.map((post) => ({
@ -53,7 +53,7 @@ export default async () => {
}
```
You can also use top-level `await`. For example:
トップレベル `await` も使用できます。例:
```ts
import { defineConfig } from 'vitepress'
@ -61,12 +61,12 @@ import { defineConfig } from 'vitepress'
const posts = await (await fetch('https://my-cms.com/blog-posts')).json()
export default defineConfig({
// app level config options
// アプリレベル設定
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
// theme level config options
// テーマレベル設定
themeConfig: {
sidebar: [
...posts.map((post) => ({
@ -80,9 +80,9 @@ export default defineConfig({
:::
### Config Intellisense
### 設定のインテリセンス
Using the `defineConfig` helper will provide TypeScript-powered intellisense for config options. Assuming your IDE supports it, this should work in both JavaScript and TypeScript.
`defineConfig` ヘルパーを使うと、TypeScript による補完が効きます。対応 IDE であれば、JavaScript と TypeScript のどちらでも動作します。
```js
import { defineConfig } from 'vitepress'
@ -92,21 +92,21 @@ export default defineConfig({
})
```
### Typed Theme Config
### 型付きのテーマ設定
By default, `defineConfig` helper expects the theme config type from default theme:
デフォルトでは、`defineConfig` はデフォルトテーマのテーマ設定型を想定します。
```ts
import { defineConfig } from 'vitepress'
export default defineConfig({
themeConfig: {
// Type is `DefaultTheme.Config`
// 型は `DefaultTheme.Config`
}
})
```
If you use a custom theme and want type checks for the theme config, you'll need to use `defineConfigWithTheme` instead, and pass the config type for your custom theme via a generic argument:
カスタムテーマを使用しており、そのテーマ設定に型チェックを効かせたい場合は、代わりに `defineConfigWithTheme` を使い、ジェネリクスでカスタムテーマの設定型を渡してください。
```ts
import { defineConfigWithTheme } from 'vitepress'
@ -114,36 +114,36 @@ import type { ThemeConfig } from 'your-theme'
export default defineConfigWithTheme<ThemeConfig>({
themeConfig: {
// Type is `ThemeConfig`
// 型は `ThemeConfig`
}
})
```
### Vite, Vue & Markdown Config
### Vite・Vue・Markdown の設定
- **Vite**
You can configure the underlying Vite instance using the [vite](#vite) option in your VitePress config. No need to create a separate Vite config file.
Vite の設定は VitePress 設定の [vite](#vite) オプションで行えます。別途 Vite の設定ファイルを作る必要はありません。
- **Vue**
VitePress already includes the official Vue plugin for Vite ([@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue)). You can configure its options using the [vue](#vue) option in your VitePress config.
VitePress には公式の Vue プラグイン([@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue))が同梱されています。オプションは VitePress 設定の [vue](#vue) から指定できます。
- **Markdown**
You can configure the underlying [Markdown-It](https://github.com/markdown-it/markdown-it) instance using the [markdown](#markdown) option in your VitePress config.
既定の [Markdown-It](https://github.com/markdown-it/markdown-it) インスタンスは、VitePress 設定の [markdown](#markdown) オプションでカスタマイズできます。
## Site Metadata
## サイトメタデータ
### title
- Type: `string`
- Default: `VitePress`
- Can be overridden per page via [frontmatter](./frontmatter-config#title)
- : `string`
- 既定値: `VitePress`
- ページ単位での上書き: [frontmatter](./frontmatter-config#title)
Title for the site. When using the default theme, this will be displayed in the nav bar.
サイトのタイトル。デフォルトテーマではナビバーに表示されます。
It will also be used as the default suffix for all individual page titles, unless [`titleTemplate`](#titletemplate) is defined. An individual page's final title will be the text content of its first `<h1>` header, combined with the global `title` as the suffix. For example with the following config and page content:
[`titleTemplate`](#titletemplate) を定義していない場合、個々のページタイトルの既定のサフィックスとしても使われます。各ページの最終タイトルは、そのページの最初の `<h1>` 見出しのテキストに、グローバルの `title` をサフィックスとして結合したものになります。次の設定とページ内容の例:
```ts
export default {
@ -155,14 +155,14 @@ export default {
# Hello
```
The title of the page will be `Hello | My Awesome Site`.
このページのタイトルは `Hello | My Awesome Site` になります。
### titleTemplate
- Type: `string | boolean`
- Can be overridden per page via [frontmatter](./frontmatter-config#titletemplate)
- : `string | boolean`
- ページ単位での上書き: [frontmatter](./frontmatter-config#titletemplate)
Allows customizing each page's title suffix or the entire title. For example:
各ページタイトルのサフィックス、またはタイトル全体のカスタマイズができます。例:
```ts
export default {
@ -175,9 +175,9 @@ export default {
# Hello
```
The title of the page will be `Hello | Custom Suffix`.
このページのタイトルは `Hello | Custom Suffix` になります。
To completely customize how the title should be rendered, you can use the `:title` symbol in `titleTemplate`:
タイトルの描画方法を完全にカスタマイズするには、`titleTemplate` 内で `:title` シンボルを使います。
```ts
export default {
@ -185,17 +185,17 @@ export default {
}
```
Here `:title` will be replaced with the text inferred from the page's first `<h1>` header. The title of the previous example page will be `Hello - Custom Suffix`.
ここで `:title` はページ先頭の `<h1>` から推論されたテキストに置き換えられます。先ほどの例では `Hello - Custom Suffix` になります。
The option can be set to `false` to disable title suffixes.
`false` を設定するとタイトルのサフィックスを無効にできます。
### description
- Type: `string`
- Default: `A VitePress site`
- Can be overridden per page via [frontmatter](./frontmatter-config#description)
- : `string`
- 既定値: `A VitePress site`
- ページ単位での上書き: [frontmatter](./frontmatter-config#description)
Description for the site. This will render as a `<meta>` tag in the page HTML.
サイトの説明。ページの HTML に `<meta>` タグとして出力されます。
```ts
export default {
@ -205,11 +205,11 @@ export default {
### head
- Type: `HeadConfig[]`
- Default: `[]`
- Can be appended per page via [frontmatter](./frontmatter-config#head)
- : `HeadConfig[]`
- 既定値: `[]`
- ページ単位での追加: [frontmatter](./frontmatter-config#head)
Additional elements to render in the `<head>` tag in the page HTML. The user-added tags are rendered before the closing `head` tag, after VitePress tags.
ページ HTML の `<head>` に追加で出力する要素。ユーザーが追加したタグは、VitePress のタグの後、`</head>` の直前にレンダリングされます。
```ts
type HeadConfig =
@ -217,19 +217,19 @@ type HeadConfig =
| [string, Record<string, string>, string]
```
#### Example: Adding a favicon
#### 例: favicon を追加
```ts
export default {
head: [['link', { rel: 'icon', href: '/favicon.ico' }]]
} // put favicon.ico in public directory, if base is set, use /base/favicon.ico
} // favicon.ico は public に配置。base を設定している場合は /base/favicon.ico を利用
/* Would render:
/* 出力結果:
<link rel="icon" href="/favicon.ico">
*/
```
#### Example: Adding Google Fonts
#### 例: Google Fonts を追加
```ts
export default {
@ -249,14 +249,14 @@ export default {
]
}
/* Would render:
/* 出力結果:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
*/
```
#### Example: Registering a service worker
#### 例: Service Worker を登録
```ts
export default {
@ -273,7 +273,7 @@ export default {
]
}
/* Would render:
/* 出力結果:
<script id="register-sw">
;(() => {
if ('serviceWorker' in navigator) {
@ -284,7 +284,7 @@ export default {
*/
```
#### Example: Using Google Analytics
#### 例: Google Analytics を使用
```ts
export default {
@ -304,7 +304,7 @@ export default {
]
}
/* Would render:
/* 出力結果:
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
@ -317,10 +317,10 @@ export default {
### lang
- Type: `string`
- Default: `en-US`
- : `string`
- 既定値: `en-US`
The lang attribute for the site. This will render as a `<html lang="en-US">` tag in the page HTML.
サイトの言語属性。ページ HTML の `<html lang="en-US">` として出力されます。
```ts
export default {
@ -330,12 +330,12 @@ export default {
### base
- Type: `string`
- Default: `/`
- : `string`
- 既定値: `/`
The base URL the site will be deployed at. You will need to set this if you plan to deploy your site under a sub path, for example, GitHub pages. If you plan to deploy your site to `https://foo.github.io/bar/`, then you should set base to `'/bar/'`. It should always start and end with a slash.
サイトをデプロイするベース URL。GitHub Pages などサブパス配下にデプロイする場合に設定が必要です。たとえば `https://foo.github.io/bar/` にデプロイする場合、`base` は `'/bar/'` にします。先頭と末尾は必ずスラッシュにしてください。
The base is automatically prepended to all the URLs that start with / in other options, so you only need to specify it once.
`/` で始まる他のオプション内の URL には、この `base` が自動的に付与されます。1 回設定すれば十分です。
```ts
export default {
@ -343,24 +343,24 @@ export default {
}
```
## Routing
## ルーティング
### cleanUrls
- Type: `boolean`
- Default: `false`
- : `boolean`
- 既定値: `false`
When set to `true`, VitePress will remove the trailing `.html` from URLs. Also see [Generating Clean URL](../guide/routing#generating-clean-url).
`true` にすると、URL の末尾の `.html` を削除します。あわせて [クリーン URL の生成](../guide/routing#generating-clean-url) も参照してください。
::: warning Server Support Required
Enabling this may require additional configuration on your hosting platform. For it to work, your server must be able to serve `/foo.html` when visiting `/foo` **without a redirect**.
::: warning サーバ設定が必要
ホスティング環境によっては追加の設定が必要です。`/foo` へのアクセス時に **リダイレクトなしで** `/foo.html` を返せるサーバ設定が必要です。
:::
### rewrites
- Type: `Record<string, string>`
- : `Record<string, string>`
Defines custom directory &lt;-&gt; URL mappings. See [Routing: Route Rewrites](../guide/routing#route-rewrites) for more details.
ディレクトリと URL のカスタム対応を定義します。詳しくは [ルーティング: ルートのリライト](../guide/routing#route-rewrites) を参照。
```ts
export default {
@ -370,14 +370,14 @@ export default {
}
```
## Build
## ビルド
### srcDir
- Type: `string`
- Default: `.`
- : `string`
- 既定値: `.`
The directory where your markdown pages are stored, relative to project root. Also see [Root and Source Directory](../guide/routing#root-and-source-directory).
Markdown ページを置くディレクトリ(プロジェクトルートからの相対パス)。[ルートとソースディレクトリ](../guide/routing#root-and-source-directory) も参照。
```ts
export default {
@ -387,10 +387,10 @@ export default {
### srcExclude
- Type: `string[]`
- Default: `undefined`
- : `string[]`
- 既定値: `undefined`
A [glob pattern](https://github.com/mrmlnc/fast-glob#pattern-syntax) for matching markdown files that should be excluded as source content.
ソースとして除外したい Markdown ファイルにマッチする [glob パターン](https://github.com/mrmlnc/fast-glob#pattern-syntax)。
```ts
export default {
@ -400,10 +400,10 @@ export default {
### outDir
- Type: `string`
- Default: `./.vitepress/dist`
- : `string`
- 既定値: `./.vitepress/dist`
The build output location for the site, relative to [project root](../guide/routing#root-and-source-directory).
ビルド出力先([プロジェクトルート](../guide/routing#root-and-source-directory) からの相対パス)。
```ts
export default {
@ -413,10 +413,10 @@ export default {
### assetsDir
- Type: `string`
- Default: `assets`
- : `string`
- 既定値: `assets`
Specify the directory to nest generated assets under. The path should be inside [`outDir`](#outdir) and is resolved relative to it.
生成されるアセットを配置するサブディレクトリ名。パスは [`outDir`](#outdir) の内部で、相対解決されます。
```ts
export default {
@ -426,10 +426,10 @@ export default {
### cacheDir
- Type: `string`
- Default: `./.vitepress/cache`
- : `string`
- 既定値: `./.vitepress/cache`
The directory for cache files, relative to [project root](../guide/routing#root-and-source-directory). See also: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir).
キャッシュファイル用ディレクトリ([プロジェクトルート](../guide/routing#root-and-source-directory) からの相対パス)。参考: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir)
```ts
export default {
@ -439,12 +439,12 @@ export default {
### ignoreDeadLinks
- Type: `boolean | 'localhostLinks' | (string | RegExp | ((link: string, source: string) => boolean))[]`
- Default: `false`
- : `boolean | 'localhostLinks' | (string | RegExp | ((link: string, source: string) => boolean))[]`
- 既定値: `false`
When set to `true`, VitePress will not fail builds due to dead links.
`true` にすると、デッドリンクがあってもビルド失敗にしません。
When set to `'localhostLinks'`, the build will fail on dead links, but won't check `localhost` links.
`'localhostLinks'` にすると、`localhost` へのリンクはチェック対象外にしつつ、その他のデッドリンクではビルドを失敗させます。
```ts
export default {
@ -452,18 +452,18 @@ export default {
}
```
It can also be an array of exact url string, regex patterns, or custom filter functions.
正確な URL 文字列、正規表現、カスタムフィルタ関数の配列として指定することもできます。
```ts
export default {
ignoreDeadLinks: [
// ignore exact url "/playground"
// 正確に "/playground" を無視
'/playground',
// ignore all localhost links
// すべての localhost リンクを無視
/^https?:\/\/localhost/,
// ignore all links include "/repl/""
// パスに "/repl/" を含むリンクを無視
/\/repl\//,
// custom function, ignore all links include "ignore"
// カスタム関数: "ignore" を含むリンクを無視
(url) => {
return url.toLowerCase().includes('ignore')
}
@ -473,53 +473,53 @@ export default {
### metaChunk <Badge type="warning" text="experimental" />
- Type: `boolean`
- Default: `false`
- : `boolean`
- 既定値: `false`
When set to `true`, extract pages metadata to a separate JavaScript chunk instead of inlining it in the initial HTML. This makes each page's HTML payload smaller and makes the pages metadata cacheable, thus reducing server bandwidth when you have many pages in the site.
`true` にすると、各ページのメタデータを初期 HTML にインラインせず、別の JavaScript チャンクに抽出します。これにより各ページの HTML ペイロードが小さくなり、メタデータをキャッシュ可能にすることで、多数のページがあるサイトでサーバ帯域を削減できます。
### mpa <Badge type="warning" text="experimental" />
- Type: `boolean`
- Default: `false`
- : `boolean`
- 既定値: `false`
When set to `true`, the production app will be built in [MPA Mode](../guide/mpa-mode). MPA mode ships 0kb JavaScript by default, at the cost of disabling client-side navigation and requires explicit opt-in for interactivity.
`true` にすると、本番アプリは [MPA モード](../guide/mpa-mode) でビルドされます。MPA モードは既定でクライアント JavaScript を 0kb で配信する代わりに、クライアントサイドのナビゲーションを無効にし、相互作用には明示的な opt-in が必要です。
## Theming
## テーマ関連
### appearance
- Type: `boolean | 'dark' | 'force-dark' | 'force-auto' | import('@vueuse/core').UseDarkOptions`
- Default: `true`
- : `boolean | 'dark' | 'force-dark' | 'force-auto' | import('@vueuse/core').UseDarkOptions`
- 既定値: `true`
Whether to enable dark mode (by adding the `.dark` class to the `<html>` element).
ダークモードを有効にするか(`<html>` に `.dark` クラスを付与)。
- If the option is set to `true`, the default theme will be determined by the user's preferred color scheme.
- If the option is set to `dark`, the theme will be dark by default, unless the user manually toggles it.
- If the option is set to `false`, users will not be able to toggle the theme.
- If the option is set to `'force-dark'`, the theme will always be dark and users will not be able to toggle it.
- If the option is set to `'force-auto'`, the theme will always be determined by the user's preferred color scheme and users will not be able to toggle it.
- `true` の場合、ユーザーの環境設定に従います。
- `dark` の場合、ユーザーが切り替えない限りダークを既定にします。
- `false` の場合、ユーザーはテーマを切り替えできません。
- `'force-dark'` の場合、常にダークで固定(切替不可)。
- `'force-auto'` の場合、常にユーザーの環境設定に従い(切替不可)。
This option injects an inline script that restores users settings from local storage using the `vitepress-theme-appearance` key. This ensures the `.dark` class is applied before the page is rendered to avoid flickering.
このオプションは、ローカルストレージの `vitepress-theme-appearance` から設定を復元するインラインスクリプトを挿入します。これにより、ページ描画前に `.dark` クラスを適用してフリッカを防ぎます。
`appearance.initialValue` can only be `'dark' | undefined`. Refs or getters are not supported.
`appearance.initialValue` `'dark' | undefined` のみサポート。Ref や getter は使えません。
### lastUpdated
- Type: `boolean`
- Default: `false`
- : `boolean`
- 既定値: `false`
Whether to get the last updated timestamp for each page using Git. The timestamp will be included in each page's page data, accessible via [`useData`](./runtime-api#usedata).
Git を使って各ページの最終更新時刻を取得します。タイムスタンプは各ページのデータに含まれ、[`useData`](./runtime-api#usedata) から参照できます。
When using the default theme, enabling this option will display each page's last updated time. You can customize the text via [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) option.
デフォルトテーマ使用時にこのオプションを有効にすると、各ページの最終更新時刻が表示されます。テキストは [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) でカスタマイズ可能です。
## Customization
## カスタマイズ
### markdown
- Type: `MarkdownOption`
- : `MarkdownOption`
Configure Markdown parser options. VitePress uses [Markdown-it](https://github.com/markdown-it/markdown-it) as the parser, and [Shiki](https://github.com/shikijs/shiki) to highlight language syntax. Inside this option, you may pass various Markdown related options to fit your needs.
Markdown パーサの設定。VitePress はパーサに [Markdown-it](https://github.com/markdown-it/markdown-it)、構文ハイライトに [Shiki](https://github.com/shikijs/shiki) を使用しています。必要に応じて Markdown 関連の各種オプションを指定できます。
```js
export default {
@ -527,50 +527,50 @@ export default {
}
```
Check the [type declaration and jsdocs](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts) for all the options available.
利用可能なオプションは [型定義と JSDoc](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts) を参照してください。
### vite
- Type: `import('vite').UserConfig`
- : `import('vite').UserConfig`
Pass raw [Vite Config](https://vitejs.dev/config/) to internal Vite dev server / bundler.
内部の Vite 開発サーバ/バンドラへ生の [Vite Config](https://vitejs.dev/config/) を渡します。
```js
export default {
vite: {
// Vite config options
// Vite の設定
}
}
```
### vue
- Type: `import('@vitejs/plugin-vue').Options`
- : `import('@vitejs/plugin-vue').Options`
Pass raw [`@vitejs/plugin-vue` options](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#options) to the internal plugin instance.
内部の `@vitejs/plugin-vue` インスタンスへオプションをそのまま渡します。
```js
export default {
vue: {
// @vitejs/plugin-vue options
// @vitejs/plugin-vue のオプション
}
}
```
## Build Hooks
## ビルドフック
VitePress build hooks allow you to add new functionality and behaviors to your website:
VitePress のビルドフックを使うと、サイトに機能や振る舞いを追加できます。
- Sitemap
- Search Indexing
- サイトマップ
- 検索インデックス
- PWA
- Teleports
- Teleport
### buildEnd
- Type: `(siteConfig: SiteConfig) => Awaitable<void>`
- : `(siteConfig: SiteConfig) => Awaitable<void>`
`buildEnd` is a build CLI hook, it will run after build (SSG) finish but before VitePress CLI process exits.
`buildEnd` はビルド CLI フックです。ビルドSSGが完了した後、VitePress CLI プロセスが終了する前に実行されます。
```ts
export default {
@ -582,9 +582,9 @@ export default {
### postRender
- Type: `(context: SSGContext) => Awaitable<SSGContext | void>`
- : `(context: SSGContext) => Awaitable<SSGContext | void>`
`postRender` is a build hook, called when SSG rendering is done. It will allow you to handle the teleports content during SSG.
`postRender` は SSG のレンダリング完了時に呼ばれるビルドフックです。SSG 中の teleport コンテンツの処理に利用できます。
```ts
export default {
@ -604,12 +604,12 @@ interface SSGContext {
### transformHead
- Type: `(context: TransformContext) => Awaitable<HeadConfig[]>`
- : `(context: TransformContext) => Awaitable<HeadConfig[]>`
`transformHead` is a build hook to transform the head before generating each page. It will allow you to add head entries that cannot be statically added to your VitePress config. You only need to return extra entries, they will be merged automatically with the existing ones.
`transformHead` は、各ページを生成する前に head を変換するためのビルドフックです。設定ファイルでは静的に追加できない head 要素を追加できます。追加分のみ返せば、既存のものと自動でマージされます。
::: warning
Don't mutate anything inside the `context`.
`context` 内の値は変更しないでください。
:::
```ts
@ -622,8 +622,8 @@ export default {
```ts
interface TransformContext {
page: string // e.g. index.md (relative to srcDir)
assets: string[] // all non-js/css assets as fully resolved public URL
page: string // 例: index.mdsrcDir からの相対)
assets: string[] // 解決済みの公開 URL非 js/css アセット)
siteConfig: SiteConfig
siteData: SiteData
pageData: PageData
@ -634,7 +634,7 @@ interface TransformContext {
}
```
Note that this hook is only called when generating the site statically. It is not called during dev. If you need to add dynamic head entries during dev, you can use the [`transformPageData`](#transformpagedata) hook instead:
このフックは静的サイト生成時のみ呼ばれ、開発中には呼ばれません。開発中に動的な head 要素を追加したい場合は、代わりに [`transformPageData`](#transformpagedata) を使用できます。
```ts
export default {
@ -654,7 +654,7 @@ export default {
}
```
#### Example: Adding a canonical URL `<link>`
#### 例: 正規 URL の `<link>` を追加
```ts
export default {
@ -674,12 +674,12 @@ export default {
### transformHtml
- Type: `(code: string, id: string, context: TransformContext) => Awaitable<string | void>`
- : `(code: string, id: string, context: TransformContext) => Awaitable<string | void>`
`transformHtml` is a build hook to transform the content of each page before saving to disk.
`transformHtml` は、各ページの内容をディスクへ保存する前に変換するためのビルドフックです。
::: warning
Don't mutate anything inside the `context`. Also, modifying the html content may cause hydration problems in runtime.
`context` 内の値は変更しないでください。また、HTML を変更すると実行時のハイドレーション問題を引き起こす可能性があります。
:::
```ts
@ -692,12 +692,12 @@ export default {
### transformPageData
- Type: `(pageData: PageData, context: TransformPageContext) => Awaitable<Partial<PageData> | { [key: string]: any } | void>`
- : `(pageData: PageData, context: TransformPageContext) => Awaitable<Partial<PageData> | { [key: string]: any } | void>`
`transformPageData` is a hook to transform the `pageData` of each page. You can directly mutate `pageData` or return changed values which will be merged into the page data.
`transformPageData` は各ページの `pageData` を変換するためのフックです。`pageData` を直接変更するか、変更値を返してマージさせることができます。
::: warning
Don't mutate anything inside the `context` and be careful that this might impact the performance of dev server, especially if you have some network requests or heavy computations (like generating images) in the hook. You can check for `process.env.NODE_ENV === 'production'` for conditional logic.
`context` 内の値は変更しないでください。ネットワークリクエストや重い計算(画像生成など)を行うと開発サーバのパフォーマンスに影響します。`process.env.NODE_ENV === 'production'` を用いた条件分岐を検討してください。
:::
```ts
@ -706,7 +706,7 @@ export default {
pageData.contributors = await getPageContributors(pageData.relativePath)
}
// or return data to be merged
// あるいはマージ用の値を返す
async transformPageData(pageData, { siteConfig }) {
return {
contributors: await getPageContributors(pageData.relativePath)

Loading…
Cancel
Save