wagtailseo.models

class wagtailseo.models.SeoMetaFields(*args, **kwargs)

Common metadata that should be on each page of the site. Fields from Page object (such as title, description) are not included here.

class wagtailseo.models.SeoMixin(*args, **kwargs)

Contains fields for SEO-related attributes on a Page model.

class Meta
get_preview_context(request, mode_name)

Returns a context dictionary for use in templates for previewing this object.

get_preview_template(request, mode_name)

Returns a template to be used when previewing this object.

Subclasses of PreviewableMixin must override this method to return the template name to be used in the preview. Alternatively, subclasses can also override the serve_preview method to completely customise the preview rendering logic.

property preview_modes

A list of (internal_name, display_name) tuples for the modes in which this object can be displayed for preview/moderation purposes. Ordinarily an object will only have one display mode, but subclasses can override this - for example, a page containing a form might have a default view of the form, and a post-submission ‘thank you’ page. Set to [] to completely disable previewing for this model.

property seo_author: str

Gets the name of the author of this page. Override in your Page model as necessary.

property seo_canonical_url: str

Gets the full/absolute/canonical URL preferred for meta tags and search engines. Override in your Page model as necessary.

property seo_description: str

Gets the correct search engine and Open Graph description of this page. Override in your Page model as necessary.

property seo_image: AbstractImage | None

Gets the primary Open Graph image of this page.

property seo_image_url: str

Gets the absolute URL for the primary Open Graph image of this page.

Gets the primary logo of the organization.

property seo_logo_url: str

Gets the absolute URL for the organization logo.

property seo_og_type: str

Gets the correct Open Graph type for this page. Override in your Page model as necessary.

property seo_org_fields: SeoOrgFields

Under the default implementation, Org info is stored on the settings model. If you wish to store Org data on specific pages, override this method to return self or some other class containing SeoOrgFields

property seo_pagetitle: str

Gets the correct search engine and Open Graph title of this page. Override in your Page model as necessary.

property seo_published_at: datetime

Gets the date this page was first published. Override in your Page model as necessary.

property seo_sitename: str

Gets the site name. Override in your Page model as necessary.

property seo_struct_org_base_dict: dict

Gets generic “Organization” data for use as a subset of other structured data types (for example, as publisher of an Article).

See: https://developers.google.com/search/docs/data-types/article

property seo_struct_org_dict: dict

Gets full “Organization” structured data on top of base organization data.

See: https://developers.google.com/search/docs/data-types/local-business

property seo_struct_org_name: str

Gets org name for structured data using a fallback.

property seo_struct_publisher_dict: dict | None

Gets the base organization info.

property seo_twitter_card_content: str

Gets the correct style of twitter card for this page. Override in your Page model as necessary.

class wagtailseo.models.SeoOrgFields(*args, **kwargs)

Mixin which contains data about the organization. Most likely, sites will want this defined once on the site. However if there are multiple locations/branches (e.g. a chain retail outlet), then the site might want this data on pages that represent each location.

class wagtailseo.models.SeoSettings(*args, **kwargs)

Toggle Search engine optimization features and meta tags.

exception DoesNotExist
exception MultipleObjectsReturned
property at_twitter_site

The Twitter site handle, prepended with “@”.

class wagtailseo.models.SeoType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
class wagtailseo.models.TwitterCard(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)