Skip to content

template

konigle.models.website.template

Template models for the Konigle SDK.

This module provides models for template resources including creation, update, and resource representations.

BaseTemplate

Bases: BaseModel

Base class for template models with common editable fields.

Contains fields that can be set during creation/update.

base = Field(default=None, title='Base Template', description='Base template ID for this template') class-attribute instance-attribute

Base template ID for this template.

body_end_snippets = Field(default=None, title='Body End Snippets', description='HTML snippets to inject before </body>') class-attribute instance-attribute

HTML snippets to inject before . Can contain scripts, tracking codes, etc.

The snippets are supported only for root template as of now.

handle = Field(..., max_length=255, title='Handle', description='Handle to identify template') class-attribute instance-attribute

Handle to identify template

head_snippets = Field(default=None, title='Head Snippets', description='HTML snippets to inject in the <head> section') class-attribute instance-attribute

HTML snippets to inject in the section. Can contain scripts, stylesheets, meta tags, fonts, tracking codes, etc.

The snippets are supported only for root template as of now.

is_base = Field(default=False, title='Is Base Template', description='Whether this is a base template for common layout') class-attribute instance-attribute

Whether this is a base template for common layout.

layout = Field(default=None, title='Layout', description='Layout containing header, footer, main') class-attribute instance-attribute

Layout containing header, footer, main etc.

name = Field(..., max_length=255, title='Name', description='Name of the template for identification') class-attribute instance-attribute

Name of the template for identification.

Block

Bases: BaseModel

Block represents a section of the page.

component_id = Field(default=None, title='Component ID', description='ID of the component used in this block') class-attribute instance-attribute

ID of the component used in this block.

type = 'component' class-attribute instance-attribute

Type of the block. Currently only 'component' is supported.

HtmlSnippet

Bases: BaseModel

Represents an HTML snippet to be injected into the page.

Snippets can contain any valid HTML like scripts, stylesheets, meta tags, font loading, tracking codes, etc.

enabled = True class-attribute instance-attribute

Whether this snippet is active. Allows temporary disable without deletion.

html instance-attribute

The actual HTML content to inject

name = Field(..., max_length=100) class-attribute instance-attribute

Identifier for the snippet (e.g., 'google_analytics', 'custom_font')

HtmlSnippets

Bases: BaseModel

Container for HTML snippets with validation for unique names.

validate_unique_names()

Ensure snippet names are unique within the list.

Segment

Bases: BaseModel

Segment represents a collection of blocks.

order = Field(default_factory=list, title='Block Order', description='Order of blocks in this segment') class-attribute instance-attribute

Order of blocks in this segment. Must match keys in blocks.

Template

Bases: BaseTemplate, TimestampedResource

Template resource model.

Represents a template for building landing pages with components.

handle = Field(..., max_length=255, title='Handle', description='Handle to identify template') class-attribute instance-attribute

Handle to identify template

included_component_ids = Field(default_factory=list, title='Included Component IDs', description='List of component IDs included in the template') class-attribute instance-attribute

List of component IDs included in the template. This is a computed field.

TemplateCreate

Bases: BaseTemplate, CreateModel

Model for creating a new template.

Contains all required and optional fields for template creation.

TemplateLayout

Bases: BaseModel

Layout configuration for site templates.

css_assets = Field(default_factory=list) class-attribute instance-attribute

CSS included in this layout. Not supported in SDK yet.

js_assets = Field(default_factory=list) class-attribute instance-attribute

JS included in this layout. Not supported in SDK yet.

template_id = Field(default=None, title='Template ID', description='ID of the template this layout belongs to') class-attribute instance-attribute

This is same as the template ID on the main model. Must not change.

TemplateUpdate

Bases: UpdateModel

Model for updating an existing template.

All fields are optional for partial updates.

base = Field(default=None, title='Base Template', description='Base template ID for this template') class-attribute instance-attribute

Base template ID for this template.

body_end_snippets = Field(default=None, title='Body End Snippets', description='HTML snippets to inject before </body>') class-attribute instance-attribute

HTML snippets to inject before . Can contain scripts, tracking codes, etc. The snippets are supported only for root template as of now.

handle = Field(default=None, max_length=255, title='Handle', description='Handle to identify template') class-attribute instance-attribute

Handle to identify template

head_snippets = Field(default=None, title='Head Snippets', description='HTML snippets to inject in the <head> section') class-attribute instance-attribute

HTML snippets to inject in the section. Can contain scripts, stylesheets, meta tags, fonts, tracking codes, etc.

The snippets are supported only for root template as of now.

is_base = Field(default=None, title='Is Base Template', description='Whether this is a base template for common layout') class-attribute instance-attribute

Whether this is a base template for common layout.

layout = Field(default=None, title='Layout', description='Layout containing header, footer, main etc.') class-attribute instance-attribute

Layout containing header, footer, main etc.

name = Field(default=None, max_length=255, title='Name', description='Name of the template for identification') class-attribute instance-attribute

Name of the template for identification.