Code Monkey home page Code Monkey logo

djangocms-page-sitemap's Introduction

djangocms-page-sitemap

Join the Gitter chat Latest PyPI version Python versions Latest Travis CI build status Test coverage Code Climate License

django CMS page extension to handle sitemap customization

Support Python version:

  • Python 3.9, 3.10, 3.11

Supported Django versions:

  • Django 3.2, 4.1, 4.2

Supported django CMS versions:

  • django CMS 3.9, 3.11

Note

djangocms-page-sitemap 0.8 has been relicensed with BSD license.

Note

djangocms-page-sitemap 1.0 dropped compatibility with Python 2 and Django < 2.2

Features

  • Support for changefreq and priority customisation per-page
  • Option to exclude a page from the Sitemap
  • Values are cached
  • django CMS toolbar integration
  • Available on Divio Cloud

Quickstart

django-app-enabler support

django-app-enabler is supported.

You can either

  • Installation & configuration: python -mapp_enabler install djangocms-page-meta
  • Autoconfiguration: python -mapp_enabler enable djangocms_page_meta

Fully using this package will require some changes that cannot be modified by django-app-enabler:

  • Remove any existing sitemap declaration from urls.py;
  • Load robots tags in the page like outlined above;
  • Run migrations: python manage.py migrate

Check documentation above for details.

Usage

After installing as above, you will be able to tune the sitemap setting for each page.

A new menu item Sitemap properties will be available in the page toolbar.

For each page you will be able to set the following flags / values:

  • Sitemap changefreq (default: the django CMS default)
  • Sitemap priority (default: 0.5)
  • Include page in sitemap (default: True)
  • Set noindex value to page robots meta tag
  • Set noarchive value to page robots meta tag
  • Provide any additional robots meta tag values

page_robots options

page_robots meta tag accepts the following parameters:

  • page: the page to render robots meta tag (default: current page). Can be any valid page lookup
  • site: the current site id (default: current site).

Settings

  • PAGE_SITEMAP_CHANGEFREQ_LIST: List of frequency changes
  • PAGE_SITEMAP_DEFAULT_CHANGEFREQ: Default changefrequency (default: django CMS value -monthly-)
  • PAGE_SITEMAP_CACHE_DURATION: Cache duration: same as django CMS menu cache)

djangocms-page-sitemap's People

Contributors

dependabot-preview[bot] avatar fp4code avatar kinkerl avatar pre-commit-ci[bot] avatar protoroto avatar satyrius avatar yakky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

djangocms-page-sitemap's Issues

GPL License

As far as I understand it, adding this module to my Django project makes the entire application GPL. This makes usage in a professional setting difficult.

I fully agree with the principle of avoiding lock-in and of having something based on your work being shared with the community, but it's a little excessive to force this on the entire application for what is in all honesty a relatively minor component of the stack.

I would gladly contribute to djangocms-page-sitemap if I make any changes to it... I'm a little less comfortable in sharing all my work and forcing my customers to do the same.

I would suggest changing the license to LGPLv3 which doesn't have the "viral" attribute of the GPL but still keeps all the other freedoms intact.

GPL is usually for entire applications, LGPL for libraries or modules.

Thank you.

Migrations

Your plugin has no migrations, suddenly.

I'm not sure if it's an issue, or something I'm doing wrong.

Hi there,

So I start working in a company that uses Django cms. They have three different sitemaps.
One using your extensions, and the other two using the Django sitemap.
Your extension provides the nice menu tool, so I was trying to convert the other two sitemaps to use your extension.
When I'm trying to change one of the Django sitemaps to use the extension, I'm getting two identical sitemaps. The sitemap that originally used the extension.
Any idea why?
In urls I didn't change anything. And inside the sitemap, I converted it from:

from .models import Post
from django.contrib.sitemaps import Sitemap

class PostSitemap(Sitemap):
changefreq = "weekly"
protocol = "https"

def items(self):
    return Post.objects.filter(is_published=True)

def lastmod(self, obj):
    return max(obj.changed_at.date(), obj.pub_date)

def priority(self, obj):
    return obj.priority

to:
from djangocms_page_sitemap.sitemap import ExtendedSitemap

class PostSitemap(ExtendedSitemap):
protocol = "https"

Any suggestions?

Serialization issue during addon upload

Description

The addon can not be uploaded to Divio Cloud because of an serialization issue.

Steps to reproduce

