Virtual Source Objects¶
The index pages are generated as virtual source objects
The Index Roots¶
Each top-level index will have a root virtual source.
These have Lektor paths like parent@index-pages/index-name
.
The index root sources do not actually generate any artifacts — they serve primarily as the parents for the actual index pages.
For the most part, they have one useful attribute, subindexes which contains a Lektor Query instance containing the individual index pages for the index.
- class lektor_index_pages.sourceobj.IndexRoot(model, record)¶
- subindexes¶
A Lektor Query instance containing the individual pages for the index.
The ordering of the index pages in subindexes preserves the ordering defined of the indexes
items
setting. I.e. the items are iterated through; the keys are computed for each item in order; the index source for the first key encountered will be listed first in subindexes, the index for the second unique key encountered will be listed second, etc.
The Index Pages¶
The items in the root index’s subindexes
query live at paths like parent@index-pages/index-name/key
, where key
is the index key for the page.
Useful fields on the index page include key
(or, equivalently, _id
,) which is equal to the index key for the page, as well as any custom fields configured in the [index-name.fields]
section of index-pages.ini
.
Useful attributes on the index page virtual source objects include:
- class lektor_index_pages.sourceobj.IndexSource(model, root, id_, children, page_num=None)¶
- children¶
The records in the configured
items
for the query that match this index page’s key.
- pagination¶
This works just like the regular Lektor pagination object. E.g. the children for this current page are available in
pagination.items
.(The pagination attribute is available only if pagination is enabled in the configuration for the index.)
- subindexes¶
If a sub-index is configured on this index, subindexes will contain a query containing the sub-index pages, instances of
IndexSource
. The sub-index virtual sources will have paths likeparent@index-pages/index-name/key/subindex-key
.