class WithCacheSites(seo.Metadata): title = seo.Tag(head=True, populate_from=seo.Literal("1234")) subtitle = seo.Tag(head=True) class Meta: use_cache = True use_sites = True
class Metadata(seo.Metadata): title = seo.Tag(head=True) description = seo.MetaTag() keywords = seo.KeywordTag() tooltip = seo.MetaTag() heading = seo.Tag(name="h1") paginator = seo.Tag() class Meta: use_sites = True class HelpText: keywords = _( 'A comma separated list of words or phrases that describe the content' )
class Metadata(seo.Metadata): title = seo.Tag(head=True, max_length=255) description = seo.MetaTag(max_length=255) keywords = seo.KeywordTag() canonical_url = LinkTag(rel="canonical", head=True) og_title = seo.OgMetaTag(name='og:title', help_text='Og Title', populate_from='title', verbose_name='OpenGraph og:title') og_description = seo.OgMetaTag(name='og:description', help_text='Og Description', populate_from='description', verbose_name='OpenGraph og:description') og_type = seo.OgMetaTag(name='og:type', verbose_name='OpenGraph og:type') og_image = seo.OgMetaTag(name='og:image', verbose_name='OpenGraph og:image') og_url = seo.OgMetaTag(name='og:url', verbose_name='OpenGraph og:url') og_video = seo.OgMetaTag(name='og:video', verbose_name='OpenGraph og:video') sailthru_tags = seo.MetaTag(name="sailthru.tags") sailthru_image = seo.MetaTag(name="sailthru.image.full") sailthru_image_thumb = seo.MetaTag(name="sailthru.image.thumb") sailthru_title = seo.MetaTag(name="sailthru.title") sailthru_stall_title = seo.MetaTag(name="sailthru.stall-title") sailthru_stall_url = seo.MetaTag(name="sailthru.stall-url") sailthru_stall_owner_id = seo.MetaTag(name="sailthru.stall-owner-id") class Meta: verbose_name_plural = "Metadata" seo_views = ( # User 'public_profile', # Stall 'my_stall', # Products 'product_page', # Search / Discover 'product_search', 'category_discover', # Blog / Articles 'articles_archive', 'articles_archive_page', 'articles_display_tag', 'articles_display_tag_page', 'articles_display_category', 'articles_display_category_page', 'articles_by_author', 'articles_by_author_page', 'articles_tag_autocomplete', 'articles_in_month', 'articles_in_month_page', 'articles_display_article', # Love list stuff - # see https://github.com/willhardy/django-seo/issues/36 for why we # can't use namespacing "edit", "lists", "view", # Account Stuff 'login', 'logout', 'register', 'register_success', 'account', 'password_reset', 'password_reset_done', 'password_reset_confirm', 'password_reset_complete', ) seo_models = ('articles.Article',)
class DefaultMetadata(seo.Metadata): """ A very basic default class for those who do not wish to write their own. """ title = seo.Tag(head=True, max_length=68) keywords = seo.MetaTag() description = seo.MetaTag(max_length=155) heading = seo.Tag(name="h1") class Meta: verbose_name = "Metadata" verbose_name_plural = "Metadata" use_sites = False # This default class is automatically created when SEO_MODELS is # defined, so we'll take our model list from there. seo_models = getattr(settings, 'SEO_MODELS', []) class HelpText: title = "This is the page title, that appears in the title bar." keywords = "Comma-separated keywords for search engines." description = "A short description, displayed in search results." heading = "This is the page heading, appearing in the <h1> tag."
class MyMetadata(seo.Metadata): title = seo.Tag(head=True, max_length=68) description = seo.MetaTag(max_length=155) keywords = seo.KeywordTag() heading = seo.Tag(name='h1')
class WithRedirectSites(seo.Metadata): title = seo.Tag() class Meta: use_sites = True use_redirect = True
class WithRedirect(seo.Metadata): title = seo.Tag() class Meta: use_redirect = True
class WithI18n(seo.Metadata): title = seo.Tag() class Meta: use_i18n = True
class WithSites(seo.Metadata): title = seo.Tag() class Meta: use_sites = True
class Coverage(seo.Metadata): """ A SEO metadata definition, which should cover all configurable options. """ def get_populate_from1(self, metadata, **kwargs): return "wxy" def get_populate_from2(self, metadata, **kwargs): return "xyz" get_populate_from2.short_description = "Always xyz" title = seo.Tag(populate_from=seo.Literal("example.com"), head=True) heading = seo.Tag(max_length=68, name="hs:tag", verbose_name="tag two", head=True) keywords = seo.KeywordTag() description = seo.MetaTag(max_length=155, name="hs:metatag", verbose_name="metatag two") raw1 = seo.Raw() raw2 = seo.Raw(head=True, verbose_name="raw two", valid_tags=("meta", "title")) help_text1 = seo.Tag(help_text="Some help text 1.") help_text2 = seo.Tag(populate_from="def") help_text3 = seo.Tag(populate_from=get_populate_from1, help_text="Some help text 3.") help_text4 = seo.Tag(populate_from=get_populate_from2) help_text5 = seo.Tag(populate_from="heading") help_text6 = seo.Tag(populate_from="heading", help_text="Some help text 6.") populate_from1 = seo.Tag(populate_from="get_populate_from1") populate_from2 = seo.Tag(populate_from="heading") populate_from3 = seo.Tag(populate_from=seo.Literal("efg")) populate_from4 = seo.Tag(populate_from="ghi") populate_from5 = seo.Tag(populate_from="ghi", editable=False) populate_from6 = seo.Tag(populate_from="keywords") populate_from7 = seo.Tag(populate_from=get_model_instance_content) field1 = seo.Tag(field=models.TextField) class Meta: verbose_name = "Basic Metadatum" verbose_name_plural = "Basic Metadata" use_sites = False groups = { 'advanced': ('raw1', 'raw2' ), 'help_text': ( 'help_text1', 'help_text2', 'help_text3', 'help_text4', ) } seo_models = ('userapp', ) seo_views = ('userapp', ) class HelpText: help_text2 = "Updated help text2."
class WithSEOModels(seo.Metadata): title = seo.Tag() class Meta: seo_models = ('userapp', )
class WithBackends(seo.Metadata): title = seo.Tag() class Meta: backends = ('view', 'path')