resources.GetMatch
返回路径匹配给定 glob 模式的第一个全局资源;找不到时返回 nil。
{{ with resources.GetMatch "images/*.jpg" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}Hugo 用大小写不敏感的 glob 模式判断是否匹配。语法规则与示例见 glob 模式速查表。
返回路径匹配给定 glob 模式的第一个全局资源;找不到时返回 nil。
{{ with resources.GetMatch "images/*.jpg" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}Hugo 用大小写不敏感的 glob 模式判断是否匹配。语法规则与示例见 glob 模式速查表。