Skip to main content

django-simple-open-graph

Django package for simplicity embed open graph (og:) layout in templates for different objects

Problem

If you use many different objects and you need embed open-graph (e.g. fb: for facebook) layout for all pages in site.

Solution

This package help you! 

█▄▄ ███ █▄▄ █▄█▄█ █▄█ ▀█▀

Installation

You can install from PyPI:

$ pip install django-simple-open-graph==0.1

And add simple_open_graph in your INSTALLED_APPS.

Example Of Usage

Add og namespace in your base template:

<html prefix="og: http://ogp.me/ns#">

or for facebook:

<html xmlns:fb="http://ogp.me/ns/fb#" lang="en">

And add block in base template:

<head>
    ...
    {% block extra_head %}{% endblock %}
    ...
</head>

Aaand! You can use this package in different templates:

{% load simple_open_graph %}

{% block extra_head %}
    {% thumbnail object.user.image 150x150 as uimage %} <!-- as example for use easy_thumbnails package -->
    {% opengraph_meta "url=object.get_absolute_url, title=object.title, type='website', image=uimage.url" %}
{% endblock %}

This tag converted in meta html properties:

<meta property="og:url" content="/users/1">
<meta property="og:image" content="/media/thumbnails/users/person1.jpg.150x150_q85.jpg">
<meta property="og:type" content="website">
<meta property="og:title" content="Profile: user #1">

Excellent!

Changes

0.3 (2012-09-28)

  • fix absolute urls

0.2 (2012-09-19)

  • fix mistake in readme (installation)

  • fix VariableDoesNotExist error (for resolve not existing keys)

0.1 (2012-09-12)

Initial release.

Release files for django-simple-open-graph 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-simple-open-graph 0.3
File Size Uploaded
django-simple-open-graph-0.3.tar.gz 3.8 kB Details

Release files / django-simple-open-graph-0.3.tar.gz

Download URL django-simple-open-graph-0.3.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
18a832aec51eb9bce605cac1742273d090cda5597a7496d26c7dff8140da5273
BLAKE2b-256 checksum
How to use checksums
6076d7648568f34f3b6baaa77ea9d089fcad98fb633122f33b8370efeacb2866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page