快轉到主要內容

API 索引


你可以把 Hugo 開發理解成 Hugo 語言,他封裝了 Go 語言的功能提供給模板使用,並且自行解析模板、reflect 變數,可以說是自成一家的語言了。Go 語言的功能僅有有限的提供,因此即使你熟悉 Go/Go template,使用 Hugo 還是得看文檔才會使用。

Hugo 的 API 分為兩種:Methods and Functions。Methods 是 stateful,綁定在物件上,如 .IsPage 是綁定在 .Page 物件上,functions 則為 stateless 可以直接呼叫,也能用於 archetype 中。

以下索引整理自 Hugo 官方文檔,本站不重複撰寫這些內容,直接連回官方頁面查閱即可。

Hugo Pipes

Methods

Duration

Menu entry

Output format

Page

Pager

Pages

Resource

Shortcode

Site

Taxonomy

Time

Functions

cast

collections

compare

crypto

css

debug

diagrams

encoding

fmt

global

go template

hash

hugo

images

inflect

js

lang

math

openapi3

os

partials

path

reflect

resources

safe

strings

templates

time

transform

urls

無障礙設定

字體大小