Skip to content

page

konigle.models.website.page

Page models for the Konigle SDK.

This module provides models for general pages including creation, update, and resource representations.

BasePage

Bases: BaseModel

Base class for page models with common editable fields.

Contains fields that can be set during creation/update. Excludes publication status which is managed through separate API calls.

author = Field(default=None, title='Author', description='Primary author of the page') class-attribute instance-attribute

Primary author of the page

content = Field(default_factory=dict, title='Content', description='Rich text blocks for the page in EditorJS format') class-attribute instance-attribute

Rich text blocks for the page in EditorJS format.

content_file_mime_type = Field(default=None, title='Content File MIME Type', description='MIME type of the content file if data source is file') class-attribute instance-attribute

MIME type of the content file if data source is file.

context_builders = Field(default_factory=dict, title='Context Builders', description='Context builders for dynamic content') class-attribute instance-attribute

Context builders for dynamic content.

contributor_ids = Field(default_factory=list, title='Contributor IDs', description='List of contributor IDs for the page') class-attribute instance-attribute

List of contributor IDs for the page.

data_source = Field(default=(DataSource.SELF), title='Data Source', description='Data source for the page') class-attribute instance-attribute

Data source for the page.

exclude_from_sitemap = Field(default=False, title='Exclude From Sitemap', description='Whether the page is excluded from sitemap') class-attribute instance-attribute

Whether the page is excluded from sitemap.

folder = Field(..., title='Folder', description='ID of the folder this page belongs to') class-attribute instance-attribute

ID of the folder this page belongs to.

handle = Field(default=None, max_length=255, title='Handle', description='Page handle that is part of the URL') class-attribute instance-attribute

Page handle that is part of the URL.

json_ld = Field(default_factory=dict, title='JSON-LD', description='Manual override for JSON-LD structured data') class-attribute instance-attribute

Manual override for JSON-LD structured data.

name = Field(..., max_length=255, title='Name', description='Name for display and search purposes') class-attribute instance-attribute

Name for display and search purposes.

page_type = Field(default=(PageType.GENERAL), title='Page Type', description='Type of the page') class-attribute instance-attribute

Type of the page.

reviewer_ids = Field(default_factory=list, title='Reviewer IDs', description='List of reviewer IDs for the page') class-attribute instance-attribute

List of reviewer IDs for the page.

seo_meta = Field(default=None, title='SEO Meta', description='SEO meta information for the page') class-attribute instance-attribute

SEO meta information for the page.

show_author = Field(default=True, title='Show Author', description='Whether to show contributors and reviewers on the page') class-attribute instance-attribute

Whether to show contributors and reviewers on the page.

subtitle = Field(default='', max_length=255, title='Subtitle', description='Subtitle of the page') class-attribute instance-attribute

Subtitle of the page.

template = Field(default=None, title='Template ID', description='ID of the page design template.') class-attribute instance-attribute

ID of the page design template.

title = Field(..., max_length=255, title='Title', description='User facing title of the page') class-attribute instance-attribute

User facing title of the page.

ContentFileMixin

For pages whose data source is a file.

content_file = Field(default=None, title='Content File', description='Content file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)') class-attribute instance-attribute

Content file to upload. Can be file path, bytes, BytesIO, BinaryIO, or tuple of (file_data, filename)

normalize_content_file()

Convert file paths or bytes to FileInput.

validate_content_file(v) classmethod

Ensure we're uploading supported file

DataSource

Bases: str, Enum

Data source enumeration for pages.

Page

Bases: BasePage, TimestampedResource

General purpose page resource model.

Represents a page with content, type, and publication status.

content_file = Field(default=None, title='Content File', description='URL of the content file if data source is file') class-attribute instance-attribute

URL of the content file if data source is file.

contributors = Field(default_factory=list, title='Contributors', description='List of contributors for the page') class-attribute instance-attribute

List of contributors for the page.

pathname = Field(default=None, title='Pathname', description='Full pathname of the page') class-attribute instance-attribute

Full pathname of the page

preview_url = Field(default=None, title='Preview URL', description='Preview URL of the page') class-attribute instance-attribute

Preview URL of the page

published = Field(default=False, title='Published', description='Whether the page is published') class-attribute instance-attribute

Whether the page is published.

published_at = Field(None, title='Published At', description='Date and time when the page was published') class-attribute instance-attribute

Date and time when the page was published.

reviewers = Field(default_factory=list, title='Reviewers', description='List of reviewers for the page') class-attribute instance-attribute

List of reviewers for the page.

url = Field(default=None, title='URL', description='Public URL of the page') class-attribute instance-attribute

Public URL of the page. Results in 404 if the page is not published.

apublish() async

Publish the page.

change_handle(new_handle, redirect=False)

Change the handle of the page.

PARAMETER DESCRIPTION
new_handle

The new handle to set for the page.

TYPE: str

redirect

Whether to create a redirect from the old handle.

TYPE: bool DEFAULT: False

Raises: ValueError: If the new handle is invalid.

publish()

Publish the page.

unpublish()

Unpublish the page.

PageCreate

Bases: BasePage, ContentFileMixin, CreateModel

Model for creating a new page.

Contains all required and optional fields for page creation.

PageType

Bases: str, Enum

Page type enumeration.

PageUpdate

Bases: ContentFileMixin, UpdateModel

Model for updating an existing page.

All fields are optional for partial updates.

author = Field(default=None, title='Author', description='Primary author of the page') class-attribute instance-attribute

Primary author of the page.

content = Field(default=None, title='Content', description='Rich text blocks for the page in EditorJS format') class-attribute instance-attribute

Rich text blocks for the page in EditorJS format.

context_builders = Field(default=None, title='Context Builders', description='Context builders for dynamic content') class-attribute instance-attribute

Context builders for dynamic content.

contributor_ids = Field(default=None, title='Contributor IDs', description='List of contributor IDs for the page') class-attribute instance-attribute

List of contributor IDs for the page.

exclude_from_sitemap = Field(default=None, title='Exclude From Sitemap', description='Whether the page is excluded from sitemap') class-attribute instance-attribute

Whether the page is excluded from sitemap.

json_ld = Field(default=None, title='JSON-LD', description='Manual override for JSON-LD structured data') class-attribute instance-attribute

Manual override for JSON-LD structured data.

name = Field(default=None, max_length=255, title='Name', description='Name for display and search purposes') class-attribute instance-attribute

Name for display and search purposes.

published_at = Field(default=None, title='Published At', description='Date and time when the page was published') class-attribute instance-attribute

Date and time when the page was published.

reviewer_ids = Field(default=None, title='Reviewer IDs', description='List of reviewer IDs for the page') class-attribute instance-attribute

List of reviewer IDs for the page.

seo_meta = Field(default=None, title='SEO Meta', description='SEO meta information for the page') class-attribute instance-attribute

SEO meta information for the page.

show_author = Field(default=None, title='Show Author', description='Whether to show contributors and reviewers on the page') class-attribute instance-attribute

Whether to show contributors and reviewers on the page.

subtitle = Field(default=None, max_length=255, title='Subtitle', description='Subtitle of the page') class-attribute instance-attribute

Subtitle of the page.

template = Field(default=None, title='Template ID', description='ID of the page design template.') class-attribute instance-attribute

ID of the page design template.

title = Field(default=None, max_length=255, title='Title', description='User facing title of the page') class-attribute instance-attribute

User facing title of the page.