Section

The Section type represents a folder within your content folder.

Properties

NameDescription
absolutePathAbsolute path of the page on disk (not portable).
basenameBasename of the section folder.
descriptionSection description.
dirSection relative directory.
indexableReturns true if a section is indexable. If a section is marked as not indexable, none of its pages won't be indexable as well.
keywordsPage keywords (Array), shortcut to metadata.keywords.
metaAlias for metadata
metadataPage metadata (Object) parsed from front-matter block.
nextSectionNext section in documents tree (Section).
pagesAll the pages beloging to the section. For multilingual sites, be careful as original and translations are mixed. Prefer using the getPagesByLanguage() method instead.
pathRelative path to the section. Example: my-section.
previousSectionPrevious section in documents tree (Section).
slugSection slug. Will return the metadata.slug if it exists, or basename.
tagsSection tags (Array), shortcut to metadata.tags.
titleSection title.
typeSection type, taken from its metadata. If none is specified, "default" is returned.
urlSection url, which is in fact, the URL of the first page in the section.
weightSection weight, used for ordering in lists.

Methods

NameDescription
getFirstPage(lang = null): PageGet the first page in section. For multilingual sites, you can specify the language.
getLastPage(lang = null): PageGet the last page in section. For multilingual sites, you can specify the language.
getPreviousPage(sameSection = true): PageGet the previous page in section, or in the previous section if sameSection equals false.
hasIndex(): BooleanCheck if the section has an index page (something like index.md, index.fr.md, etc).
hasSubSections(): BooleanReturns true if the section has sub-sections.
getPagesByLanguage(lang, bestEffort = false): Page[]Get all the pages for a language. If bestEffort is set to true, it returns the pages in the given language when a such version exists, otherwise the version of the site default language.

Edit this page / submit change