new feature: external link post
This commit is contained in:
parent
e664d42571
commit
b4031adcd6
8 changed files with 53 additions and 5 deletions
18
README.md
18
README.md
|
@ -50,6 +50,7 @@ Follow [exampleSite/config.toml](https://github.com/Mivinci/hugo-theme-minima/bl
|
||||||
| title | string | Title of the post |
|
| title | string | Title of the post |
|
||||||
| description | string | Description of the post |
|
| description | string | Description of the post |
|
||||||
| date | string | Datetime when the post is written |
|
| date | string | Datetime when the post is written |
|
||||||
|
| link | string | If set, the post will redirect to an external link |
|
||||||
| categories | array | Array of categories the posts belongs to |
|
| categories | array | Array of categories the posts belongs to |
|
||||||
| series | array | Array of series the post belongs to |
|
| series | array | Array of series the post belongs to |
|
||||||
| tags | array | Array of tags the posts is related to |
|
| tags | array | Array of tags the posts is related to |
|
||||||
|
@ -59,6 +60,23 @@ Follow [exampleSite/config.toml](https://github.com/Mivinci/hugo-theme-minima/bl
|
||||||
| draft | bool | True if the post isn't already for publishing |
|
| draft | bool | True if the post isn't already for publishing |
|
||||||
| toc | bool | True if the post needs a ToC |
|
| toc | bool | True if the post needs a ToC |
|
||||||
|
|
||||||
|
### External Link Post
|
||||||
|
|
||||||
|
Use the `link` in the front matter to make a post a specific external link. Such external link post will redirect to the link provided.
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
author: XJJ
|
||||||
|
title: External Link Post
|
||||||
|
date: 2021-07-17T10:52:59+08:00
|
||||||
|
link: https://gohugo.io
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
And when you click the title in the list page, you will be redireted to https://gohugo.io which's 🆒.
|
||||||
|
|
||||||
### Feedback
|
### Feedback
|
||||||
|
|
||||||
Feedbacks are welcome [here](https://github.com/Mivinci/hugo-theme-minima/issues).
|
Feedbacks are welcome [here](https://github.com/Mivinci/hugo-theme-minima/issues).
|
||||||
|
|
|
@ -51,10 +51,11 @@ git clone https://github.com/mivinci/hugo-theme-minima.git themes/minima
|
||||||
为缩短博客网页的加载和渲染时间,minima 不支持如公式、图表、评论插件的全局配置,需要在每篇文章中设置是否启用相关插件,以下是 minima 目前支持的文章配置。
|
为缩短博客网页的加载和渲染时间,minima 不支持如公式、图表、评论插件的全局配置,需要在每篇文章中设置是否启用相关插件,以下是 minima 目前支持的文章配置。
|
||||||
|
|
||||||
| 字段 | 类型 | 解释 |
|
| 字段 | 类型 | 解释 |
|
||||||
| ----------- | ------ | --------------------------------- |
|
|:----------- |:------ |:--------------------------------- |
|
||||||
| title | string | 文章标题 |
|
| title | string | 文章标题 |
|
||||||
| description | string | 文章简介,会显示在标题和正文之间 |
|
| description | string | 文章简介,会显示在标题和正文之间 |
|
||||||
| date | string | 文章创建日期 |
|
| date | string | 文章创建日期 |
|
||||||
|
| link | string | 外部链接 |
|
||||||
| categories | array | 文章分类 |
|
| categories | array | 文章分类 |
|
||||||
| series | array | 文章专栏 |
|
| series | array | 文章专栏 |
|
||||||
| tags | array | 文章标签 |
|
| tags | array | 文章标签 |
|
||||||
|
@ -64,6 +65,24 @@ git clone https://github.com/mivinci/hugo-theme-minima.git themes/minima
|
||||||
| draft | bool | true:该篇文章为草稿,不会被打包 |
|
| draft | bool | true:该篇文章为草稿,不会被打包 |
|
||||||
| toc | bool | true:为该篇文章开启目录显示 |
|
| toc | bool | true:为该篇文章开启目录显示 |
|
||||||
|
|
||||||
|
|
||||||
|
### 外部链接
|
||||||
|
|
||||||
|
可在 front matter 中通过设置 `link` 来创建外部链接。
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
author: XJJ
|
||||||
|
title: External Link Post
|
||||||
|
date: 2021-07-17T10:52:59+08:00
|
||||||
|
link: https://gohugo.io
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
当点击改文章题目时,会跳转到设置的链接地址 https://gohugo.io,🆒
|
||||||
|
|
||||||
### 反馈
|
### 反馈
|
||||||
|
|
||||||
欢迎在 [issues](https://github.com/Mivinci/hugo-theme-minima/issues) 下留言,或将问题详细描述发送到我的邮箱:mivinci@qq.com
|
欢迎在 [issues](https://github.com/Mivinci/hugo-theme-minima/issues) 下留言,或将问题详细描述发送到我的邮箱:mivinci@qq.com
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: "About"
|
title: "About"
|
||||||
date: 2021-07-16T11:24:06+08:00
|
date: 2021-07-10T11:24:06+08:00
|
||||||
draft: false
|
draft: false
|
||||||
type: about
|
type: about
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
author: XJJ
|
author: XJJ
|
||||||
title: 中文测试
|
title: 中文测试
|
||||||
date: 2021-07-17T10:52:59+08:00
|
date: 2021-07-16T10:52:59+08:00
|
||||||
description:
|
description:
|
||||||
comment: false
|
comment: false
|
||||||
---
|
---
|
||||||
|
|
7
exampleSite/content/link.md
Normal file
7
exampleSite/content/link.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
author: XJJ
|
||||||
|
title: External Link Post
|
||||||
|
date: 2021-07-17T10:52:59+08:00
|
||||||
|
description:
|
||||||
|
link: https://gohugo.io
|
||||||
|
---
|
|
@ -1,7 +1,7 @@
|
||||||
+++
|
+++
|
||||||
author = "Hugo Authors"
|
author = "Hugo Authors"
|
||||||
title = "Placeholder Text"
|
title = "Placeholder Text"
|
||||||
date = "2021-07-18T10:52:59+08:00"
|
date = "2021-07-11T10:52:59+08:00"
|
||||||
description = "Lorem Ipsum Dolor Si Amet"
|
description = "Lorem Ipsum Dolor Si Amet"
|
||||||
toc = true
|
toc = true
|
||||||
categories = ["Markdown"]
|
categories = ["Markdown"]
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<div class="flex justify-between sm:flex-col-reverse my-4 sm:mb-6 sm:mt-3">
|
<div class="flex justify-between sm:flex-col-reverse my-4 sm:mb-6 sm:mt-3">
|
||||||
|
{{ if .Page.Params.link }}
|
||||||
|
<a class="" href="{{ .Page.Params.link }}">{{ .Title }}</a>
|
||||||
|
{{ else }}
|
||||||
<a class="" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
<a class="" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
|
{{ end }}
|
||||||
{{ if .Site.Params.displayDate }}
|
{{ if .Site.Params.displayDate }}
|
||||||
<div class="sm:mb-2 sm:text-sm">{{ dateFormat .Site.Params.timeformat .Date }}</div>
|
<div class="sm:mb-2 sm:text-sm">{{ dateFormat .Site.Params.timeformat .Date }}</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -7,7 +7,7 @@ licenselink = "https://github.com/mivinci/minima/blob/master/LICENSE"
|
||||||
description = "A Hugo port of Hexo Minima"
|
description = "A Hugo port of Hexo Minima"
|
||||||
homepage = "https://github.com/mivinci/hugo-theme-minima"
|
homepage = "https://github.com/mivinci/hugo-theme-minima"
|
||||||
tags = ["minimal", "clean", "blog", "responsive", "personal", "simple", "minimalist", "portfolio", "dark"]
|
tags = ["minimal", "clean", "blog", "responsive", "personal", "simple", "minimalist", "portfolio", "dark"]
|
||||||
features = ["Dark mode", "KaTeX", "Mermaid", "VSCode-style code highlighting"]
|
features = ["Dark mode", "KaTeX", "Mermaid", "VSCode-style code highlighting", "External link post"]
|
||||||
min_version = "0.41.0"
|
min_version = "0.41.0"
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
|
|
Loading…
Reference in a new issue