Giter Club home page Giter Club logo

django-simple-open-graph's Introduction

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

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!

django-simple-open-graph's People

Contributors

saippuakauppias avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.