Giter Site home page Giter Site logo

bashu / wagtail-metadata-mixin Goto Github PK

View Code? Open in Web Editor NEW
46.0 3.0 19.0 108 KB

๐Ÿ” OpenGraph, Twitter Card and Schema.org snippet tags for Wagtail CMS pages

License: MIT License

Python 80.11% HTML 19.89%
wagtail django seo django-meta metatags social-network opengraph twitter-card schema-org

wagtail-metadata-mixin's Introduction

wagtail-metadata-mixin

image

image

image

image

OpenGraph, Twitter Card and Schema.org snippet tags for Wagtail CMS pages.

The current version is tested for compatiblily with the following:

  • Wagtail versions 2.7 to 2.15
  • Django versions 2.2 to 3.2
  • Python versions 3.6 and 3.9

Authored by Basil Shubin, and some great contributors.

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install wagtail-metadata-mixin

Requirements

You must have django-meta installed and configured, see the django-meta documentation for details and setup instructions.

Setup

First make sure the project is configured for django-meta.

Then add the following settings:

INSTALLED_APPS += (
    'wagtailmetadata',
)

and just include meta/meta.html template in your templates

{% load meta %}

<html {% meta_namespaces_schemaorg %}>
    <head {% meta_namespaces %}>
        {% include "meta/meta.html" %}
    </head>
    <body>...</body>
</html>

Check django-meta documentation for more details.

Usage

# models.py

from wagtail.core.models import Page, PageBase

from wagtailmetadata.models import MetadataPageMixin

# ensure MetadataPageMixin class goes before Page class
class CustomPage(MetadataPageMixin, Page):
    schemaorg_type = "Page"

    promote_panels = Page.promote_panels + MetadataPageMixin.panels

Contributing

If you like this module, forked it, or would like to improve it, please let us know! Pull requests are welcome too. :-)

License

wagtail-metadata-mixin is released under the MIT license.

wagtail-metadata-mixin's People

Contributors

415mcc avatar bashu avatar boltaffectdev avatar entvia avatar recklessromeo avatar sekanitembo avatar tobiase avatar yasielcabrera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wagtail-metadata-mixin's Issues

incompatible with django-meta 2.0.0

As of Nov 14th, django-meta has been updated with backwards incompatible changes, and produces errors when installed according to the install_requires keyword value provided by the setup.py in wagtail-metadata-mixin (it specifies "django-meta>1.5".)

Attempting to run a wagtail project with wagtail-metadata-mixin now produces this exception:

  File "/usr/local/lib/python3.7/site-packages/wagtailmetadata/models.py", line 9, in <module>
    from meta_mixin.models import ModelMeta
ModuleNotFoundError: No module named 'meta_mixin'

Pinning the version of django-meta in my wagtail project requirements as "django-meta>1.5,<2" instead appears to resolve the problem for now.

Wagtail 2.9 / Django 3.0

I created a PR (#9) to support Wagtail 2.9 / Django 3.0. Let me know what you think/if it needs changes. Thanks.

Wagtail version 3+ compatibility

The package is currently limited to wagtail version >1.4 and <3.0. All of those versions are out of support: https://github.com/wagtail/wagtail/wiki/Release-schedule.

I propose to submit a PR that will:

  • fix the panels in the MetadataPageMixin so it will continue to work with Wagtail versions 3+;
  • increase minimum requirement for Wagtail to version 2.13, because it's the minimum version that supports Django 3.2;
  • upgrade the example app to use Django 3.2 and Wagtail 4.1, because those are LTS releases;

I think we could also drop support for Python 3.6, and add support for more recent Python versions.

I propose deploying the changes as a new version 3.0, because it will have breaking changes.

Use WAGTAILIMAGES_IMAGE_MODEL setting

At the moment wagtail-metadata-mixin doesn't work with a custom image model.
It should make use of the WAGTAILIMAGES_IMAGE_MODEL settings variable.

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.