# IsNamedParams
> 报告短代码调用是否使用命名参数。
- 官方英文原文：https://gohugo.io/methods/shortcode/isnamedparams/
- 本页规范地址：https://hugozh.cn/methods/shortcode/isnamedparams/
- 最近更新：2026-10-02
- 最后提交：912b1d3 chore(site): 添加 static/CNAME（hugozh.cn），供 GitHub Pages 等平台绑定自定义域名
- 签名：SHORTCODE.IsNamedParams
- 返回类型：bool
- 站点：Hugo 中文文档（https://hugozh.cn/）· 社区维护的非官方中文翻译，如有出入以官方英文原文为准

---
要让短代码调用同时支持位置参数和命名参数，可以用 `IsNamedParams` 方法判断短代码是以哪种方式调用的。

使用这个_短代码_模板：

```go-html-template {file="layouts/_shortcodes/myshortcode.html"}
{{ if .IsNamedParams }}
  {{ printf "%s %s." (.Get "greeting") (.Get "firstName") }}
{{ else }}
  {{ printf "%s %s." (.Get 0) (.Get 1) }}
{{ end }}
```

下面两个调用返回相同的值：

```md {file="content/about.md"}
```

