hugo.Deps

hugo.Deps 函數返回專案依賴項的切片,這些依賴可以是 Hugo 模組或本地主題組件。每個依賴包含以下資料:

  • Owner: (hugo.Dependency)這是定義此模組作為依賴的第一個模組(例如 github.com/gohugoio/hugo-mod-bootstrap-scss/v5)。
  • Path: (string)模組路徑或 themes 目錄下的路徑(例如 github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2)。
  • Replace: (hugo.Dependency)此依賴所替代的依賴。
  • Time: (time.Time)版本創建時間(例如 2022-02-13 15:11:28 +0000 UTC)。
  • Vendor: (bool)報告依賴是否為提供的版本。
  • Version: (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>