$pages
The $pages
object refers to a collection of pages. The pages in this collection can have the same or different parents, they can actually exist as subfolders in the content folder or be virtual pages created from a database, an Excel sheet, any API or any other source.
- $pages->add()
- $pages->append()
- $pages->audio()
- $pages->children()
- $pages->chunk()
- $pages->clone()
- $pages->code()
- $pages->count()
- $pages->current()
- $pages->data()
- $pages->documents()
- $pages->drafts()
- $pages->empty()
- $pages->extend()
- $pages->files()
- $pages->filter()
- $pages->filterBy()
- $pages->find()
- $pages->findBy()
- $pages->findOpen()
- $pages->first()
- $pages->flip()
- $pages->get()
- $pages->getAttribute()
- $pages->getIterator()
- $pages->group()
- $pages->groupBy()
- $pages->has()
- $pages->images()
- $pages->index()
- $pages->indexOf()
- $pages->intersection()
- $pages->intersects()
- $pages->isEmpty()
- $pages->isEven()
- $pages->isNotEmpty()
- $pages->isOdd()
- $pages->key()
- $pages->keyOf()
- $pages->keys()
- $pages->last()
- $pages->limit()
- $pages->listed()
- $pages->map()
- $pages->merge()
- $pages->next()
- $pages->not()
- $pages->notTemplate()
- $pages->nth()
- $pages->nums()
- $pages->offset()
- $pages->paginate()
- $pages->pagination()
- $pages->parent()
- $pages->pluck()
- $pages->prepend()
- $pages->prev()
- $pages->published()
- $pages->query()
- $pages->random()
- $pages->remove()
- $pages->rewind()
- $pages->search()
- $pages->set()
- $pages->shuffle()
- $pages->slice()
- $pages->sort()
- $pages->sortBy()
- $pages->template()
- $pages->toArray()
- $pages->toJson()
- $pages->toString()
- $pages->unlisted()
- $pages->valid()
- $pages->values()
- $pages->videos()
- $pages->when()
- $pages->without()
- new Pages()
- Pages::factory()
- Pages::sortArgs()
You can extend this set of methods with custom pages methods.
How to get a $pages
object
The $pages
variable is available by default in templates and snippets and refers to a collection of all first level pages. In addition to that, you can define a $pages
object in various ways:
Children of a page
All pages of the site
A custom combination of pages
Examples
With the $pages
object in place, we can start using the methods of this class to do many different things: