mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-15 11:44:44 -04:00
Add id attributes to GitInfo, File, and Resources methods
This commit is contained in:
parent
b12d9cb8fa
commit
2a1adea798
@ -1,5 +1,6 @@
|
||||
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
|
||||
|
||||
MD001: false
|
||||
MD002: false
|
||||
MD003: false
|
||||
MD004: false
|
||||
|
@ -30,8 +30,9 @@ Code defensively by verifying file existence as shown in each of the examples be
|
||||
The path separators (slash or backslash) in `Path`, `Dir`, and `Filename` depend on the operating system.
|
||||
{{% /note %}}
|
||||
|
||||
BaseFileName
|
||||
: (`string`) The file name, excluding the extension.
|
||||
###### BaseFileName
|
||||
|
||||
(`string`) The file name, excluding the extension.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -39,8 +40,9 @@ BaseFileName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
ContentBaseName
|
||||
: (`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.
|
||||
###### ContentBaseName
|
||||
|
||||
(`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -48,8 +50,9 @@ ContentBaseName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Dir
|
||||
: (`string`) The file path, excluding the file name, relative to the `content` directory.
|
||||
###### Dir
|
||||
|
||||
(`string`) The file path, excluding the file name, relative to the `content` directory.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -57,8 +60,9 @@ Dir
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Ext
|
||||
: (`string`) The file extension.
|
||||
###### Ext
|
||||
|
||||
(`string`) The file extension.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -66,8 +70,9 @@ Ext
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Filename
|
||||
: (`string`) The absolute file path.
|
||||
###### Filename
|
||||
|
||||
(`string`) The absolute file path.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -75,8 +80,9 @@ Filename
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Lang
|
||||
: (`string`) The language associated with the given file.
|
||||
###### Lang
|
||||
|
||||
(`string`) The language associated with the given file.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -84,8 +90,9 @@ Lang
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
LogicalName
|
||||
: (`string`) The file name.
|
||||
###### LogicalName
|
||||
|
||||
(`string`) The file name.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -93,8 +100,9 @@ LogicalName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Path
|
||||
: (`string`) The file path, relative to the `content` directory.
|
||||
###### Path
|
||||
|
||||
(`string`) The file path, relative to the `content` directory.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -102,8 +110,9 @@ Path
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
TranslationBaseName
|
||||
: (`string`) The file name, excluding the extension and language identifier.
|
||||
###### TranslationBaseName
|
||||
|
||||
(`string`) The file name, excluding the extension and language identifier.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@ -111,8 +120,9 @@ TranslationBaseName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
UniqueID
|
||||
: (`string`) The MD5 hash of `.File.Path`.
|
||||
###### UniqueID
|
||||
|
||||
(`string`) The MD5 hash of `.File.Path`.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
|
@ -43,8 +43,9 @@ This is configurable. See [details].
|
||||
|
||||
## Methods
|
||||
|
||||
AbbreviatedHash
|
||||
: (`string`) The abbreviated commit hash.
|
||||
###### AbbreviatedHash
|
||||
|
||||
(`string`) The abbreviated commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@ -52,8 +53,9 @@ AbbreviatedHash
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorDate
|
||||
: (`time.Time`) The author date.
|
||||
###### AuthorDate
|
||||
|
||||
(`time.Time`) The author date.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@ -61,17 +63,9 @@ AuthorDate
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
CommitDate
|
||||
: (`time.Time`) The commit date.
|
||||
###### AuthorEmail
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
{{ .CommitDate.Format "2006-01-02" }} → 2023-10-09
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorEmail
|
||||
: (`string`) The author's email address, respecting [gitmailmap].
|
||||
(`string`) The author's email address, respecting [gitmailmap].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@ -79,8 +73,9 @@ AuthorEmail
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorName
|
||||
: (`string`) The author's name, respecting [gitmailmap].
|
||||
###### AuthorName
|
||||
|
||||
(`string`) The author's name, respecting [gitmailmap].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@ -88,8 +83,19 @@ AuthorName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Hash
|
||||
: (`string`) The commit hash.
|
||||
###### CommitDate
|
||||
|
||||
(`time.Time`) The commit date.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
{{ .CommitDate.Format "2006-01-02" }} → 2023-10-09
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
###### Hash
|
||||
|
||||
(`string`) The commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@ -97,8 +103,9 @@ Hash
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Subject
|
||||
: (`string`) The commit message subject.
|
||||
###### Subject
|
||||
|
||||
(`string`) The commit message subject.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
|
@ -21,8 +21,9 @@ To work with global or remote resources, see the [`resources`] functions.
|
||||
|
||||
## Methods
|
||||
|
||||
ByType
|
||||
: (`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
|
||||
###### ByType
|
||||
|
||||
(`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
|
||||
|
||||
```go-html-template
|
||||
{{ range .Resources.ByType "image" }}
|
||||
@ -32,8 +33,9 @@ ByType
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.ByType`] function.
|
||||
|
||||
Get
|
||||
: (`resource.Resource`) Returns a page resource from the given path, or nil if none found.
|
||||
###### Get
|
||||
|
||||
(`resource.Resource`) Returns a page resource from the given path, or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.Get "images/a.jpg" }}
|
||||
@ -43,8 +45,9 @@ Get
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.Get`] function.
|
||||
|
||||
GetMatch
|
||||
: (`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
|
||||
###### GetMatch
|
||||
|
||||
(`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.GetMatch "images/*.jpg" }}
|
||||
@ -54,8 +57,9 @@ GetMatch
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.GetMatch`] function.
|
||||
|
||||
Match
|
||||
: (`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
|
||||
###### Match
|
||||
|
||||
(`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ range .Resources.Match "images/*.jpg" }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user