Resource methods
Use these methods with global, page, and remote Resource objects.
Use these methods with global, page, and remote Resource objects.
RESOURCE.Colors ⟼ []images.ColorApplicable to images, returns a slice of the most dominant colors using a simple histogram method. Read More »
RESOURCE.Content ⟼ anyReturns the content of the given resource. Read More »
RESOURCE.Crop SPEC ⟼ images.ImageResourceApplicable to images, returns an image resource cropped to the given dimensions without resizing. Read More »
RESOURCE.Data ⟼ mapApplicable to resources returned by the resources.GetRemote function, returns information from the HTTP response. Read More »
RESOURCE.Err ⟼ resource.resourceErrorApplicable to resources returned by the resources.GetRemote function, returns an error message if the HTTP request fails, else nil. Read More »
RESOURCE.Exif ⟼ exif.ExifInfoApplicable to JPEG and TIFF images, returns an EXIF object containing image metadata. Read More »
RESOURCE.Fill SPEC ⟼ images.ImageResourceApplicable to images, returns an image resource cropped and resized to the given dimensions. Read More »
RESOURCE.Filter FILTER... ⟼ resources.resourceAdapterApplicable to images, applies one or more image filters to the given image resource. Read More »
RESOURCE.Fit SPEC ⟼ images.ImageResourceApplicable to images, returns an image resource downscaled to fit the given dimensions while maintaining aspect ratio. Read More »
RESOURCE.Height ⟼ intApplicable to images, returns the height of the given resource. Read More »
RESOURCE.MediaType ⟼ media.TypeReturns a media type object for the given resource. Read More »
RESOURCE.Name ⟼ stringReturns the name of the given resource as optionally defined in front matter, falling back to its file path. Read More »
RESOURCE.Params ⟼ mapReturns a map of resource parameters as defined in front matter. Read More »
RESOURCE.Permalink ⟼ stringPublishes the given resource and returns its permalink. Read More »
RESOURCE.Process SPEC ⟼ images.ImageResourceApplicable to images, returns an image resource processed with the given specification. Read More »
RESOURCE.Publish ⟼ nilPublishes the given resource. Read More »
RESOURCE.RelPermalink ⟼ stringPublishes the given resource and returns its relative permalink. Read More »
RESOURCE.Resize SPEC ⟼ images.ImageResourceApplicable to images, returns an image resource resized to the given width and/or height. Read More »
RESOURCE.ResourceType ⟼ stringReturns the main type of the given resource’s media type. Read More »
RESOURCE.Title ⟼ stringReturns the title of the given resource as optionally defined in front matter, falling back to a relative path or hashed file name depending on resource type. Read More »
RESOURCE.Width ⟼ intApplicable to images, returns the width of the given resource. Read More »