Methods
Duration
Use these methods with a time.Duration value.
AbsReturns the absolute value of the given time.Duration value.
HoursReturns the time.Duration value as a floating point number of hours.
MicrosecondsReturns the time.Duration value as an integer microsecond count.
MillisecondsReturns the time.Duration value as an integer millisecond count.
MinutesReturns the time.Duration value as a floating point number of minutes.
NanosecondsReturns the time.Duration value as an integer nanosecond count.
RoundReturns the result of rounding DURATION1 to the nearest multiple of DURATION2.
SecondsReturns the time.Duration value as a floating point number of seconds.
TruncateReturns the result of rounding DURATION1 toward zero to a multiple of DURATION2.
Menu
Use these methods when ranging through menu entries.
ByNameReturns the given menu with its entries sorted by name.
ByWeightReturns the given menu with its entries sorted by weight, then by name, then by identifier.
LimitReturns the given menu, limited to the first N entries.
ReverseReturns the given menu, reversing the sort order of its entries.
Menu entry
Use these methods in your menu templates.
ChildrenReturns a collection of child menu entries, if any, under the given menu entry.
HasChildrenReports whether the given menu entry has child menu entries.
IdentifierReturns the
identifierproperty of the given menu entry.KeyNameReturns the
identifierproperty of the given menu entry, falling back to itsnameproperty.Returns the identifier of the menu that contains the given menu entry.
NameReturns the
nameproperty of the given menu entry.PageReturns the Page object associated with the given menu entry.
PageRefReturns the
pageRefproperty of the given menu entry.ParamsReturns the
paramsproperty of the given menu entry.ParentReturns the
parentproperty of the given menu entry.PostReturns the
postproperty of the given menu entry.PreReturns the
preproperty of the given menu entry.TitleReturns the
titleproperty of the given menu entry.URLReturns the relative permalink of the page associated with the given menu entry, else its
urlproperty.WeightReturns the
weightproperty of the given menu entry.
Output format
Use these methods with an OutputFormat object.
MediaTypeReturns the media type of the given output format.
NameReturns the identifier of the given output format.
PermalinkReturns the permalink of the page generated by the current output format.
RelReturns the rel value of the given output format, either the default or as defined in your project configuration.
RelPermalinkReturns the relative permalink of the page generated by the current output format.
Page
Use these methods with a Page object.
AliasesReturns the aliases defined in front matter as server-relative URLs, resolved according to the current content dimension.
AllTranslationsReturns all translations of the given page, including the current language, sorted by language weight then language name.
AlternativeOutputFormatsReturns a slice of OutputFormat objects, excluding the current output format, each representing one of the output formats enabled for the given page.
AncestorsReturns a collection of Page objects, one for each ancestor section of the given page.
BundleTypeReturns the bundle type of the given page, or an empty string if the page is not a page bundle.
CodeOwnersReturns of slice of code owners for the given page, derived from the CODEOWNERS file in the root of the project directory.
ContentReturns the rendered content of the given page.
ContentWithoutSummaryReturns the rendered content of the given page, excluding the content summary.
CurrentSectionReturns the Page object of the section in which the given page resides.
DataReturns a unique data object for each page kind.
DateReturns the date of the given page.
DescriptionReturns the description of the given page as defined in front matter.
DraftReports whether the given page is a draft as defined in front matter.
EqReports whether two Page objects are equal.
ExpiryDateReturns the expiry date of the given page.
FileFor pages backed by a file, returns file information for the given page.
FirstSectionReturns the Page object of the top-level section of which the given page is a descendant.
FragmentsReturns a data structure of the fragments in the given page.
FuzzyWordCountReturns the number of words in the content of the given page, rounded up to the nearest multiple of 100.
GetPageReturns a Page object from the given path.
GetTermsReturns a collection of term pages for terms defined on the given page in the given taxonomy, ordered according to the sequence in which they appear in front matter.
GitInfoProvides access to commit metadata for a given page.
Reports whether the given Page object matches the Page object associated with one of the child menu entries under the given menu entry in the given menu.
HasShortcodeReports whether the given shortcode is called by the given page.
HeadingsFilteredReturns a slice of headings for each page related to the given page.
InSectionReports whether the given page is in the given section.
IsAncestorReports whether PAGE1 is an ancestor of PAGE2.
IsBranchReports whether the given page is a branch.
IsDescendantReports whether PAGE1 is a descendant of PAGE2.
IsHomeReports whether the given page is the home page.
Reports whether the given Page object matches the Page object associated with the given menu entry in the given menu.
IsNodeReports whether the given page is a branch.
IsPageReports whether the given page is a regular page.
IsSectionReports whether the given page is a section page.
IsTranslatedReports whether the given page has one or more translations.
KeywordsReturns a slice of keywords as defined in front matter.
KindReturns the kind of the given page.
LanguageReturns the Language object for the given page.
LastmodReturns the last modification date of the given page.
LayoutReturns the layout for the given page as defined in front matter.
LenReturns the length, in bytes, of the rendered content of the given page.
LinkTitleReturns the link title of the given page.
NextReturns the next page in a site's collection of regular pages, relative to the current page.
NextInSectionReturns the next regular page in a section, relative to the given page.
OutputFormatsReturns a slice of OutputFormat objects, each representing one of the output formats enabled for the given page.
PageReturns the Page object of the given page.
PagesReturns a collection of regular pages within the current section, and section pages of immediate descendant sections.
PaginatePaginates a collection of pages.
PaginatorPaginates the collection of regular pages received in context.
ParamReturns a page parameter with the given key, falling back to a site parameter if present.
ParamsReturns a map of custom parameters as defined in the front matter of the given page.
ParentReturns the Page object of the parent section of the given page.
PathReturns the logical path of the given page.
PermalinkReturns the permalink of the given page.
PlainReturns the rendered content of the given page, removing all HTML tags.
PlainWordsCalls the Plain method, splits the result into a slice of words, and returns the slice.
PrevReturns the previous page in a site's collection of regular pages, relative to the current page.
PrevInSectionReturns the previous regular page in a section, relative to the given page.
PublishDateReturns the publish date of the given page.
RawContentReturns the raw content of the given page.
ReadingTimeReturns the estimated reading time, in minutes, for the given page.
RefReturns the absolute URL of the page with the given path, language, and output format.
RegularPagesReturns a collection of regular pages within the current section.
RegularPagesRecursiveReturns a collection of regular pages within the current section, and regular pages within all descendant sections.
RelPermalinkReturns the relative permalink of the given page.
RelRefReturns the relative URL of the page with the given path, language, and output format.
RenderRenders the given template with the given page as context.
RenderShortcodesRenders all shortcodes in the content of the given page, preserving the surrounding markup.
RenderStringRenders markup to HTML.
ResourcesReturns a collection of page resources.
RotateReturns a collection of pages that vary along the specified dimension while sharing the current page's values for the other dimensions, including the current page, sorted by the dimension's default sort order.
ScratchReturns a persistent data structure for storing and manipulating keyed values, scoped to the current page.
SectionReturns the name of the top-level section in which the given page resides.
SectionsReturns a collection of section pages, one for each immediate descendant section of the given page.
SiteReturns the Site object.
SitemapReturns the sitemap settings for the given page as defined in front matter, falling back to the sitemap settings as defined in your project configuration.
SitesReturns a collection of all sites for all dimensions.
SlugReturns the URL slug of the given page as defined in front matter.
StoreReturns a persistent data structure for storing and manipulating keyed values, scoped to the current page.
SummaryReturns the summary of the given page.
TableOfContentsReturns a table of contents for the given page.
TitleReturns the title of the given page.
TranslationKeyReturns the translation key of the given page.
TranslationsReturns all translations of the given page, excluding the current language, sorted by language weight then language name.
TruncatedReports whether the content length exceeds the summary length.
TypeReturns the content type of the given page.
WeightReturns the weight of the given page as defined in front matter.
WordCountReturns the number of words in the content of the given page.
Pager
Use these methods with a Pager object when building navigation for a paginated list page.
FirstReturns the first pager in the pager collection.
HasNextReports whether there is a pager after the current pager.
HasPrevReports whether there is a pager before the current pager.
LastReturns the last pager in the pager collection.
NextReturns the next pager in the pager collection.
NumberOfElementsReturns the number of pages in the current pager.
PageGroupsReturns the page groups in the current pager.
PageNumberReturns the current pager's number within the pager collection.
PagersReturns the pagers collection.
PagerSizeReturns the number of pages per pager.
PagesReturns the pages in the current pager.
PrevReturns the previous pager in the pager collection.
TotalNumberOfElementsReturns the number of pages in the pager collection.
TotalPagesReturns the number of pagers in the pager collection.
URLReturns the URL of the current pager relative to the site root.
Pages
Use these methods with a collection of Page objects.
ByDateReturns the given page collection sorted by date in ascending order.
ByExpiryDateReturns the given page collection sorted by expiration date in ascending order.
ByLanguageReturns the given page collection sorted by language.
ByLastmodReturns the given page collection sorted by last modification date in ascending order.
ByLengthReturns the given page collection sorted by content length in ascending order.
ByLinkTitleReturns the given page collection sorted by link title in ascending order, falling back to title if link title is not defined.
ByParamReturns the given page collection sorted by the given parameter in ascending order.
ByPublishDateReturns the given page collection sorted by publish date in ascending order.
ByTitleReturns the given page collection sorted by title in ascending order.
ByWeightReturns the given page collection sorted by weight in ascending order.
GroupByReturns the given page collection grouped by the given field in ascending order.
GroupByDateReturns the given page collection grouped by date in descending order.
GroupByExpiryDateReturns the given page collection grouped by expiration date in descending order.
GroupByLastmodReturns the given page collection grouped by last modification date in descending order.
GroupByParamReturns the given page collection grouped by the given parameter in ascending order.
GroupByParamDateReturns the given page collection grouped by the given date parameter in descending order.
GroupByPublishDateReturns the given page collection grouped by publish date in descending order.
LenReturns the number of pages in the given page collection.
LimitReturns the first N pages from the given page collection.
NextReturns the next page in a page collection, relative to the given page.
PrevReturns the previous page in a page collection, relative to the given page.
Returns a collection of pages related to the given page.
ReverseReturns the given page collection in reverse order.
Resource
Use these methods with a global, page, or remote Resource object.
ColorsApplicable to images, returns a slice of the most dominant colors using a simple histogram method.
ContentReturns the content of the given resource.
CropApplicable to images, returns a new image resource cropped according to the given processing specification.
DataApplicable to resources returned by the resources.GetRemote function, returns information from the HTTP response.
ErrApplicable to resources returned by the resources.GetRemote function, returns an error message if the HTTP request fails, else nil.
ExifReturns an object containing Exif metadata for supported image formats.
FillApplicable to images, returns a new image resource cropped and resized according to the given processing specification.
FilterApplicable to images, applies one or more image filters to the given image resource.
FitApplicable to images, returns a new image resource downscaled to fit according to the given processing specification.
HeightApplicable to images, returns the height of the given resource.
MediaTypeReturns a media type object for the given resource.
MetaApplicable to images, returns an object containing Exif, IPTC, and XMP metadata for supported image formats.
NameReturns the name of the given resource as optionally defined in front matter, falling back to its file path.
ParamsReturns a map of resource parameters as defined in front matter.
PermalinkPublishes the given resource and returns its permalink.
ProcessApplicable to images, returns a new image resource processed according to the given processing specification.
PublishPublishes the given resource.
RelPermalinkPublishes the given resource and returns its relative permalink.
ResizeApplicable to images, returns a new image resource resized according to the given processing specification.
ResourceTypeReturns the main type of the given resource's media type.
TitleReturns 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.
WidthApplicable to images, returns the width of the given resource.
Shortcode
Use these methods in your shortcode templates.
GetReturns the value of the given argument.
InnerReturns the content between opening and closing shortcode tags, applicable when the shortcode call includes a closing tag.
InnerDeindentReturns the content between opening and closing shortcode tags, with indentation removed, applicable when the shortcode call includes a closing tag.
IsNamedParamsReports whether the shortcode call uses named arguments.
NameReturns the shortcode file name, excluding the file extension.
OrdinalReturns the zero-based ordinal of the shortcode in relation to its parent.
PageReturns the Page object from which the shortcode was called.
ParamsReturns a collection of the shortcode arguments.
ParentReturns the parent shortcode context in nested shortcodes.
PositionReturns the file name and position from which the shortcode was called.
RefReturns the absolute URL of the page with the given path, language, and output format.
RelRefReturns the relative URL of the page with the given path, language, and output format.
ScratchReturns a persistent data structure for storing and manipulating keyed values, scoped to the current shortcode.
SiteReturns the Site object.
StoreReturns a persistent data structure for storing and manipulating keyed values, scoped to the current shortcode.
Site
Use these methods with a Site object.
AllPagesReturns a collection of all pages in all languages.
BaseURLReturns the base URL as defined in your project configuration.
BuildDraftsReports reports whether draft publishing is enabled for the current build.
ConfigReturns a subset of your project configuration.
CopyrightReturns the copyright notice as defined in your project configuration.
DataReturns a data structure composed from the files in the data directory.
DimensionReturns the dimension object for the given dimension for the given site.
GetPageReturns a Page object from the given path.
HomeReturns the home Page object for the given site.
IsDefaultReports whether the given site is the default site across all dimensions.
LanguageReturns the Language object for the given site.
LanguagePrefixReturns the URL language prefix, if any, for the given site.
LanguagesReturns a collection of language objects for all sites, ordered by language weight.
LastmodReturns the last modification date of site content.
MainSectionsReturns a slice of the main section names as defined in your project configuration, falling back to the top-level section with the most pages.
Returns a collection of menu objects for the given site.
PagesReturns a collection of all pages.
ParamReturns the site parameter with the given key.
ParamsReturns a map of custom parameters as defined in your project configuration.
RegularPagesReturns a collection of all regular pages.
RoleReturns the Role object for the given site.
SectionsReturns a collection of top-level section pages.
SitesReturns a collection of all sites for all dimensions.
StoreReturns a persistent data structure for storing and manipulating keyed values, scoped to the current site.
TaxonomiesReturns a data structure containing the site's Taxonomy objects, the terms within each Taxonomy object, and the pages to which the terms are assigned.
TitleReturns the title as defined in your project configuration.
VersionReturns the Version object for the given site.
Taxonomy
Use these methods with a Taxonomy object.
AlphabeticalReturns an ordered taxonomy, sorted alphabetically by term.
ByCountReturns an ordered taxonomy, sorted by the number of pages associated with each term.
CountReturns the number of number of weighted pages to which the given term has been assigned.
GetReturns a slice of weighted pages to which the given term has been assigned.
PageReturns the taxonomy page or nil if the taxonomy has no terms.
Time
Use these methods with a time.Time value.
AddReturns the given time plus the given duration.
AddDateReturns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
AfterReports whether TIME1 is after TIME2.
BeforeReports whether TIME1 is before TIME2.
DayReturns the day of the month of the given time.Time value.
EqualReports whether TIME1 is equal to TIME2.
FormatReturns a textual representation of the time.Time value formatted according to the layout string.
HourReturns the hour within the day of the given time.Time value, in the range [0, 23].
IsDSTReports whether the given time.Time value is in Daylight Savings Time.
IsZeroReports whether the given time.Time value represents the zero time instant, January 1, year 1, 00:00:00 UTC.
LocalReturns the given time.Time value with the location set to local time.
MinuteReturns the minute offset within the hour of the given time.Time value, in the range [0, 59].
MonthReturns the month of the year of the given time.Time value.
NanosecondReturns the nanosecond offset within the second of the given time.Time value, in the range [0, 999999999].
RoundReturns the result of rounding TIME to the nearest multiple of DURATION since January 1, 0001, 00:00:00 UTC.
SecondReturns the second offset within the minute of the given time.Time value, in the range [0, 59].
SubReturns the duration computed by subtracting TIME2 from TIME1.
TruncateReturns the result of rounding TIME down to a multiple of DURATION since January 1, 0001, 00:00:00 UTC.
UnixReturns the given time.Time value expressed as the number of seconds elapsed since January 1, 1970 UTC.
UnixMicroReturns the given time.Time value expressed as the number of microseconds elapsed since January 1, 1970 UTC.
UnixMilliReturns the given time.Time value expressed as the number of milliseconds elapsed since January 1, 1970 UTC.
UnixNanoReturns the given time.Time value expressed as the number of nanoseconds elapsed since January 1, 1970 UTC.
UTCReturns the given time.Time value with the location set to UTC.
WeekdayReturns the day of the week of the given time.Time value.
YearReturns the year of the given time.Time value.
YearDayReturns the day of the year of the given time.Time value, in the range [1, 365] for non-leap years, and [1, 366] in leap years.
