主题文档 - 内容
内容组织
.
└── content
└── posts
└── my-first-post
└── my-first-post.md
技巧
所有的文章都放在 content/posts 目录下,基础语法可以参考Hugo Content Management
扩展 Shortcodes
语法高亮
在原有的语法的基础上增加了新的能力。
代码
package main
import "fmt"
func main() {
fmt.Println("Hello Go")
}
```go {title="main.go"}
package main
import "fmt"
func main() {
fmt.Println("Hello Go")
}
```
技巧
在原生的基础上增加了 title 属性,可以给每个高亮增加标题。
脚本
CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latest
```shell {title="安装脚本"}
CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latest
```
输出
total 72
drwxr-xr-x 3 langwan staff 96 12 16 07:06 assets
-rw-r--r-- 1 langwan staff 356 12 17 08:45 config.yaml
drwxr-xr-x 3 langwan staff 96 12 16 05:50 content
drwxr-xr-x 13 langwan staff 416 12 17 00:58 public
drwxr-xr-x 3 langwan staff 96 12 16 05:50 resources
-rw-r--r--@ 1 langwan staff 5178 12 17 07:16 syntax.css
```output {title="输出"}
total 72
drwxr-xr-x 3 langwan staff 96 12 16 07:06 assets
-rw-r--r-- 1 langwan staff 356 12 17 08:45 config.yaml
drwxr-xr-x 3 langwan staff 96 12 16 05:50 content
drwxr-xr-x 13 langwan staff 416 12 17 00:58 public
drwxr-xr-x 3 langwan staff 96 12 16 05:50 resources
-rw-r--r--@ 1 langwan staff 5178 12 17 07:16 syntax.css
```
github 代码
package main
import "fmt"
func main() {
fmt.Println("Hello Go")
}
```go {github="https://github.com/langwan/chigo/blob/main/Hello/main.go"}
```
技巧
填写一个 github 属性就可以直接显示 github 上的代码,修改 github 上的代码会直接更新,无需修改文章。点中间的链接可以直接跳到 github 上的代码和仓库上。
横幅
注意
一个 注意 横幅
摘要
一个 摘要 横幅
信息
一个 信息 横幅
技巧
一个 技巧 横幅
成功
一个 成功 横幅
问题
一个 成功 横幅
警告
一个 成功 横幅
失败
一个 成功 横幅
危险
一个 成功 横幅
Bug
一个 成功 横幅
示例
一个 成功 横幅
引用
一个 成功 横幅
{{< admonition type=tip >}}
一个 **技巧** 横幅
{{< /admonition >}}
{{< admonition abstract >}}
一个 **摘要** 横幅
{{< / admonition >}}
{{< admonition info >}}
一个 **信息** 横幅
{{< / admonition >}}
{{< admonition tip >}}
一个 **技巧** 横幅
{{< / admonition >}}
{{< admonition success >}}
一个 **技巧** 横幅
{{< / admonition >}}
{{< admonition question >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition warning >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition failure >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition danger >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition bug >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition example >}}
一个 **成功** 横幅
{{< / admonition >}}
{{< admonition quote >}}
一个 **成功** 横幅
{{< / admonition >}}
Bilibili
{{< bilibili BV1EG411M7jP /*>}}
figure
{{< figure src="./images/figure.jpg" title=“雪国” >}}
{{</* figure src="./images/figure.jpg" title="雪国" >}}
引用
Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.