Dynamic OG Images in Django Templates

Add automatic OG image generation to your Django views in minutes. No dependencies beyond standard Python.

Start Integrating

Pure Python

No dependencies beyond standard Python. Uses urllib.parse for URL encoding.

Django Native

Pass the OG image URL via context to your templates. Works with your existing views.

Template Ready

Use in base.html or individual templates. Just add meta tags with the og_url.

Example Integration

# views.py
import urllib.parse
from django.conf import settings
from django.shortcuts import render, get_object_or_404

def blog_post(request, slug):
    post = get_object_or_404(Post, slug=slug)
    og_url = "https://imagoapi.com/api/og/generate?" + urllib.parse.urlencode({
        "title":    post.title,
        "template": "modern",
        "api_key":  settings.IMAGO_API_KEY,
    })
    return render(request, "blog/post.html", {"post": post, "og_url": og_url})

# In blog/post.html:
# <meta property="og:image" content="{{ og_url }}">
# <meta name="twitter:image" content="{{ og_url }}">

Generate OG Images in Seconds

Start using Imago API today and add beautiful social cards to your Django app.

Try Imago API Free