config.templatetags package

Config app template tags.

Submodules

config.templatetags.custom_tags module

Template tags of the config app.

config.templatetags.custom_tags.urljoin(origin, pathname)[source]

A template filter used to join URL parts.

Parameters:
  • origin (str) – The origin of the URL.

  • pathname (str) – The pathname of the URL.

Return type:

str

Returns:

The URL joined via urljoin().

config.templatetags.custom_tags.vslice(value, var)[source]

Filter used to dynamically slice a list.

Parameters:
  • value (List) – The original list.

  • var (int) – The end of the slice.

Return type:

List

Returns:

The sliced list.

config.templatetags.custom_tags.jsonld(value, element_id)[source]

Generate a JSON-LD script tag.

Parameters:
  • value (Dict) – A JSON-LD dictionary.

  • element_id (str) – The id of the element.

Return type:

str

Returns:

An HTML <script> element.

config.templatetags.custom_tags.get_type(link)[source]

Get the type of an image given its URL.

Parameters:

link (str) – The link to the image file.

Return type:

str

Returns:

The mime type of the image.

config.templatetags.flatpage_tags module

Template tags used by the flatpage template.

config.templatetags.flatpage_tags.breadcrumbs_ld(request, page)[source]

Create a JSON-LD <script> with the page’s breadcrumbs.

Parameters:
  • request (HttpRequest) – The original request.

  • page (FlatPage) – A FlatPage object instance.

Return type:

str

Returns:

An HTML script tag.