Module

content_layer.entry

ContentEntry - Unified representation of content from any source.

This is the output of all ContentSource implementations and serves as the bridge between remote/local content and Bengal's Page model.

Classes

ContentEntry dataclass
Unified representation of content from any source. ContentEntry is source-agnostic - whether conte…
6

Unified representation of content from any source.

ContentEntry is source-agnostic - whether content comes from local files, GitHub, Notion, or a REST API, it's represented the same way.

Attributes

Name Type Description
id str

Unique identifier within the source (e.g., file path, doc ID)

slug str

URL-friendly slug for routing

content str

Raw content (typically markdown)

frontmatter dict[str, Any]

Parsed metadata dictionary

source_type str

Type of source ('local', 'github', 'notion', 'rest')

source_name str

Name of the configured source instance

source_url str | None

Original URL for attribution (optional)

last_modified datetime | None

Last modification time (for cache invalidation)

checksum str | None

Content hash (for change detection)

etag str | None

HTTP ETag (for conditional requests)

cached_path Path | None

Local cache file path (if cached)

cached_at datetime | None

When this entry was cached

Methods 6

title property
Get title from frontmatter or derive from slug.
str
def title(self) -> str

Get title from frontmatter or derive from slug.

Returns

str

is_remote property
Check if this entry came from a remote source.
bool
def is_remote(self) -> bool

Check if this entry came from a remote source.

Returns

bool

is_cached property
Check if this entry has been cached locally.
bool
def is_cached(self) -> bool

Check if this entry has been cached locally.

Returns

bool

to_page_kwargs
Convert to kwargs for Page creation.
0 dict[str, Any]
def to_page_kwargs(self) -> dict[str, Any]

Convert to kwargs for Page creation.

Returns

dict[str, Any]

Dictionary of kwargs suitable for Page.init

to_dict
Convert to dictionary for serialization.
0 dict[str, Any]
def to_dict(self) -> dict[str, Any]

Convert to dictionary for serialization.

Returns

dict[str, Any]

Dictionary representation for JSON/cache storage

from_dict classmethod
Create ContentEntry from dictionary.
1 ContentEntry
def from_dict(cls, data: dict[str, Any]) -> ContentEntry

Create ContentEntry from dictionary.

Parameters 1
data dict[str, Any]

Dictionary from to_dict() or cache storage

Returns

ContentEntry

ContentEntry instance