diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-02-25 21:40:02 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-04-07 21:59:20 +0200 |
commit | 2f721f8ec69c52202815cd1b543ca4bf535c0901 (patch) | |
tree | cae7d1ee9ce867a4bffc70e94513f09e2aebe162 /resources/resource | |
parent | 8568928aa8e82a6bd7de4555c3703d8835fbd25b (diff) | |
download | hugo-2f721f8ec69c52202815cd1b543ca4bf535c0901.tar.gz hugo-2f721f8ec69c52202815cd1b543ca4bf535c0901.zip |
Add basic "post resource publish support"
Fixes #7146
Diffstat (limited to 'resources/resource')
-rw-r--r-- | resources/resource/resourcetypes.go | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/resources/resource/resourcetypes.go b/resources/resource/resourcetypes.go index b525d7d55..62431c06c 100644 --- a/resources/resource/resourcetypes.go +++ b/resources/resource/resourcetypes.go @@ -28,9 +28,17 @@ type Cloner interface { Clone() Resource } +// OriginProvider provides the original Resource if this is wrapped. +// This is an internal Hugo interface and not meant for use in the templates. +type OriginProvider interface { + Origin() Resource + GetFieldString(pattern string) (string, bool) +} + // Resource represents a linkable resource, i.e. a content page, image etc. type Resource interface { - ResourceTypesProvider + ResourceTypeProvider + MediaTypeProvider ResourceLinksProvider ResourceMetaProvider ResourceParamsProvider @@ -53,16 +61,23 @@ type ImageOps interface { Exif() (*exif.Exif, error) } -type ResourceTypesProvider interface { - // MediaType is this resource's MIME type. - MediaType() media.Type - +type ResourceTypeProvider interface { // ResourceType is the resource type. For most file types, this is the main // part of the MIME type, e.g. "image", "application", "text" etc. // For content pages, this value is "page". ResourceType() string } +type ResourceTypesProvider interface { + ResourceTypeProvider + MediaTypeProvider +} + +type MediaTypeProvider interface { + // MediaType is this resource's MIME type. + MediaType() media.Type +} + type ResourceLinksProvider interface { // Permalink represents the absolute link to this resource. Permalink() string |