Add basic "post resource publish support"

Fixes #7146
This commit is contained in:
Bjørn Erik Pedersen
2020-02-25 21:40:02 +01:00
parent 8568928aa8
commit 2f721f8ec6
18 changed files with 619 additions and 36 deletions

View File

@@ -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