mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-02-02 03:22:33 -06:00
translate thumbnails, multi-author to zh-cn
This commit is contained in:
parent
b5307d0fb5
commit
6b341ad811
3 changed files with 185 additions and 39 deletions
|
@ -14,44 +14,44 @@ series_order: 7
|
||||||
扉页参数中的默认值是从[基础配置]({{< ref "configuration" >}})中继承的,所有只有当你想要覆盖默认值时,才需要在当前页面指定这些参数。
|
扉页参数中的默认值是从[基础配置]({{< ref "configuration" >}})中继承的,所有只有当你想要覆盖默认值时,才需要在当前页面指定这些参数。
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
| 名称 | 默认值 | 描述 |
|
| 名称 | 默认值 | 描述 |
|
||||||
|-------------------------------|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-------------------------------|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `title` | 无 | 文章名称。 |
|
| `title` | 无 | 文章名称。 |
|
||||||
| `description` | 无 | 文章的描述信息,它会被添加在 HTML 的 `<meta>` 元数据中。 |
|
| `description` | 无 | 文章的描述信息,它会被添加在 HTML 的 `<meta>` 元数据中。 |
|
||||||
| `externalUrl` | 无 | 如果文章发布在第三方网站上,这里提供只想对应文章的 URL 地址。提供 URL 将会组织生成内容页面,对这篇文章的任何引用都会直接跳转到第三方网站的 URL 上面。 |
|
| `externalUrl` | 无 | 如果文章发布在第三方网站上,这里提供只想对应文章的 URL 地址。提供 URL 将会组织生成内容页面,对这篇文章的任何引用都会直接跳转到第三方网站的 URL 上面。 |
|
||||||
| `editURL` | `article.editURL` | 当激活 `showEdit` 参数时,此参数用来设置编辑文章的 URL。 |
|
| `editURL` | `article.editURL` | 当激活 `showEdit` 参数时,此参数用来设置编辑文章的 URL。 |
|
||||||
| `editAppendPath` | `article.editAppendPath` | 当激活 `showEdit` 参数时,该参数指定是否将当前文章路径添加到 `editURL` 设置的 URL 后面。 |
|
| `editAppendPath` | `article.editAppendPath` | 当激活 `showEdit` 参数时,该参数指定是否将当前文章路径添加到 `editURL` 设置的 URL 后面。 |
|
||||||
| `groupByYear` | `list.groupByYear` | 是否在列表页面按年份对文章进行分组。 |
|
| `groupByYear` | `list.groupByYear` | 是否在列表页面按年份对文章进行分组。 |
|
||||||
| `menu` | 无 | 当设置此值,这篇内容的链接将会出现在菜单中。有效值是 `main` 或 `footer`。 |
|
| `menu` | 无 | 当设置此值,这篇内容的链接将会出现在菜单中。有效值是 `main` 或 `footer`。 |
|
||||||
| `robots` | 无 | 支持搜索引擎的爬虫如何处理这篇文章。如果设置了此值,它将在页面头部输出。更多内容请参考 [Google 文档](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)。 |
|
| `robots` | 无 | 支持搜索引擎的爬虫如何处理这篇文章。如果设置了此值,它将在页面头部输出。更多内容请参考 [Google 文档](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)。 |
|
||||||
| `sharingLinks` | `article.sharingLinks` | 指定文章结尾显示哪些分享链接。如果没有设置或设置为 `false` ,则没有分享链接。 |
|
| `sharingLinks` | `article.sharingLinks` | 指定文章结尾显示哪些分享链接。如果没有设置或设置为 `false` ,则没有分享链接。 |
|
||||||
| `showAuthor` | `article.showAuthor` | 是否在页脚处显示作者框。 |
|
| `showAuthor` | `article.showAuthor` | 是否在页脚处显示作者框。 |
|
||||||
| `authors` | 无 | 用于展示多作者的数组,如果设置了将会覆盖 `showAuthor` 设置。这里使用了多作者的特性,查看[这个页面]({{< ref "multi-author" >}})来获取更多信息。 |
|
| `authors` | 无 | 用于展示多创作者的数组,如果设置了将会覆盖 `showAuthor` 设置。这里使用了多作者的特性,查看[这个页面]({{< ref "multi-author" >}})来获取更多信息。 |
|
||||||
| `showAuthorsBadges` | `article.showAuthorsBadges` | 是否在文章和列表页展示`authors`作者分类。想是它生效需要开启`multiple authors`多作者和 `authors` 作者分类。 查看[这个页面]({{< ref "multi-author" >}})来获取更多信息。 |
|
| `showAuthorsBadges` | `article.showAuthorsBadges` | 是否在文章和列表页展示`authors`作者分类。想是它生效需要开启`multiple authors`多创作者和 `authors` 作者分类。 查看[这个页面]({{< ref "multi-author" >}})来获取更多信息。 |
|
||||||
| `featureimage` | 无 | 基于外部 URL 的 feature 图片链接。
|
| `featureimage` | 无 | 基于外部 URL 的特征图片链接。
|
||||||
| `featureimagecaption` | 无 | feature 图片的说明,仅在 hero 样式的 `big` 风格下展示。
|
| `featureimagecaption` | 无 | 特征图片的说明,仅在 hero 样式的 `big` 风格下展示。
|
||||||
| `showHero` | `article.showHero` | 是否在文章页面将所裸土作为文章页面内的 hero 图片显示。 |
|
| `showHero` | `article.showHero` | 是否在文章页面将所裸土作为文章页面内的 hero 图片显示。 |
|
||||||
| `heroStyle` | `article.heroStyle` | hero 图片的风格,合法的值有: `basic`、`big`、`background`、`thumbAndBackground`。 |
|
| `heroStyle` | `article.heroStyle` | hero 图片的风格,合法的值有: `basic`、`big`、`background`、`thumbAndBackground`。 |
|
||||||
| `showBreadcrumbs` | `article.showBreadcrumbs` or `list.showBreadcrumbs` | 是否在文章或列表页面显示面包屑导航。 |
|
| `showBreadcrumbs` | `article.showBreadcrumbs` or `list.showBreadcrumbs` | 是否在文章或列表页面显示面包屑导航。 |
|
||||||
| `showDate` | `article.showDate` | 是否显示文章的日期。具体日期使用 `date` 参数设置。 |
|
| `showDate` | `article.showDate` | 是否显示文章的日期。具体日期使用 `date` 参数设置。 |
|
||||||
| `showDateUpdated` | `article.showDateUpdated` | 是否显示文章的更新日期。具体日期使用 `lastmod` 参数设置。 |
|
| `showDateUpdated` | `article.showDateUpdated` | 是否显示文章的更新日期。具体日期使用 `lastmod` 参数设置。 |
|
||||||
| `showEdit` | `article.showEdit` | 是否显示编辑文章内容的链接。 |
|
| `showEdit` | `article.showEdit` | 是否显示编辑文章内容的链接。 |
|
||||||
| `showHeadingAnchors` | `article.showHeadingAnchors` | 是否在文章的标题旁显示锚点链接。 |
|
| `showHeadingAnchors` | `article.showHeadingAnchors` | 是否在文章的标题旁显示锚点链接。 |
|
||||||
| `showPagination` | `article.showPagination` | 是否在文章页脚显示下一篇/上一篇链接。 |
|
| `showPagination` | `article.showPagination` | 是否在文章页脚显示下一篇/上一篇链接。 |
|
||||||
| `invertPagination` | `article.invertPagination` | 是否翻转下一篇/上一篇的链接方向。 |
|
| `invertPagination` | `article.invertPagination` | 是否翻转下一篇/上一篇的链接方向。 |
|
||||||
| `showReadingTime` | `article.showReadingTime` | 是否显示文章的预估阅读时间。 |
|
| `showReadingTime` | `article.showReadingTime` | 是否显示文章的预估阅读时间。 |
|
||||||
| `showTaxonomies` | `article.showTaxonomies` | 是否显示文章关联的分类/标签。 |
|
| `showTaxonomies` | `article.showTaxonomies` | 是否显示文章关联的分类/标签。 |
|
||||||
| `showTableOfContents` | `article.showTableOfContents` | 是否显示文章目录。 |
|
| `showTableOfContents` | `article.showTableOfContents` | 是否显示文章目录。 |
|
||||||
| `showWordCount` | `article.showWordCount` | 是否显示文章字数统计。如果你的语言属于 CJK 语言,需要在 `config.toml` 中开启 `hasCJKLanguage` 参数。 |
|
| `showWordCount` | `article.showWordCount` | 是否显示文章字数统计。如果你的语言属于 CJK 语言,需要在 `config.toml` 中开启 `hasCJKLanguage` 参数。 |
|
||||||
| `showComments` | `article.showComments` | 是否在文章页脚显示 [评论部分]({{< ref "partials#comments" >}})。 |
|
| `showComments` | `article.showComments` | 是否在文章页脚显示 [评论部分]({{< ref "partials#comments" >}})。 |
|
||||||
| `showSummary` | `list.showSummary` | 是否在文章或列表页显示摘要。 |
|
| `showSummary` | `list.showSummary` | 是否在文章或列表页显示摘要。 |
|
||||||
| `showViews` | `article.showViews` | 是否显示文章和列表页面的阅读量。这需要集成 firebase ,具体可以看[这个页面]({{< ref "firebase-views" >}})来了解如何在 Blowfish 中集成firebase。 |
|
| `showViews` | `article.showViews` | 是否显示文章和列表页面的阅读量。这需要集成 firebase ,具体可以看[这个页面]({{< ref "firebase-views" >}})来了解如何在 Blowfish 中集成firebase。 |
|
||||||
| `showLikes` | `article.showLikes` | 是否显示文章和列表页面的点赞量。这需要集成 firebase ,具体可以看[这个页面]({{< ref "firebase-views" >}})来了解如何在 Blowfish 中集成firebase。 |
|
| `showLikes` | `article.showLikes` | 是否显示文章和列表页面的点赞量。这需要集成 firebase ,具体可以看[这个页面]({{< ref "firebase-views" >}})来了解如何在 Blowfish 中集成firebase。 |
|
||||||
| `seriesOpened` | `article.seriesOpened` | 是否打开系列模块。 |
|
| `seriesOpened` | `article.seriesOpened` | 是否打开系列模块。 |
|
||||||
| `series` | 无 | 文章所属的系列数组,我们建议每篇文章只属于一个系列。 |
|
| `series` | 无 | 文章所属的系列数组,我们建议每篇文章只属于一个系列。 |
|
||||||
| `series_order` | 无 | 文章在系列中的编号。 |
|
| `series_order` | 无 | 文章在系列中的编号。 |
|
||||||
| `summary` | Auto generated using `summaryLength` (see [site configuration]({{< ref "configuration#site-configuration" >}})) | 当启用 `showSummary` 时,这是作为这篇文章摘要的Markdown字符串。 |
|
| `summary` | Auto generated using `summaryLength` (see [site configuration]({{< ref "configuration#site-configuration" >}})) | 当启用 `showSummary` 时,这是作为这篇文章摘要的Markdown字符串。 |
|
||||||
| `xml` | `true` unless excluded by `sitemap.excludedKinds` | 是否将这篇文章包含在生成的 `/sitemap.xml` 文件中。 |
|
| `xml` | `true` unless excluded by `sitemap.excludedKinds` | 是否将这篇文章包含在生成的 `/sitemap.xml` 文件中。 |
|
||||||
| `layoutBackgroundBlur` | `true` | 向下滚动主页时,是否模糊背景图。 |
|
| `layoutBackgroundBlur` | `true` | 向下滚动主页时,是否模糊背景图。 |
|
||||||
| `layoutBackgroundHeaderSpace` | `true` | 在标题和正文之间添加空白区域间隔。 |
|
| `layoutBackgroundHeaderSpace` | `true` | 在标题和正文之间添加空白区域间隔。 |
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
100
exampleSite/content/docs/multi-author/index.zh-cn.md
Normal file
100
exampleSite/content/docs/multi-author/index.zh-cn.md
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
---
|
||||||
|
title: "多创作者模式"
|
||||||
|
date: 2020-08-10
|
||||||
|
draft: false
|
||||||
|
description: "为你的文章设置多个作者。"
|
||||||
|
slug: "multi-author"
|
||||||
|
tags: ["作者", "配置", "文档"]
|
||||||
|
series: ["文档集"]
|
||||||
|
series_order: 10
|
||||||
|
showAuthor: true
|
||||||
|
authors:
|
||||||
|
- "nunocoracao"
|
||||||
|
showAuthorsBadges : false
|
||||||
|
---
|
||||||
|
|
||||||
|
一个网站会有多个创作者共同贡献内容,所以需要再整个网站中默认使用多创作者。对于这种情况,Blowfish 允许用户使用多创作者功能拓展创作者列表。
|
||||||
|
|
||||||
|
为了保持向后兼容,这个功能仅允许定义额外的创作者,并不会以任何方式修改之前通过配置文件添加的创作者。
|
||||||
|
|
||||||
|
## 新建创作者
|
||||||
|
|
||||||
|
新建创作者的第一步是设置一个 `./data/authors` 文件夹。然后,你可以在里面简单的添加新创作者的 `json` 文件。文件的名称是你在文章引用该作者时需要指定的 `key`。
|
||||||
|
|
||||||
|
例如,在 `./data/authors` 文件夹中新建一个 `nunocoracao.json` 文件。文件的内容示例如下。`name`、`image`、`bio` 和 `social` 是目前创作者文件支持的4个参数,这与你在 `languages.[language-code].toml` 配置文件中的默认创作者配置类似。
|
||||||
|
|
||||||
|
_注意:社交参数中的 `key` 将会默认获取主题的图标 icon,当然你也可以在 `assests/icons` 文件夹中设置任何图标。_
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "Nuno Coração",
|
||||||
|
"image" : "img/nuno_avatar.jpg",
|
||||||
|
"bio": "Theme Creator",
|
||||||
|
"social": [
|
||||||
|
{ "linkedin": "https://linkedin.com/in/nunocoracao" },
|
||||||
|
{ "twitter": "https://twitter.com/nunocoracao" },
|
||||||
|
{ "instagram": "https://instagram.com/nunocoracao" },
|
||||||
|
{ "medium": "https://medium.com/@nunocoracao" },
|
||||||
|
{ "github": "https://github.com/nunocoracao" },
|
||||||
|
{ "goodreads": "http://goodreads.com/nunocoracao" },
|
||||||
|
{ "keybase": "https://keybase.io/nunocoracao" },
|
||||||
|
{ "reddit": "https://reddit.com/user/nunoheart" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 在文章中引用创作者
|
||||||
|
|
||||||
|
你已经新建好了创作者,下一步让我们在文章中引用它。在下面的实例中,我们使用前面新建的创作者 `key` 来引用它。
|
||||||
|
|
||||||
|
Blowfish 将会使用额外创作者对应`json`文件中的数据,以帮助在文章中渲染此作者。这个功能不会以改变整个站点配置的默认作者,因此你可以分别控制他们。使用 `showAuthor` 参数,可以配置是否显示默认作者,这适用于单创作者的博客。扉页中的 `authors` 参数允许你为文章定义额外的创作者,这里的创作者将独立于整个站点中的默认创作者。
|
||||||
|
|
||||||
|
```md
|
||||||
|
---
|
||||||
|
title: "多创作者"
|
||||||
|
date: 2020-08-10
|
||||||
|
draft: false
|
||||||
|
description: "为你的文章设置多个作者。"
|
||||||
|
slug: "multi-author"
|
||||||
|
tags: ["authors", "config", "docs"]
|
||||||
|
showAuthor: true
|
||||||
|
authors:
|
||||||
|
- "nunocoracao"
|
||||||
|
showAuthorsBadges : false
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
上面这个示例和当前这个页面一样,将显示默认创作者和新创作者。你可以滚动此页面来查看实际效果。
|
||||||
|
|
||||||
|
## 新建创作者分类法
|
||||||
|
|
||||||
|
如果你想要获取每个作者的文章列表,需要配置 `authors` 分类,这会让你了解到一些更有趣的配置。这个是多创作者模式中的一个可选步骤。
|
||||||
|
To get lists of articles for each of your authors you can configure the `authors` taxonomy, which opens up some more configurations that might be interesting. This is an optional step in the process that is not required to display the authors in your articles.
|
||||||
|
|
||||||
|
第一步是在 `config.toml` 文件中配置 `authors` 分类法,如下所示。尽管 `tag` 和 `category` 默认是 Hugo 定义的,但只要你添加了一个特定的分类法,就需要显式添加 `tag` 和 `category`,否则基于 Hugo 的文件加载顺序,站点将不会处理 `tag` 和 `category`。
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[taxonomies]
|
||||||
|
tag = "tags"
|
||||||
|
category = "categories"
|
||||||
|
author = "authors"
|
||||||
|
```
|
||||||
|
|
||||||
|
这样一来,你将会有一个所有创作者列表的页面,并且每个创作者都会显示他们参与创作的文章列表。如果你想在每个文章中以徽章的形式中展示作者,有两种方式:在全局配置文件添加 `article.showAuthorsBadges` 参数 或 在每篇文章的扉页参数中配置 `showAuthorsBadges`参数。
|
||||||
|
|
||||||
|
最后,你可以为每个创作者页面添加更多细节内容,以便显示简介、链接或者适合你需求的任何其他信息。为了实现这一点,需要在 `./content/authors` 文件夹中为每个创作者添加一个目录名为 `key` 的文件夹,并在文件夹中添加 `_index.md` 文件,对于上面的例子,我们会得到一个 `.content/authors/nunocoracao/_index.md` 文件。在这个文件中你可以添加创作者的实际姓名和他们自己的个人信息页面。本文档站点中的作者就是这么配置的,你可以在文档站点中查看实际效果。
|
||||||
|
|
||||||
|
```md
|
||||||
|
---
|
||||||
|
title: "Nuno Coração"
|
||||||
|
---
|
||||||
|
|
||||||
|
Nuno's awesome dummy bio.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## 示例
|
||||||
|
|
||||||
|
下面这个示例,介绍了演示了如何关闭站点默认创作者,并在文章中添加多创作者。
|
||||||
|
|
||||||
|
{{< article link="/samples/multiple-authors/" >}}
|
46
exampleSite/content/docs/thumbnails/index.zh-cn.md
Normal file
46
exampleSite/content/docs/thumbnails/index.zh-cn.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
---
|
||||||
|
title: "缩略图"
|
||||||
|
date: 2020-08-10
|
||||||
|
draft: false
|
||||||
|
description: "为你的文章配置缩略图。"
|
||||||
|
slug: "thumbnails"
|
||||||
|
tags: ["缩略图", "配置", "文档"]
|
||||||
|
series: ["文档集"]
|
||||||
|
series_order: 6
|
||||||
|
---
|
||||||
|
|
||||||
|
## 缩略图
|
||||||
|
|
||||||
|
Blowfish 对视觉支持进行了增强,可以让你轻松地为文章添加缩略图。你只需要将一个以 `feature*` 开头的图像文件(支持几乎所有格式,但更推荐 `.png` 或 `.jpg`)放置在文章所在的目录中,如下面所示:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
content
|
||||||
|
└── awesome_article
|
||||||
|
├── index.md
|
||||||
|
└── featured.png
|
||||||
|
```
|
||||||
|
|
||||||
|
这将告诉 Blowfish 这篇文章有一个特征图片,这个图片可以在网站作为缩略图使用,也可以用于社交平台上的 <a target="_blank" href="https://oembed.com/">oEmbed</a> 卡片。
|
||||||
|
|
||||||
|
## 文件结构
|
||||||
|
|
||||||
|
如果你仅仅使用一个 `.md` 文件作为文章,文件结构如下所示:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
content
|
||||||
|
└── awesome_article.md
|
||||||
|
```
|
||||||
|
|
||||||
|
如果想添加缩略图,你需要将单个 Markdown 文件放在文件夹中。创建一个与文章同名的目录,在其中创建 `index.md` 文件。文件结构如下所示:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
content
|
||||||
|
└── awesome_article
|
||||||
|
└── index.md
|
||||||
|
```
|
||||||
|
|
||||||
|
然后你只需要像之前那样添加一个特征图片。如果你想看示例,你可以参 [这个示例]({{< ref "thumbnail_sample" >}})。
|
||||||
|
|
||||||
|
## Hero 图片
|
||||||
|
|
||||||
|
缩略图将默认用作每篇文章的 hero 图片。开启此功能,可以使用全局的 `article.showHero` 参数来控制整个站点所有文章,或者扉页参数 `showHero` 来控制其中一个文章。如果你想覆盖 hero 图片的样式,你可以在 `./layouts/partials/` 文件夹中创建一个名为 `hero.html` 的文件,它会覆盖主题中的默认部分。
|
Loading…
Reference in a new issue