Package documentation

class meta.models.ModelMeta[source]

Bases: object

Meta information mixin.

as_meta(request=None)[source]

Method that generates the Meta object (from django-meta)

build_absolute_uri(url)[source]

Return the full url for the provided url argument

get_author()[source]

Retrieve the author object. This is meant to be overridden in the model to return the actual author instance (e.g.: the user object).

get_author_gplus()[source]

Sample method to return the author google plus URL

get_author_name()[source]

Sample method to return the author full name

get_author_twitter()[source]

Sample method to return the author twitter account

get_author_url()[source]

Sample method to return the author facebook URL

get_meta(request=None)[source]

Retrieve the meta data configuration

get_meta_protocol()[source]

Current http protocol

get_request()[source]

Retrieve request from current instance

class meta.views.Meta(**kwargs)[source]

Bases: object

Helper for building context meta object

get_domain()[source]
get_full_url(url)[source]
get_protocol()[source]
image
keywords
url
class meta.views.MetadataMixin(**kwargs)[source]

Bases: object

Django CBV mixin to prepare metadata for the view context

context_meta_name = u'meta'
custom_namespace = None
description = None
extra_custom_props = None
extra_props = None
facebook_app_id = None
get_context_data(**kwargs)[source]
get_domain()[source]
get_meta(context={})[source]
get_meta_class()[source]
get_meta_custom_namespace(context={})[source]
get_meta_description(context={})[source]
get_meta_extra_custom_props(context={})[source]
get_meta_extra_props(context={})[source]
get_meta_facebook_app_id(context={})[source]
get_meta_image(context={})[source]
get_meta_keywords(context={})[source]
get_meta_locale(context={})[source]
get_meta_object_type(context={})[source]
get_meta_site_name(context={})[source]
get_meta_title(context={})[source]
get_meta_twitter_card(context={})[source]
get_meta_twitter_creator(context={})[source]
get_meta_twitter_site(context={})[source]
get_meta_url(context={})[source]
get_protocol()[source]
image = None
keywords = []
locale = None
meta_class

alias of Meta

object_type = None
site_name = None
title = None
twitter_card = None
twitter_creator = None
twitter_site = None
url = None
use_og = False
use_sites = False
use_use_title_tag = False
meta.templatetags.meta.addtoblock(*args)[source]

stub templatetag

meta.templatetags.meta.custom_meta(attr, name, content)[source]

Generates a custom meta tag:

<meta {attr}=”{name}” content=”{content}”>

Parameters:
  • attr – meta attribute name
  • name – meta name
  • content – content value
meta.templatetags.meta.custom_meta_extras(extra_custom_props)[source]

Generates the markup for a list of custom meta tags

Each tuple is passed to :py:func:custom_meta to generate the markup

Parameters:extra_custom_props – list of tuple of additional meta tags
meta.templatetags.meta.endaddtoblock(*args)[source]

stub templatetag

meta.templatetags.meta.facebook_prop(name, value)[source]

Generic Facebook property

Parameters:
  • name – property name (without ‘fb:’ namespace)
  • value – property value
meta.templatetags.meta.generic_prop(namespace, name, value)[source]

Generic property setter that allows to create custom namespaced meta e.g.: fb:profile_id.

meta.templatetags.meta.googleplus_html_scope(value)[source]

This is meant to be used as attribute to html / body or other tags to define schema.org type

Parameters:value – declared scope
meta.templatetags.meta.googleplus_prop(name, value)[source]

Generic Google+ property

Parameters:
  • name – property name
  • value – property value
meta.templatetags.meta.googleplus_scope(value)[source]

Alias for googleplus_html_scope

Parameters:value – declared scope
meta.templatetags.meta.meta(name, content)[source]

Generates a meta tag according to the following markup:

<meta name=”{name}” content=”{content}”>

Parameters:
  • name – meta name
  • content – content value
meta.templatetags.meta.meta_extras(extra_props)[source]

Generates the markup for a list of meta tags

Each key,value paur is passed to :py:func:meta to generate the markup

Parameters:extra_props – dictionary of additional meta tags
meta.templatetags.meta.meta_list(name, lst)[source]

Renders in a single meta a list of values (e.g.: keywords list)

Parameters:
  • name – meta name
  • lst – values
meta.templatetags.meta.meta_namespaces(context)[source]

Include OG namespaces. To be used in the <head> tag.

meta.templatetags.meta.meta_namespaces_gplus(context)[source]

Include google+ attributes. To be used in the <html> or <body> tag.

meta.templatetags.meta.og_prop(name, value)[source]

Generic OpenGraph property

Parameters:
  • name – property name (without ‘og:’ namespace)
  • value – property value
meta.templatetags.meta.title_prop(value)[source]

Title tag

Parameters:value – title value
meta.templatetags.meta.twitter_prop(name, value)[source]

Generic Twitter property

Parameters:
  • name – property name (without ‘twitter:’ namespace)
  • value – property value