# Params
> 返回给定页面前置元数据中定义的自定义参数映射。
- 官方英文原文：https://gohugo.io/methods/page/params/
- 本页规范地址：https://hugozh.cn/methods/page/params/
- 最近更新：2026-10-02
- 最后提交：912b1d3 chore(site): 添加 static/CNAME（hugozh.cn），供 GitHub Pages 等平台绑定自定义域名
- 签名：PAGE.Params
- 返回类型：maps.Params
- 站点：Hugo 中文文档（https://hugozh.cn/）· 社区维护的非官方中文翻译，如有出入以官方英文原文为准

---
举例来说，考虑下面这段前置元数据：

```toml
title = 'Annual conference'
date = 2023-10-17T15:11:37-07:00
[params]
display_related = true
key-with-hyphens = 'must use index function'
[params.author]
  email = 'jsmith@example.org'
  name = 'John Smith'
```

`title` 和 `date` 是标准的[前置元数据字段][]，其余字段则由用户自定义。

需要时，可以通过[链式](g)书写[标识符](g)来访问这些自定义字段：

```go-html-template
{{ .Params.display_related }} → true
{{ .Params.author.email }} → jsmith@example.org
{{ .Params.author.name }} → John Smith
```

在上面的模板示例中，每个 key 都是合法的标识符。例如，没有一个 key 含连字符。要访问不是合法标识符的 key，请使用 [`index`][] 函数：

```go-html-template
{{ index .Params "key-with-hyphens" }} → must use index function
```

[`index`]: /functions/collections/indexfunction/
[front matter fields]: /content-management/front-matter/#fields

