HUGO
Menu
GitHub 87548 stars Mastodon

Height

适用于图像,返回给定资源的高度。

Syntax

RESOURCE.Height

Returns

int

此方法可用于 全局资源页面资源远程资源

{{ with resources.Get "images/a.jpg" }}
  {{ .Height }} → 400
{{ end }}

渲染 img 元素时一起使用 WidthHeight 方法:

{{ with resources.Get "images/a.jpg" }}
  <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{ end }}

Last updated: January 1, 0001
Improve this page