Try to upload the addon to Divio cloud

Versions

Expected behaviour

The upload should work.

Actual behaviour

Receive a serialization issue

Additional information

Issue was already discussed. This is the request ticket for the PR.

Sitemap properties for multilanguage pages

I have a multilanguage page and properties that i set for one language change properties for all rest languages.

I think it is a common bug and it dont need a steps to reproduce.

question: missing admin-interface for PageSiteMapProperties

ciao, i set up the djangocms-page-sitemap as described in the README and it works, meaning there's a properly rendered sitemap.xml. there's also a table djangocms_page_sitemap_pagesitemapproperties in the database.

however i do not see an interface to alter the properties in the admin-backend, nor corresponding inline fields in an admin interface for a page.

am i missing something or can this be considered as bug?

OS: Ubuntu Trusty
Python: 3.4.3
Django: 1.8.12
Django CMS: 3.2.3
Django CMS Page Sitemap: 0.3.1

utils.py emits warning: UserWarning: Pages no longer have a "site_id" attribute.

Hi, we are using your plugin and sometimes I am receiving this 'deprecatedwarning' for the utils file.

/home/jeroenpeters1986/.virtualenvs/website/local/lib/python2.7/site-packages/djangocms_page_sitemap/utils.py:11: UserWarning: Pages no longer have a "site_id" attribute. To get the site id of any given page, call "site_id" on the page "node" object. This backwards compatible shim will be removed in version 3.6

Is this something you are familiair with and has an "easy" fix?

Why is the extra robot values mandatory?

Hi,

at first I want to say thank you for this great extension, this is exactly what I need! ๐Ÿ‘

But could you explain, why the extra robot values field is mandatory?

Thanks and best,
Chris

_get_cache_key moved in djangocms 3.1

the get_cache_key function in utils includes:

from cms.templatetags.cms_tags import _get_cache_key

In django cms 3.1

_get_cache_key 

has been moved to

cms.cache.__init__

djangocms-page-sitemap breaks django-cms page types display

Description

After 'djangocms_page_sitemap' is added to INSTALLED_APPS,
page types cannot be displayed

Steps to reproduce

  1. Install a django-cms site
python3 -m venv env
pip install --upgrade pip
pip install wheel
. env/bin/activate
pip install --upgrade pip
pip install wheel
pip install djangocms-installer
djangocms --django-version 2.2 mysite # same problem with 3.1
pip install djangocms-page-sitemap
cd mysite/
./manage.py runserver
  1. Connect as admin/admin
  2. Add a home page
  3. Add the page type "Type 1" with slug "type1"
  4. Display http://localhost:8000/en/page_types/type-1/

That's OK. Now:

  1. Edit mysite/settings.py to add 'djangocms-page-sitemap' to INSTALLED_APPS
  2. Migrate and start server
./manage.py migrate
./manage.py runserver
  1. Try to display the page type http://localhost:8000/en/page_types/type-1/
TypeError at /en/page_types/type-1/

Versions

Python 3.8.6, Django==2.2.18, django-cms==3.8.0, djangocms-page-sitemap==1.0.0

Actual behaviour

Internal Server Error: /en/page_types/type-1/
Traceback (most recent call last):
  File "django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "django/template/base.py", line 171, in render
    return self._render(context)
  File "django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "classytags/core.py", line 151, in render
    return self.render_tag(context, **kwargs)
  File "sekizai/templatetags/sekizai_tags.py", line 87, in render_tag
    rendered_contents = nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "classytags/core.py", line 151, in render
    return self.render_tag(context, **kwargs)
  File "cms/templatetags/cms_tags.py", line 443, in render_tag
    return toolbar.render_with_structure(context, nodelist)
  File "cms/toolbar/toolbar.py", line 467, in render_with_structure
    self.populate()
  File "cms/toolbar/toolbar.py", line 407, in populate
    self._call_toolbar('populate')
  File "cms/toolbar/toolbar.py", line 434, in _call_toolbar
    getattr(toolbar, func_name)()
  File "djangocms_page_sitemap/cms_toolbars.py", line 37, in populate
    position = current_page_menu.find_first(Break, identifier=PAGE_MENU_THIRD_BREAK) - 1
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
[11/Feb/2021 16:02:06] "GET /en/page_types/type-1/ HTTP/1.1" 500 168859

UI translations

You have no translations for UI. Could you add your project to transefix?

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.