Documentation ¶
Index ¶
- Constants
- Variables
- type CacheConfig
- type Cloner
- type ContentProvider
- type Copier
- type DataProvider
- type DependenceSvc
- type ErrProvider
- type Fs
- type Giphy
- type Identifier
- type ImageConfig
- type ImageFormat
- type ImageResource
- type ImageResourceOps
- type LinksProvider
- type MediaTypeProvider
- type MediaTypesConfig
- type MetaProvider
- type MinifyConfig
- type NameNormalizedProvider
- type NameTitleProvider
- type OriginProvider
- type OutputFormatsConfig
- type ParamsProvider
- type PostPublishedResource
- type PublishSvc
- type ReadSeekCloserResource
- type Resource
- type ResourceCopier
- type ResourceError
- type ResourcePaths
- type Resources
- type SecurityConfig
- type SiteUrl
- type Source
- type TypeProvider
- type Workspace
Constants ¶
const ( KeyGetJSON = "getjson" KeyGetCSV = "getcsv" KeyImages = "images" KeyAssets = "assets" KeyModules = "modules" KeyGetResource = "getresource" )
const ( PostProcessPrefix = "__h_pp_l1" // The suffix has an '=' in it to prevent the minifier to remove any enclosing // quoutes around the attribute values. // See issue #8884. PostProcessSuffix = "__e=" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type ContentProvider ¶
type ContentProvider interface { // Content returns this resource's content. It will be equivalent to reading the content // that RelPermalink points to in the published folder. // The return type will be contextual, and should be what you would expect: // * Page: template.HTML // * JSON: String // * Etc. Content(context.Context) (any, error) }
ContentProvider provides Content. This should be used with care, as it will read the file content into memory, but it should be cached as effectively as possible by the implementation.
type DataProvider ¶
type DataProvider interface { // Resource specific data set by Hugo. // One example would be .Data.Integrity for fingerprinted resources. Data() any }
type DependenceSvc ¶
type ErrProvider ¶
type ErrProvider interface { // Err returns an error if this resource is in an error state. // This will currently only be set for resources obtained from resources.GetRemote. Err() ResourceError }
ErrProvider provides an Err.
type Fs ¶
type Fs interface { SourceFs() afero.Fs AssetsFs() afero.Fs PublishFs() afero.Fs ResourcesCacheFs() afero.Fs AssetsFsRealFilename(rel string) string AssetsFsRealDirs(from string) []string AssetsFsMakePathRelative(filename string, checkExists bool) (string, bool) NewBasePathFs(source afero.Fs, path string) afero.Fs Glob(fs afero.Fs, pattern string, handle func(fi fs.FileMetaInfo) (bool, error)) error }
type Identifier ¶
type Identifier interface { // Key is is mostly for internal use and should be considered opaque. // This value may change between Hugo versions. Key() string }
Identifier identifies a resource.
type ImageConfig ¶
type ImageFormat ¶
type ImageFormat int
ImageFormat is an images file format.
const ( JPEG ImageFormat = iota + 1 PNG GIF TIFF BMP WEBP )
type ImageResource ¶
type ImageResource interface { Resource ImageResourceOps }
ImageResource represents an images resource.
type ImageResourceOps ¶
type ImageResourceOps interface { // Height returns the height of the Image. Height() int // Width returns the width of the Image. Width() int // Process applies the given images processing options to the images. Process(spec string) (ImageResource, error) // Crop an images to match the given dimensions without resizing. // You must provide both width and height. // Use the anchor option to change the crop box anchor point. // {{ $images := $images.Crop "600x400" }} Crop(spec string) (ImageResource, error) // Fill scales the images to the smallest possible size that will cover the specified dimensions in spec, // crops the resized images to the specified dimensions using the given anchor point. // The spec is space delimited, e.g. `200x300 TopLeft`. Fill(spec string) (ImageResource, error) // Fit scales down the images using the given spec. Fit(spec string) (ImageResource, error) // Resize resizes the images to the given spec. If one of width or height is 0, the images aspect // ratio is preserved. Resize(spec string) (ImageResource, error) // Filter applies one or more filters to an Image. // {{ $images := $images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }} Filter(filters ...any) (ImageResource, error) // Exif returns an ExifInfo object containing Image metadata. Exif() *exif.ExifInfo // Colors returns a slice of the most dominant colors in an images // using a simple histogram method. Colors() ([]string, error) // For internal use. DecodeImage() (image.Image, error) }
type LinksProvider ¶
type MediaTypeProvider ¶
type MediaTypesConfig ¶
type MetaProvider ¶
type MetaProvider interface { NameTitleProvider ParamsProvider }
MetaProvider provides metadata about a resource.
type MinifyConfig ¶
type NameNormalizedProvider ¶
type NameNormalizedProvider interface { // NameNormalized is the normalized name of this resource. // For internal use (for now). NameNormalized() string }
type NameTitleProvider ¶
type NameTitleProvider interface { // Name is the logical name of this resource. This can be set in the front matter // metadata for this resource. If not set, Hugo will assign a value. // This will in most cases be the base filename. // So, for the images "/some/path/sunset.jpg" this will be "sunset.jpg". // The value returned by this method will be used in the GetByPrefix and ByPrefix methods // on Resources. Name() string // Title returns the title if set in front matter. For content pages, this will be the expected value. Title() string }
type OriginProvider ¶
OriginProvider provides the original Resource if this is wrapped. This is an internal Hugo interface and not meant for use in the templates.
type OutputFormatsConfig ¶
type ParamsProvider ¶
type PostPublishedResource ¶
type PostPublishedResource interface { TypeProvider LinksProvider NameTitleProvider ParamsProvider DataProvider OriginProvider MediaType() map[string]any }
type PublishSvc ¶
type ReadSeekCloserResource ¶
type ReadSeekCloserResource interface { MediaType() media.Type io.ReadSeekCloserProvider }
ReadSeekCloserResource is a Resource that supports loading its content.
type ResourceCopier ¶
type ResourceError ¶
type ResourceError interface { error DataProvider }
ResourceError is the error return from .Err in Resource in error situations.
type ResourcePaths ¶
type SecurityConfig ¶
type Source ¶
type Source interface {
Publish() error
}
Source is an internal template and not meant for use in the templates. It may change without notice.
type TypeProvider ¶
type TypeProvider interface { // ResourceType is the resource type. For most file types, this is the main // part of the MIME type, e.g. "images", "application", "text" etc. // For content pages, this value is "page". ResourceType() string }
type Workspace ¶
type Workspace interface { Fs ImageConfig CacheConfig MediaTypesConfig SecurityConfig OutputFormatsConfig MinifyConfig }