meta-tagger


Namemeta-tagger JSON
Version 0.1.13 PyPI version JSON
download
home_pagehttps://github.com/dreipol/meta-tagger
SummaryYour project description goes here
upload_time2022-12-08 16:27:44
maintainer
docs_urlNone
authordreipol GmbH
requires_python
licenseBSD
keywords meta-tagger
VCS
bugtrack_url
requirements django django-cms django-filer django-appconf easy-thumbnails
Travis-CI
coveralls test coverage No coveralls.
            ===========
meta-tagger
===========
This package handles the meta tags of your django CMS project. Some global stuff like the page author and publisher can
be managed as setting variables. Other things are stored in a page extension. If you have your own Django models you
can even use a mixin to have everything you need for your meta tags.

Requirements
------------

- ``Django`` >= 1.5
- ``django-cms`` >= 3.0

Quickstart
----------

Install meta-tagger::

    pip install meta-tagger

Load all template tags of this package ::

    {% load meta_tagger_tags %}

Configure installed apps in your ``settings.py`` ::

    INSTALLED_APPS = (
        ...,
        'meta_tagger',
    )

Render the content of the title tag ::

    <title>{% render_title_tag %}</title>

Include all the other meta tags::

    {% include 'meta_tagger/meta_tags.html' %}

Migrate your database ::

    $ ./manage.py migrate meta_tagger


Add the sitemap to your project urls.py ::

    from meta_tagger.cms_sitemap import MetaTagRobotsSiteMap

    urlpatterns = [
        ...,
        url(r'^sitemap\.xml/$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': MetaTagRobotsSiteMap}})
    ]

Features
--------

* Django CMS page extension for the ``robots`` meta tag and the open graph image.
* Mixin for app models to inherit page specific fields (e.g. meta title, robots, etc.)
* Include template that renders all meta tags.


Model mixin
-----------
This package provides several mixins for the models of your own Django apps. The usage of
``MetaTagTitleDescriptionMixin``, ``OpenGraphMixin``, ``RobotsMixin`` is straightforward like
any other mixin. If your view has a context variable called ``object``, which is the default value for the class based
generic ``DetailView``, you don't need to consider anything. Otherwise just pass the object as context to your view.

Make sure you don't forget to implement your translation settings before you create your migrations.

You might want to use one of your own model fields as meta title. By overriding the corresponding method
(e.g. get_meta_title), it is very easy to provide another value.


Static settings
---------------

To populate the global meta tags with values, just add the following lines to your ``settings.py`` ::

    META_TAGGER_META_TAG_CONF = {
        'META_AUTHOR': 'My author',
        'META_PUBLISHER': 'My publisher',
        'META_COPYRIGHT': '2016',
        'META_COMPANY': 'My company',
        'META_SITE_NAME': 'My site name',
        'META_TYPE': 'website',
    }

    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']


Dynamic settings
----------------

If you are looking for a solution to manage the global meta tags in the admin rather than the settings file, you might
take a look at the ``constance`` package. The installation is pretty easy::

    pip install "django-constance[database]"
    pip install django-picklefield

Configure installed apps in your ``settings.py`` ::

    INSTALLED_APPS = (
        ...,
        'constance',
        'constance.backends.database',
    )

    CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
    CONSTANCE_DATABASE_CACHE_BACKEND = 'default'
    CONSTANCE_ADDITIONAL_FIELDS = {
        'short_text': ['django.forms.fields.CharField', {'widget': 'django.forms.fields.TextInput'}],
    }
    CONSTANCE_CONFIG = {
        'META_AUTHOR': ('', '<meta name="author" content="{META_AUTHOR}">', 'short_text'),
        'META_PUBLISHER': ('', '<meta name="publisher" content="{META_PUBLISHER}">', 'short_text'),
        'META_COPYRIGHT': ('', '<meta name="copyright" content="{META_COPYRIGHT}">', 'short_text'),
        'META_COMPANY': ('', '<meta name="company" content="{META_COMPANY}">', 'short_text'),
        'META_SITE_NAME': ('', '<meta name="site-name" content="{META_SITE_NAME}">', 'short_text'),
        'META_TYPE': ('website', '<meta property="og:type" content="{META_TYPE}">', 'short_text'),
        'META_OG_IMAGE_WIDTH': (1200, '<meta property="og:image:width" content="{META_OG_IMAGE_WIDTH}">', int),
        'META_OG_IMAGE_HEIGHT': (630, '<meta property="og:image:height" content="{META_OG_IMAGE_HEIGHT}">', int),
    }

    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']

