Giter Club home page Giter Club logo

django-socialmeta's Introduction

Minimal social linking META injector

Purpose

This Django application ease the insertion of simple metadata in template responses. It can output the following meta tags :

  • og:title
  • og:description
  • og:url
  • og:image
  • twitter:card

It should be enough for most websites to pick up minimal information about the link, and display something nice.

Setup and configuration

The meta tags are defined in a template file inside the project. It is usually used with {% include %}. This template file path is "socialmeta/head.html" and should be included in the head tag of the HTML output.

Configuration is done using django settings. The application will look for settings.SOCIALMETA which should be a dictionary. It can have the following properties :

  • enabled (mandatory): set to True to enable generation of meta tags
  • title (mandatory): a default value for the og:title meta
  • description (optional): a string used as default description
  • image (optional): an URI relative to the root of the website to serve as the default picture

These values are used by default in every view, and can be overriden by specific views. If not provided, image will be the result of join(settings.STATIC_URL, 'img/socialmeta/base.png').

Finally, add "socialmeta.SocialMetaConfig" to the list of Django applications to load and add "socialmeta.context_processors.socialmeta" to your list of templates context processors.

Usage

Unless specified otherwise, views will use the default values in settings to produce metadata. To alter these values, use the socialmeta.mixins.SocialMetaMixin mixin on your view class. It is then possible to define local versions of title, description and image.

django-socialmeta's People

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.