Django package for simplicity embed open graph (og:) layout in templates for different objects
Project description
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!
Useful Links
Changes
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-simple-open-graph-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003e29a77269a31c86fe3e7b0e47701714d50ac7bc453f9abdf5ce7aca7c86fc |
|
MD5 | 37b06d3b80d55728475de1aa14b4d623 |
|
BLAKE2b-256 | 87d79448dde35c8e6545d2fae0e91505f557865352ed17c2044b0d43d876c2b6 |