Please refer to the documentation of django constance for additional installation support (e.g. Redis)


ROBOTS INDEXING
---------------

To prevent indexing any unwanted domains, the content of the robots meta tag defaults to ``noindex, nofollow``. All
domains listed in the setting variable use the configuration of your model instance or CMS page::

    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']


Running Tests
-------------
::

    source <YOURVIRTUALENV>/bin/activate
    (myenv) $ pip install -r requirements-test.txt
    (myenv) $ python runtests.py

Credits
-------

Tools used in rendering this package:

*  Cookiecutter_
*  `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.1.13 (2022-12-08)
+++++++++++++++++++

* Bugfix

0.1.12 (2022-11-10)
+++++++++++++++++++

* Add support for Django 4.0

0.1.11 (2019-10-21)
+++++++++++++++++++

* High resolution images are not needed for sharing

0.1.10 (2019-07-02)
+++++++++++++++++++

* Add support for Django 2.1

0.1.9 (2019-06-20)
++++++++++++++++++

* Add support for django CMS 3.6

0.1.7 (2018-11-08)
++++++++++++++++++

* Add view for robots.txt
* Introduce disallow field
* Add some German translations


0.1.6 (2017-07-11)
++++++++++++++++++

* Add default indexing


0.1.5 (2016-11-25)
++++++++++++++++++

* Fix for setups without a CMS.


0.1.5 (2016-11-25)
++++++++++++++++++

* Fix for setups without a CMS.


0.1.4 (2016-10-06)
++++++++++++++++++

* Wrap block tags to allow template overrides


0.1.3 (2016-08-25)
++++++++++++++++++

* Minor bugfixes


0.1.2 (2016-06-22)
++++++++++++++++++

* Minor bugfixes


0.1.1 (2016-05-30)
++++++++++++++++++

* Allow property override.
* Add width and height property for open graph image.
* Prevent indexing unwanted domains.


0.1.0 (2016-05-24)
++++++++++++++++++

* First release on PyPI.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dreipol/meta-tagger",
    "name": "meta-tagger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "meta-tagger",
    "author": "dreipol GmbH",
    "author_email": "dev@dreipol.ch",
    "download_url": "https://files.pythonhosted.org/packages/3e/41/3daac10e7847b2c044d4f59be5b4b0456efd41bd48ac4eab8f952cbbf098/meta-tagger-0.1.13.tar.gz",
    "platform": null,
    "description": "===========\nmeta-tagger\n===========\nThis package handles the meta tags of your django CMS project. Some global stuff like the page author and publisher can\nbe managed as setting variables. Other things are stored in a page extension. If you have your own Django models you\ncan even use a mixin to have everything you need for your meta tags.\n\nRequirements\n------------\n\n- ``Django`` >= 1.5\n- ``django-cms`` >= 3.0\n\nQuickstart\n----------\n\nInstall meta-tagger::\n\n    pip install meta-tagger\n\nLoad all template tags of this package ::\n\n    {% load meta_tagger_tags %}\n\nConfigure installed apps in your ``settings.py`` ::\n\n    INSTALLED_APPS = (\n        ...,\n        'meta_tagger',\n    )\n\nRender the content of the title tag ::\n\n    <title>{% render_title_tag %}</title>\n\nInclude all the other meta tags::\n\n    {% include 'meta_tagger/meta_tags.html' %}\n\nMigrate your database ::\n\n    $ ./manage.py migrate meta_tagger\n\n\nAdd the sitemap to your project urls.py ::\n\n    from meta_tagger.cms_sitemap import MetaTagRobotsSiteMap\n\n    urlpatterns = [\n        ...,\n        url(r'^sitemap\\.xml/$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': MetaTagRobotsSiteMap}})\n    ]\n\nFeatures\n--------\n\n* Django CMS page extension for the ``robots`` meta tag and the open graph image.\n* Mixin for app models to inherit page specific fields (e.g. meta title, robots, etc.)\n* Include template that renders all meta tags.\n\n\nModel mixin\n-----------\nThis package provides several mixins for the models of your own Django apps. The usage of\n``MetaTagTitleDescriptionMixin``, ``OpenGraphMixin``, ``RobotsMixin`` is straightforward like\nany other mixin. If your view has a context variable called ``object``, which is the default value for the class based\ngeneric ``DetailView``, you don't need to consider anything. Otherwise just pass the object as context to your view.\n\nMake sure you don't forget to implement your translation settings before you create your migrations.\n\nYou might want to use one of your own model fields as meta title. By overriding the corresponding method\n(e.g. get_meta_title), it is very easy to provide another value.\n\n\nStatic settings\n---------------\n\nTo populate the global meta tags with values, just add the following lines to your ``settings.py`` ::\n\n    META_TAGGER_META_TAG_CONF = {\n        'META_AUTHOR': 'My author',\n        'META_PUBLISHER': 'My publisher',\n        'META_COPYRIGHT': '2016',\n        'META_COMPANY': 'My company',\n        'META_SITE_NAME': 'My site name',\n        'META_TYPE': 'website',\n    }\n\n    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']\n\n\nDynamic settings\n----------------\n\nIf you are looking for a solution to manage the global meta tags in the admin rather than the settings file, you might\ntake a look at the ``constance`` package. The installation is pretty easy::\n\n    pip install \"django-constance[database]\"\n    pip install django-picklefield\n\nConfigure installed apps in your ``settings.py`` ::\n\n    INSTALLED_APPS = (\n        ...,\n        'constance',\n        'constance.backends.database',\n    )\n\n    CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'\n    CONSTANCE_DATABASE_CACHE_BACKEND = 'default'\n    CONSTANCE_ADDITIONAL_FIELDS = {\n        'short_text': ['django.forms.fields.CharField', {'widget': 'django.forms.fields.TextInput'}],\n    }\n    CONSTANCE_CONFIG = {\n        'META_AUTHOR': ('', '<meta name=\"author\" content=\"{META_AUTHOR}\">', 'short_text'),\n        'META_PUBLISHER': ('', '<meta name=\"publisher\" content=\"{META_PUBLISHER}\">', 'short_text'),\n        'META_COPYRIGHT': ('', '<meta name=\"copyright\" content=\"{META_COPYRIGHT}\">', 'short_text'),\n        'META_COMPANY': ('', '<meta name=\"company\" content=\"{META_COMPANY}\">', 'short_text'),\n        'META_SITE_NAME': ('', '<meta name=\"site-name\" content=\"{META_SITE_NAME}\">', 'short_text'),\n        'META_TYPE': ('website', '<meta property=\"og:type\" content=\"{META_TYPE}\">', 'short_text'),\n        'META_OG_IMAGE_WIDTH': (1200, '<meta property=\"og:image:width\" content=\"{META_OG_IMAGE_WIDTH}\">', int),\n        'META_OG_IMAGE_HEIGHT': (630, '<meta property=\"og:image:height\" content=\"{META_OG_IMAGE_HEIGHT}\">', int),\n    }\n\n    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']\n\nPlease refer to the documentation of django constance for additional installation support (e.g. Redis)\n\n\nROBOTS INDEXING\n---------------\n\nTo prevent indexing any unwanted domains, the content of the robots meta tag defaults to ``noindex, nofollow``. All\ndomains listed in the setting variable use the configuration of your model instance or CMS page::\n\n    META_TAGGER_ROBOTS_DOMAIN_WHITELIST = ['www.example.com']\n\n\nRunning Tests\n-------------\n::\n\n    source <YOURVIRTUALENV>/bin/activate\n    (myenv) $ pip install -r requirements-test.txt\n    (myenv) $ python runtests.py\n\nCredits\n-------\n\nTools used in rendering this package:\n\n*  Cookiecutter_\n*  `cookiecutter-djangopackage`_\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n\n\nHistory\n-------\n\n0.1.13 (2022-12-08)\n+++++++++++++++++++\n\n* Bugfix\n\n0.1.12 (2022-11-10)\n+++++++++++++++++++\n\n* Add support for Django 4.0\n\n0.1.11 (2019-10-21)\n+++++++++++++++++++\n\n* High resolution images are not needed for sharing\n\n0.1.10 (2019-07-02)\n+++++++++++++++++++\n\n* Add support for Django 2.1\n\n0.1.9 (2019-06-20)\n++++++++++++++++++\n\n* Add support for django CMS 3.6\n\n0.1.7 (2018-11-08)\n++++++++++++++++++\n\n* Add view for robots.txt\n* Introduce disallow field\n* Add some German translations\n\n\n0.1.6 (2017-07-11)\n++++++++++++++++++\n\n* Add default indexing\n\n\n0.1.5 (2016-11-25)\n++++++++++++++++++\n\n* Fix for setups without a CMS.\n\n\n0.1.5 (2016-11-25)\n++++++++++++++++++\n\n* Fix for setups without a CMS.\n\n\n0.1.4 (2016-10-06)\n++++++++++++++++++\n\n* Wrap block tags to allow template overrides\n\n\n0.1.3 (2016-08-25)\n++++++++++++++++++\n\n* Minor bugfixes\n\n\n0.1.2 (2016-06-22)\n++++++++++++++++++\n\n* Minor bugfixes\n\n\n0.1.1 (2016-05-30)\n++++++++++++++++++\n\n* Allow property override.\n* Add width and height property for open graph image.\n* Prevent indexing unwanted domains.\n\n\n0.1.0 (2016-05-24)\n++++++++++++++++++\n\n* First release on PyPI.",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Your project description goes here",
    "version": "0.1.13",
    "split_keywords": [
        "meta-tagger"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "60e6b9ebfbf7de92e1369e9f629f66ad",
                "sha256": "c69818894ed4b0d20a851cef6178fa1dbeec25a51248614a5f35b7bceb0ca3a3"
            },
            "downloads": -1,
            "filename": "meta-tagger-0.1.13.tar.gz",
            "has_sig": false,
            "md5_digest": "60e6b9ebfbf7de92e1369e9f629f66ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15282,
            "upload_time": "2022-12-08T16:27:44",
            "upload_time_iso_8601": "2022-12-08T16:27:44.430509Z",
            "url": "https://files.pythonhosted.org/packages/3e/41/3daac10e7847b2c044d4f59be5b4b0456efd41bd48ac4eab8f952cbbf098/meta-tagger-0.1.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-08 16:27:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dreipol",
    "github_project": "meta-tagger",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "django",
            "specs": [
                [
                    ">=",
                    "1.8"
                ]
            ]
        },
        {
            "name": "django-cms",
            "specs": [
                [
                    ">=",
                    "3.0"
                ]
            ]
        },
        {
            "name": "django-filer",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "django-appconf",
            "specs": [
                [
                    ">=",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "easy-thumbnails",
            "specs": [
                [
                    ">=",
                    "2.2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "meta-tagger"
}
        
Elapsed time: 0.01623s