hugo.Deps
语法
hugo.Deps
返回值
[]hugo.Dependency
hugo.Deps
函数返回项目依赖项的切片,可以是 Hugo 模块或本地主题组件。每个依赖项包含
- 所有者
- (
hugo.Dependency
)在依赖树中,这是将此模块定义为依赖项的第一个模块(例如,github.com/gohugoio/hugo-mod-bootstrap-scss/v5
)。 - 路径
- (
string
)模块路径或themes
目录下的路径(例如,github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2
)。 - 替换
- (
hugo.Dependency
)被此依赖项替换。 - 时间
- (
time.Time
)创建版本的时间(例如,2022-02-13 15:11:28 +0000 UTC
)。 - 供应商
- (
bool
)报告依赖项是否已供应商化。 - 版本
- (
string
)模块版本(例如,v2.21100.20000
)。
一个列出依赖项的示例表
<h2>Dependencies</h2>
<table class="table table-dark">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Owner</th>
<th scope="col">Path</th>
<th scope="col">Version</th>
<th scope="col">Time</th>
<th scope="col">Vendor</th>
</tr>
</thead>
<tbody>
{{ range $index, $element := hugo.Deps }}
<tr>
<th scope="row">{{ add $index 1 }}</th>
<td>{{ with $element.Owner }}{{ .Path }}{{ end }}</td>
<td>
{{ $element.Path }}
{{ with $element.Replace }}
=> {{ .Path }}
{{ end }}
</td>
<td>{{ $element.Version }}</td>
<td>{{ with $element.Time }}{{ . }}{{ end }}</td>
<td>{{ $element.Vendor }}</td>
</tr>
{{ end }}
</tbody>
</table>