Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate pages of exampleSite into Chinese. #503

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions exampleSite/content/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "Learn Theme for Hugo"
---

# Hugo Learn Theme

[Hugo-Theme-Learn](http://github.com/matcornic/hugo-theme-learn)是一个 [Hugo](https://gohugo.io/)主题。Hugo是一种用Go语言编写的快速、现代静态网站引擎。Hugo经常用于博客,这个多语言主题**完全是为文档设计的**。

这个主题是网站[Grav](https://getgrav.org/)的[Learn theme](http://learn.getgrav.org/)主题的部分移植。Grav网站是一个用PHP编写的现代flat-file内容管理系统(CMS)。

{{% notice tip %}}
Learn Theme使用 _树状网页结构_ 来组织内容:所有的内容都以网页的形式存在,而每个网页都从属于其他网页。 [了解更多]({{%relref "cont/pages/_index.md"%}})
{{% /notice %}}

## 主要特征

* [自动搜索]({{%relref "basics/configuration/_index.md#activate-search" %}})
* [多语言模式]({{%relref "cont/i18n/_index.md" %}})
* **无限目录层次**
* **贯穿目录条目的自动前翻/后翻按钮**
* [图片缩放,阴影...]({{%relref "cont/markdown.zh.md#images" %}})
* [附件]({{%relref "shortcodes/attachments.zh.md" %}})
* [子网页列表]({{%relref "shortcodes/children/_index.md" %}})
* [Mermaid图表]({{%relref "shortcodes/mermaid.zh.md" %}}) (flowchart, sequence, gantt)
* [定制外观和主题变量]({{%relref "basics/style-customization/_index.md"%}})
* [Buttons按钮]({{%relref "shortcodes/button.zh.md" %}}), [提示/注意/信息/警告框]({{%relref "shortcodes/notice.zh.md" %}}), [展开]({{%relref "shortcodes/expand.zh.md" %}})

![Screenshot截图](https://raw.githubusercontent.com/matcornic/hugo-theme-learn/master/images/screenshot.png?width=40pc&classes=shadow)


## 为本文档做贡献

请自由升级此内容,只需点击每个页面右上方**编辑此页面**链接,执行pull request。

{{% notice info %}}
你的修改将在版本合并后生效。
{{% /notice %}}

## 文档网站

当前文档可以使用简单的Hugo命令静态生成:`hugo -t hugo-theme-learn` -- 源代码在 [GitHub中](https://github.com/matcornic/hugo-theme-learn)

{{% notice note %}}
自动发布使用[Netlify](https://www.netlify.com/)。详情参阅 [Automated HUGO deployments with Netlify](https://www.netlify.com/blog/2015/07/30/hosting-hugo-on-netlifyinsanely-fast-deploys/)
{{% /notice %}}
4 changes: 2 additions & 2 deletions exampleSite/content/basics/_index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pre: "<b>1. </b>"
chapter: true
---

### 章节 1
### 第一章

# 基础

了解该 Hugo 主题的特点以及背后的核心概念
了解这个Hugo主题的功能以及背后的核心概念
107 changes: 107 additions & 0 deletions exampleSite/content/basics/configuration/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
date: 2016-04-09T16:50:16+02:00
title: 配置
weight: 20
---

## 网站全局参数

根据[Hugo全局配置](https://gohugo.io/overview/configuration/), **Hugo-Theme-Learn** 允许在`config.toml`中定义下列参数(这里的值是默认值)。请注意,部分参数会在本文的的其他部分详细解释。

```toml
[params]
# Prefix URL to edit current page. Will display an "Edit this page" button on top right hand corner of every page.
# Useful to give opportunity to people to create merge request for your doc.
# See the config.toml file from this documentation site to have an example.
editURL = ""
# Author of the site, will be used in meta information
author = ""
# Description of the site, will be used in meta information
description = ""
# Shows a checkmark for visited pages on the menu
showVisitedLinks = false
# Disable search function. It will hide search bar
disableSearch = false
# Javascript and CSS cache are automatically busted when new version of site is generated.
# Set this to true to disable this behavior (some proxies don't handle well this optimization)
disableAssetsBusting = false
# Set this to true to disable copy-to-clipboard button for inline code.
disableInlineCopyToClipBoard = false
# A title for shortcuts in menu is set by default. Set this to true to disable it.
disableShortcutsTitle = false
# If set to false, a Home button will appear below the search bar on the menu.
# It is redirecting to the landing page of the current language if specified. (Default is "/")
disableLandingPageButton = true
# When using mulitlingual website, disable the switch language button.
disableLanguageSwitchingButton = false
# Hide breadcrumbs in the header and only show the current page title
disableBreadcrumb = true
# If set to true, prevents Hugo from including the mermaid module if not needed (will reduce load times and traffic)
disableMermaid = false
# Specifies the remote location of the mermaid js
customMermaidURL = "https://unpkg.com/[email protected]/dist/mermaid.min.js"
# Hide Next and Previous page buttons normally displayed full height beside content
disableNextPrev = true
# Order sections in menu by "weight" or "title". Default to "weight"
ordersectionsby = "weight"
# Change default color scheme with a variant one. Can be "red", "blue", "green".
themeVariant = ""
# Provide a list of custom css files to load relative from the `static/` folder in the site root.
custom_css = ["css/foo.css", "css/bar.css"]
# Change the title separator. Default to "::".
titleSeparator = "-"
```

## 激活搜索

如果还没有搜索功能,在同样的`config.toml`文件中添加下面代码。

```toml
[outputs]
home = [ "HTML", "RSS", "JSON"]
```

Learn Theme使用Hugo版本20+的最新改进,生成了一个使用lunr.js javascript收索引擎的json索引文件。

> Hugo会在公用文件夹的根目录生成lunrjs index.json。
> 当使用编译网站,Hugo会内部生成,不会出现在文件系统中。

## Mermaid

Mermaid的配置参数可以在一个具体页面内设置。在这种情况下,本地设置会覆盖全局设置。

> 例如:
>
> Mermaid是全局关闭的。默认情况下,不会再任何页面加载。
> 在"Architecture"页面上,你需要一个类图。你可以只在这个页面设置参数加载Mermaid(无需在其它页面配置)。

在全局使能时,你也可以在具体页面关闭Mermaid。

## 返回首页按钮

如果`disableLandingPage`配置为`false`, 左侧菜单栏里就会出现返回首页按钮。这可以替代单击Logo。你可以通过配置对应语言的两个参数编辑外观。

```toml
[Lanugages]
[Lanugages.en]
...
landingPageURL = "/en"
landingPageName = "<i class='fas fa-home'></i> Redirect to Home"
...
[Lanugages.fr]
...
landingPageURL = "/fr"
landingPageName = "<i class='fas fa-home'></i> Accueil"
...
```

如果特定语言的参数没有配置,就会使用默认值。

```toml
landingPageURL = "/"
landingPageName = "<i class='fas fa-home'></i> Home"
```

返回首页按钮就会变成下面这样:

![Default Home Button](/en/basics/configuration/images/home_button_defaults.jpg?width=100%)
102 changes: 102 additions & 0 deletions exampleSite/content/basics/installation/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
title: 建立网站
weight: 15
---

下面的步骤可以帮助你初始化新网站。如果你对Hugo一无所知,强烈建议先学习 [great documentation for beginners](https://gohugo.io/overview/quickstart/)。

## 创建你的网站

在Hugo中使用`new`命令创建新网站。

```
hugo new site <new_project>
```

## 安装主题

根据[这个文档](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme)安装 **Hugo-theme-learn** 主题。

这个主题仓库地址为:https://github.com/matcornic/hugo-theme-learn.git

你也可以[下载 .zip](https://github.com/matcornic/hugo-theme-learn/archive/master.zip) 文件,解压缩到 `themes` 文件夹中。

## 基本配置

在编译网站时,你可以用`--theme`设置主题。尽管,我们建议你修改配置文件(`config.toml`),设置默认主题。你也可以添加`[outputs]`部分使能搜索功能。

```toml
# Change the default theme to be use when building the site with Hugo
theme = "hugo-theme-learn"

# For search functionality
[outputs]
home = [ "HTML", "RSS", "JSON"]
```

## 创建第一个章页面

章页面包含其他子页面。他按照特殊的样式排版,通常只包含 _章名称_, _标题_ 和 _摘要_ 等几部分。

```
### Chapter 1

# Basics

Discover what this Hugo theme is all about and the core concepts behind it.
```

效果如下:

![A Chapter](/en/basics/installation/images/chapter.png?classes=shadow&width=60pc)

**Hugo-theme-learn** 提供创建网站框架需要的模板。以下面命令创建的第一个章页面开始。

```
hugo new --kind chapter basics/_index.md
```

打开创建的文件,你可以看到内容上方有`chapter=true`,表示本页面是一个 _章_。

所有章和内容页面在创建时默认是草稿。如果你想提交这些页面,在内容中去掉`draft: true`。

## 创建第一个内容页面

接着,在前一章里创建内容页面。这里有两个创建方法:

```
hugo new basics/first-content.md
hugo new basics/second-content/_index.md
```

请自由编辑这些文件,替换文件开头`title`的值,添加内容。

## 本地运行

使用下面命令运行:

```
hugo serve
```

打开 `http://localhost:1313`

有三点需要注意:

1. 你有一个靠左的**基本**菜单,包含和之前创建文件`title`相同的子菜单。
2. 主页解释怎么参照下面说明定制化。
3. 当运行`hugo serve`后,文件内容发生改变,页面会自动更新修改。小巧优雅!

## 生成网站

当网站已经部署,运行下列命令:

```
hugo
```

会生成一个`public`文件夹,包含网站所有静态内容和有用数据。现在可以部署到任何网页服务器上。

{{% notice note %}}
网站可以使用 [Netlify](https://www.netlify.com/)自动发布。了解更多[Automated HUGO deployments with Netlify](https://www.netlify.com/blog/2015/07/30/hosting-hugo-on-netlifyinsanely-fast-deploys/)。或者使用[Github pages](https://gohugo.io/hosting-and-deployment/hosting-on-github/)。
{{% /notice %}}
11 changes: 11 additions & 0 deletions exampleSite/content/basics/requirements/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: 准备工作
weight: 10
disableToc: true
---

得益于Hugo的精简,准备工作显得空空荡荡。

只需要根据你的系统 (Windows, Linux, Mac)下载最新版的[Hugo binary (> 0.25)](https://gohugo.io/getting-started/installing/):就是这么简单!

![Magic](/en/basics/requirements/images/magic.gif?classes=shadow)
Loading