Collection
Bases: BaseObject
Collection objects serve as a way to quickly process pages that have a portion of content that is similar or file driven.
Example:
from render_engine import Site, Collection
site = Site()
@site.collection
class BasicCollection(Collection):
content_path = "content/pages"
Collection pages MUST come from a content_path
and all be the same
content type. content_path
can be a string representing a path or URL, depending on the [parser][src.render_engine.parsers.base_parsers] used.
Attributes:
Name | Type | Description |
---|---|---|
archive_template |
str | None
|
The template to use for the |
content_path |
pathlib.Path | str
|
The path to iterate over to generate pages. |
content_type |
Page
|
Type[Page] = Page |
Feed |
RSSFeed
|
Type[RSSFeed] |
feed_title |
str
|
str |
include_suffixes |
list[str]
|
list[str] = [".md", ".html"] |
items_per_page |
int | None
|
int | None |
PageParser |
BasePageParser
|
Type[BasePageParser] = MarkdownPageParser |
parser_extras |
dict[str, any]
|
dict[str, Any] |
routes |
list[str]
|
list[str] = ["./"] |
sort_by |
str
|
str = "title" |
sort_reverse |
bool
|
bool = False |
title |
str |
|
template |
str | None
|
str | None |
archive_template |
str | None
|
The template to use for the archive pages. |
Attributes
archives: typing.Generator[Archive, None, None]
property
Returns a Archive objects containing the pages from the content_path
.
Archives are an iterable and the individual pages are built shortly after the collection pages are built. This happens when [Site.render][render_engine.Site.render] is called.
Functions
get_page(content_path=None)
Returns the page Object for the specified Content Path
iter_content_path()
Iterate through in the collection's content path.