Skip to main content

contexts/global

The global context.

Attributes

Name Type Description
is_homepage bool Whether this page is the site’s homepage.
meta dict A dictionary containing meta data about the page. These values will best describe the current page being viewed whether that’s a post, a page, the blog, the homepage or otherwise.
meta.title str The title of the page.
meta.description str The description of the page.
now datetime The current date and time.
request dict A dictionary containing data about the HTTP request.
request.path str The path to the requested page, not including the scheme or domain.
request.path_full str The path, plus an appended query string, if applicable.
site dict A dictionary containing data about the site.
site.blog_url str The site’s blog URL.
site.code_body str The site’s code to be placed before the closing </body> tag.
site.code_head str The site’s code to be placed before the closing </head> tag.
site.code_post str The site’s code to be placed at the bottom of a blog post in the post template.
site.description str The site’s description.
site.feed_url str The site’s RSS feed URL.
site.footer str The site’s footer.
site.id str The site’s unique id.
site.logo str The site’s logo URL.
site.navigation list A list of the site’s visible navigation items.
site.navigation[].id str The navigation item’s unique id.
site.navigation[].title str The navigation item’s title.
site.navigation[].url str The navigation item’s URL. Could be either a relative or absolute URL.
site.title str The site’s title.
site.url str The site’s absolute URL.
theme dict A dictionary containing data about the theme.
theme.engine str The version number of the Typed theme engine being used for rendering.
theme.name str The name of the theme.
theme.variables dict A dictionary containing the site’s variables.
theme.version str The version number of theme theme.

Description

The global context is available in every template and includes, amongst other things, details about the site.

Examples

{
  'is_homepage': False,
  'meta': {
    'title': 'Top 5 Alternatives to Milk in Coffee',
    'description': 'Some people are lactose-intolerant and can’t drink milk. If that’s you, then here’s the 5 best alternatives to classic moo-moo milk.'
  },
  'now': datetime(2015, 11, 4, 16, 17, 53, tzinfo=<DstTzInfo 'Europe/Paris' CET+1:00:00 STD>),
  'request': {
    'path': '/blog',
    'path_full': '/blog?page=2'
  },
  'site': {
    'blog_url': '/blog',
    'code_body': '<!-- Could be extra markup, JavaScript, CSS, etc. -->',
    'code_head': '<!-- Could be extra markup, JavaScript, CSS, etc. -->',
    'code_post': '<!-- Could be extra markup, JavaScript, CSS, etc. -->',
    'description': '<p>It’s time to get your grind on!</p>',
    'feed_url': '/feed',
    'footer': '<p>Copyright © 2015 The Coffee Master. Powered by <a href="https://www.typed.com">Typed</a>.</p>',
    'id': '8213ee9c-3ffe-4104-99b5-52982abb80fd',
    'logo': 'https://images.typed.com/031d6856-8723-49fb-b27e-c02f0b1c491a/logo.jpg',
    'navigation': [
      {
        'id': '9f544321-4828-4b21-9a97-7fd179bfd1b0',
        'title': 'About',
        'url': '/about'
      }
    ],
    'title': 'Amazing Coffee',
    'url': 'http://amazingcoffee.typed.com'
  },
  'theme': {
    'engine': '1.0.0',
    'name': 'Amazing Coffee Theme',
    'variables': {
      'twitter_username': 'amazingcoffee'
    },
    'version': '1.1.3'
  }
}