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

---
`Params` 方法用于[page resource](g)（页面资源），不适用于[global resource](g)（全局资源）或[remote resource](g)（远程资源）。

有如下内容结构：

```tree
content/
├── posts/
│   ├── cats/
│   │   ├── images/
│   │   │   └── a.jpg
│   │   └── index.md
│   └── _index.md
└── _index.md
```

以及如下前置元数据：

```toml
title = 'Cats'
[[resources]]
  src = 'images/a.jpg'
  title = 'Felix the cat'
  [resources.params]
    alt = 'Photograph of black cat'
    temperament = 'vicious'
```

以及这个模板：

```go-html-template
{{ with .Resources.Get "images/a.jpg" }}
  <figure>
    <img alt="{{ .Params.alt }}" src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
    <figcaption>{{ .Title }} is {{ .Params.temperament }}</figcaption>
  </figure>
{{ end }}
```

Hugo 渲染为：

```html
<figure>
  <img alt="Photograph of black cat" src="/posts/post-1/images/a.jpg" width="600" height="400">
  <figcaption>Felix the cat is vicious</figcaption>
</figure>
```

更多信息请参见[页面资源][]一节。

[页面资源]: /content-management/page-resources/

