|
|
@@ -1,68 +1,66 @@
|
|
|
----
|
|
|
-id: site-config
|
|
|
-title: siteConfig.js
|
|
|
----
|
|
|
+# siteConfig.js
|
|
|
|
|
|
-A large part of site configuration is done by editing the `siteConfig.js` file.
|
|
|
+网站配置的很大一部分是通过编辑 `siteConfig.js` 文件完成的。
|
|
|
|
|
|
-## User Showcase
|
|
|
+## 用户展示
|
|
|
|
|
|
-The `users` array is used to store objects for each project/user that you want to show on your site. Currently this field is used by example the `pages/en/index.js` and `pages/en/users.js` files provided. Each user object should have `caption`, `image`, `infoLink`, and `pinned` fields. The `caption` is the text showed when someone hovers over the `image` of that user, and the `infoLink` is where clicking the image will bring someone. The `pinned` field determines whether or not it shows up on the `index` page.
|
|
|
+`users` 数组用于存储要在您的站点上显示的每个项目/用户的对象。 目前这个字段被提供给 `pages/en/index.js` 和 `pages/en/users.js` 文件使用。 每个用户对象应该有 `caption`,`image`,`infoLink` 和 `pinned` 字段。`caption` 是当某人悬停在该用户的 `image` 上时显示的文本,而 `infoLink` 则是点击该图片将会某人谁去哪。 `pinned` 字段决定它是否显示在 `index`页面上。
|
|
|
|
|
|
-Currently this `users` array is used only by the `index.js` and `users.js` example files. If you do not wish to have a users page or show users on the `index` page, you may remove this section.
|
|
|
+目前这个 `users` 数组只用于 `index.js` 和 `users.js` 示例文件。 如果您不希望在 `index` 页面上显示用户页面或显示用户,则可以删除此部分。
|
|
|
|
|
|
-## siteConfig Fields
|
|
|
+## siteConfig 字段
|
|
|
|
|
|
-The `siteConfig` object contains the bulk of the configuration settings for your website.
|
|
|
+`siteConfig` 对象包含你的网站的大部分配置设置。
|
|
|
|
|
|
-### Mandatory Fields
|
|
|
+### 必选字段
|
|
|
|
|
|
-`title` - Title for your website.
|
|
|
+`title` - 网站的标题
|
|
|
|
|
|
-`tagline` - Tagline for your website.
|
|
|
+`tagline` - 网站的标语
|
|
|
|
|
|
-`url` - url for your site.
|
|
|
+`url` - 网站的 URL
|
|
|
|
|
|
-`baseUrl` - baseUrl for your site.
|
|
|
+`baseUrl` - 网站的 baseUrl
|
|
|
|
|
|
-`projectName` - Project name. This must match your GitHub repo project name (case sensitive).
|
|
|
+`projectName` - 项目名称. 这必须匹配你的 GitHub 仓库项目名称(区分大小写)。
|
|
|
|
|
|
-`noIndex` - Boolean. If true, Docusaurus will politely ask crawlers and search engines to avoid indexing your site. This is done with a header tag and so only applies to docs and pages. Will not attempt to hide static resources. This is a best effort request. Malicious crawlers can and will still index your site.
|
|
|
+`noIndex` - 布尔。 如果为真,Docusaurus 会礼貌地要求爬虫和搜索引擎避免索引您的网站。 这是用 header 标签完成的,所以只适用于文档和页面。 不会试图隐藏静态资源。 这是一个尽最大努力的要求。 恶意抓取工具仍然可以继续为您的网站编制索引。
|
|
|
|
|
|
-`headerLinks` - Links that will be used in the header navigation bar. The `label` field of each object will be the link text and will also be translated for each language.
|
|
|
+`headerLinks` - 将在标题导航栏中使用的链接。 每个对象的 `label` 字段将成为链接文本,也将被翻译为每种语言。
|
|
|
+
|
|
|
+使用示例:
|
|
|
|
|
|
-Example Usage:
|
|
|
```js
|
|
|
headerLinks: [
|
|
|
- // Links to document with id doc1 for current language/version
|
|
|
+ // 链接到当前 语言/版本 并且 ID 为 doc1 的文档
|
|
|
{ doc: "doc1", label: "Getting Started" },
|
|
|
- // Link to page found at pages/en/help.js or if that does not exist, pages/help.js, for current language
|
|
|
+ // 使用当前语言链接到 pages/en/help.js 中找到的页面,如果不存在,则使用 pages/help.js。
|
|
|
{ page: "help", label: "Help" },
|
|
|
- // Links to href destination
|
|
|
+ // 链接到 href 目的地
|
|
|
{ href: "https://github.com/", label: "GitHub" },
|
|
|
- // Links to blog generated by Docusaurus (${baseUrl}blog)
|
|
|
+ // 由 Docusaurus (${baseUrl}blog) 生成的博客链接
|
|
|
{ blog: true, label: "Blog" },
|
|
|
- // Determines search bar position among links
|
|
|
+ // 判断链接中的搜索栏的位置
|
|
|
{ search: true },
|
|
|
- // Determines language drop down position among links
|
|
|
+ // 判断链接中的语言下拉菜单的位置
|
|
|
{ languages: true }
|
|
|
],
|
|
|
```
|
|
|
-`headerIcon` - url for icon used in header navigation bar.
|
|
|
+`headerIcon` - 标题导航栏中使用的图标的 URL。
|
|
|
|
|
|
-`favicon` - url for site favicon.
|
|
|
+`favicon` - 网站 favicon 的 URL。
|
|
|
|
|
|
-`colors` - Color configurations for the site.
|
|
|
+`colors` - 网站的颜色配置。
|
|
|
|
|
|
- - `primaryColor` is the color used the header navigation bar and sidebars.
|
|
|
- - `secondaryColor` is the color seen in the second row of the header navigation bar when the site window is narrow (including on mobile).
|
|
|
- - Custom color configurations can also be added. For example, if user styles are added with colors specified as `$myColor`, then adding a `myColor` field to `colors` will allow you to easily configure this color.
|
|
|
+ - `primaryColor` 是用于标题导航栏和侧边栏的颜色。
|
|
|
+ - `secondaryColor` 是用于当站点窗口很窄时(包括在移动设备上)在页眉导航栏的第二行中看到的颜色。
|
|
|
+ - 也可以添加自定义颜色配置。 例如,如果用指定为 `$myColor` 的颜色添加用户样式,则将 `myColor` 字段添加到 `colors` 将可以让您轻松配置此颜色。
|
|
|
|
|
|
-`copyright` - The copyright string at footer of site and within feed
|
|
|
+`copyright` - 网站页脚和订阅内的版权字符串
|
|
|
|
|
|
-### Optional Fields
|
|
|
+### 可选字段
|
|
|
|
|
|
-`customDocsPath` - By default, Docusaurus expects your documentation to be in a directory called `docs`. This directory is at the same level as the `website` directory (i.e., not inside the `website` directory). You can specify a custom path to your documentation with this field. **Note that all of your documentation *.md files must still reside in a flat hierarchy. You cannot have your documents in nested directories**.
|
|
|
+默认情况下,Docusaurus 希望您的文档位于名为 `docs` 的目录中。 该目录与 `website` 目录处于同一级别(即不在 `website` 目录内)。 您可以使用此字段指定文档的自定义路径。**请注意,所有文档的*.md文件都必须位于平面层次结构中。 不可以使用文件嵌套目录**。
|
|
|
|
|
|
```js
|
|
|
customDocsPath: "docs/site"
|
|
|
@@ -71,52 +69,53 @@ customDocsPath: "docs/site"
|
|
|
```js
|
|
|
customDocsPath: "website-docs"
|
|
|
```
|
|
|
-`useEnglishUrl` - If you do not have [translations](guides-translation.md) enabled (e.g., by having a `languages.js` file), but still want a link of the form `/docs/en/doc.html` (with the `en`), set this to `true`.
|
|
|
|
|
|
-`organizationName` - GitHub username of the organization or user hosting this project. This is used by the publishing script to determine where your GitHub pages website will be hosted.
|
|
|
+`useEnglishUrl` - 如果你没有启用 [翻译](guides-translation.md)(例如,通过一个 `languages.js` 文件),那么仍然需要一个 `/docs/en/doc.html` 形式的链接 `en`),将其设置为 `true`。
|
|
|
+
|
|
|
+`organizationName` - 托管此项目的组织或用户的 GitHub 用户名。 发布脚本使用它来确定您的 GitHub 页面网站的托管位置。
|
|
|
|
|
|
-`editUrl` - url for editing docs, usage example: `editUrl + 'en/doc1.md'`. If this field is omitted, there will be no "Edit this Doc" button for each document.
|
|
|
+`editUrl` - 用于编辑文档的 URL,用法示例:`editUrl + 'en/doc1.md'`。 如果此字段被省略,则每个文档将不会有 "Edit this Doc" 按钮。
|
|
|
|
|
|
-`users` - The `users` array mentioned earlier.
|
|
|
+`users` - 前面提到的 `users` 数组。
|
|
|
|
|
|
-`disableHeaderTitle` - An option to disable showing the title in the header next to the header icon. Exclude this field to keep the header as normal, otherwise set to `true`.
|
|
|
+`disableHeaderTitle` - 可以选择禁止在标题图标旁边显示标题。 排除此字段以保持标题正常,否则设置为 `true`。
|
|
|
|
|
|
-`disableTitleTagline` - An option to disable showing the tagline in the title of main pages. Exclude this field to keep page titles as `Title • Tagline`. Set to `true` to make page titles just `Title`.
|
|
|
+`disableTitleTagline` - 禁止在主页标题中显示标语的选项。 排除此字段可将页面标题保留为 `Title • Tagline`。 设置为 `true`,使页面标题只是 `Title`。
|
|
|
|
|
|
-`separateCss` - Folders inside which any `css` files will not be processed and concatenated to Docusaurus's styles. This is to support static `html` pages that may be separate from Docusaurus with completely separate styles.
|
|
|
+`separateCss` - 其中任何 `css` 文件不会被处理并连接到 Docusaurus 的样式文件夹。 这是为了支持静态的 `html` 页面,它可以与 Docusaurus 样式完全独立的分开。
|
|
|
|
|
|
-`footerIcon` - url for a footer icon. Currently used in the `core/Footer.js` file provided as an example, but it can be removed from that file.
|
|
|
+`footerIcon` - 页脚图标的 URL。 目前在 `core/Footer.js` 文件中使用,但是可以从该文件中删除。
|
|
|
|
|
|
-`translationRecruitingLink` - url for the `Help Translate` tab of language selection when languages besides English are enabled. This can be included you are using translations but does not have to be.
|
|
|
+`translationRecruitingLink` - 当启用除英文以外的语言时,语言选择的 `Help Translate` 选项卡的 URL。 这可以包括你正在使用的翻译,但不一定都是这样。
|
|
|
|
|
|
-`algolia` - Information for Algolia search integration. If this field is excluded, the search bar will not appear in the header.
|
|
|
+`algolia` - Algolia 搜索集成信息。 如果该字段被排除,搜索栏将不会出现在标题中。
|
|
|
|
|
|
-`gaTrackingId` - Google Analytics tracking ID to track page views.
|
|
|
+`gaTrackingId` - Google Analytics 跟踪 ID 来跟踪页面浏览量。
|
|
|
|
|
|
-`facebookAppId` - If you want Facebook Like/Share buttons at the bottom of your blog posts, provide a [Facebook application id](https://www.facebook.com/help/audiencenetwork/804209223039296), and the buttons will show up on all blog posts.
|
|
|
+`facebookAppId` - 如果你想在你博客文章底部的 Facebook Like/Share 按钮,提供一个[Facebook应用程序ID](https://www.facebook.com/help/audiencenetwork/804209223039296),并且按钮将显示在所有的博客文章。
|
|
|
|
|
|
-`twitter` - set this to `true` if you want a Twitter social button to appear at the bottom of your blog posts.
|
|
|
+`twitter` - 如果你想让一个 Twitter 的社交按钮出现在你的博客文章的底部,请将其设置为 `true`。
|
|
|
|
|
|
-`highlight` - [Syntax highlighting](api-doc-markdown.md) options:
|
|
|
+`highlight` - [语法突出显示](api-doc-markdown.md) 参数:
|
|
|
|
|
|
- - `theme` is the name of the theme used by Highlight.js when highlighting code. You can find the [list of supported themes here](https://github.com/isagalaev/highlight.js/tree/master/src/styles).
|
|
|
- - `version` specifies a particular version of Highlight.js to be used.
|
|
|
- - `hljs` provides an escape valve by passing an instance of Highlight.js to the function specified here, allowing additional languages to be registered for syntax highlighting.
|
|
|
- - `defaultLang` defines a default language. It will be used if one is not specified at the top of the code block. You can find the [list of supported languages here](https://github.com/isagalaev/highlight.js/tree/master/src/languages).
|
|
|
+ - `theme` 是语法突出显示时 Highlight.js 使用的主题的名称。 你可以在这里找到[支持的主题列表](https://github.com/isagalaev/highlight.js/tree/master/src/styles)。
|
|
|
+ - `version` 指定要使用的特定版本的 Highlight.js。
|
|
|
+ - `hljs` 通过将 Highlight.js 的实例传递给此处指定的函数来提供一个换码阀,从而允许注册语法突出显示的其他语言。
|
|
|
+ - `defaultLang` 定义一个默认的语言。 如果没有在代码块的顶部指定它,将会使用它。 你可以在这里找到[支持的语言列表](https://github.com/isagalaev/highlight.js/tree/master/src/languages)。
|
|
|
|
|
|
-`markdownPlugins` - An array of plugins to be loaded by Remarkable, the markdown parser and renderer used by Docusaurus. The plugin will receive a reference to the Remarkable instance, allowing custom parsing and rendering rules to be defined.
|
|
|
+`markdownPlugins` - 一个由 Remarkable 加载的插件数组,Docusaurus 使用的 markdown 解析器和渲染器。 该插件将接收对 Remarkable 实例的引用,允许定义自定义分析和呈现规则。
|
|
|
|
|
|
-`wrapPagesHTML` - boolean flag to indicate whether `html` files in `/pages` should be wrapped with Docusaurus styles with the site header and footer. This feature is experimental and relies on the files being `html` fragments instead of complete pages. It inserts the contents of your `html` file with no extra processing. Defaults to `false`.
|
|
|
+`wrapPagesHTML` - 布尔标志来指示 `/pages` 中的 `html` 文件是否应该用网站页眉和页脚的Docusaurus 样式进行封装。 这个功能是实验性的,依赖于文件是 `html` 片段而不是完整的页面。 它插入的 `html` 文件的内容没有额外的处理。 默认为 `false`。
|
|
|
|
|
|
-`scripts` - Array of JavaScript sources to load. The script tag will be inserted in the HTML head.
|
|
|
+`scripts` - 要加载的 JavaScript 源数组。 脚本标签将被插入到 HTML 头中。
|
|
|
|
|
|
-`stylesheets` - Array of CSS sources to load. The link tag will be inserted in the HTML head.
|
|
|
+`stylesheets` - 要加载的 CSS 源数组。 链接标签将被插入到 HTML 头中。
|
|
|
|
|
|
-`cname` - The CNAME for your website. It will go into a `CNAME` file when your site it built.
|
|
|
+`cname` - 您的网站的 CNAME。 当您的网站建立时,它会进入一个 `CNAME` 文件。
|
|
|
|
|
|
-Users can also add their own custom fields if they wish to provide some data across different files.
|
|
|
+如果用户希望跨不同文件提供一些数据,用户也可以添加自己的自定义字段。
|
|
|
|
|
|
-## Example siteConfig.js with all fields
|
|
|
+## siteConfig.js 全字段示例
|
|
|
|
|
|
```
|
|
|
const users = [
|
|
|
@@ -133,7 +132,7 @@ const siteConfig = {
|
|
|
tagline: "Generate websites!",
|
|
|
url: "https://docusaurus.io",
|
|
|
baseUrl: "/",
|
|
|
-// For github.io type URLS, you would combine the url and baseUrl like:
|
|
|
+// 对于 github.io 类型的 URLS,你可以将 url 和 baseUrl 结合起来:
|
|
|
// url: "https://reasonml.github.io",
|
|
|
// url: "/reason-react/",
|
|
|
organizationName: "facebook",
|
|
|
@@ -145,7 +144,7 @@ const siteConfig = {
|
|
|
{ search: true },
|
|
|
{ blog: true }
|
|
|
],
|
|
|
-// For no header links in the top nav bar -> headerLinks: [],
|
|
|
+// 对于顶部导航栏中没有标题链接 -> headerLinks: [],
|
|
|
headerIcon: "img/docusaurus.svg",
|
|
|
favicon: "img/favicon.png",
|
|
|
colors: {
|