diff options
| author | Andrew Northall <andrew@northall.me.uk> | 2023-07-02 21:48:56 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-07-10 05:59:35 +0200 |
| commit | 6d427288e410e9cad39b1aa1b4d4893fbd391282 (patch) | |
| tree | 6248db20899d162ab4df51d896986ec3f47fad12 /docs | |
| parent | 2584783f46922bcb456ceb9700a3726314df65d3 (diff) | |
Fixed #34688 -- Removed contrib.sitemaps.ping_google() and ping_google management command.
Thanks Joachim Jablon for the report.
Google has deprecated the sitemap ping endpoint, and will be removing
it in 6 months ~January 2024.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/sitemaps.txt | 75 | ||||
| -rw-r--r-- | docs/ref/django-admin.txt | 12 | ||||
| -rw-r--r-- | docs/releases/2.2.txt | 6 | ||||
| -rw-r--r-- | docs/releases/5.0.txt | 9 |
4 files changed, 12 insertions, 90 deletions
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt index 57bcc81a01..020eaf03ff 100644 --- a/docs/ref/contrib/sitemaps.txt +++ b/docs/ref/contrib/sitemaps.txt @@ -588,78 +588,3 @@ generate a Google News compatible sitemap: </urlset> .. _`Google news sitemaps`: https://support.google.com/news/publisher-center/answer/9606710 - -Pinging Google -============== - -You may want to "ping" Google when your sitemap changes, to let it know to -reindex your site. The sitemaps framework provides a function to do just -that: :func:`django.contrib.sitemaps.ping_google()`. - -.. function:: ping_google(sitemap_url=None, ping_url=PING_URL, sitemap_uses_https=True) - - ``ping_google`` takes these optional arguments: - - * ``sitemap_url`` - The absolute path to your site's sitemap (e.g., - :file:`'/sitemap.xml'`). - - If this argument isn't provided, ``ping_google`` will perform a reverse - lookup in your URLconf, for URLs named - ``'django.contrib.sitemaps.views.index'`` and then - ``'django.contrib.sitemaps.views.sitemap'`` (without further arguments) to - automatically determine the sitemap URL. - - * ``ping_url`` - Defaults to Google's Ping Tool: - https://www.google.com/webmasters/tools/ping. - - * ``sitemap_uses_https`` - Set to ``False`` if your site uses ``http`` - rather than ``https``. - - :func:`ping_google` raises the exception - ``django.contrib.sitemaps.SitemapNotFound`` if it cannot determine your - sitemap URL. - -.. admonition:: Register with Google first! - - The :func:`ping_google` command only works if you have registered your - site with `Google Search Console`_. - -.. _`Google Search Console`: https://search.google.com/search-console/welcome - -One useful way to call :func:`ping_google` is from a model's ``save()`` -method:: - - from django.contrib.sitemaps import ping_google - - - class Entry(models.Model): - # ... - def save(self, force_insert=False, force_update=False): - super().save(force_insert, force_update) - try: - ping_google() - except Exception: - # Bare 'except' because we could get a variety - # of HTTP-related exceptions. - pass - -A more efficient solution, however, would be to call :func:`ping_google` from a -cron script, or some other scheduled task. The function makes an HTTP request -to Google's servers, so you may not want to introduce that network overhead -each time you call ``save()``. - -Pinging Google via ``manage.py`` --------------------------------- - -.. django-admin:: ping_google [sitemap_url] - -Once the sitemaps application is added to your project, you may also -ping Google using the ``ping_google`` management command: - -.. code-block:: shell - - python manage.py ping_google [/sitemap.xml] - -.. django-admin-option:: --sitemap-uses-http - -Use this option if your sitemap uses ``http`` rather than ``https``. diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 110b1e802a..a46910f9f3 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1759,18 +1759,6 @@ documentation. Can be run as a cron job or directly to clean out expired sessions. -``django.contrib.sitemaps`` ---------------------------- - -``ping_google`` -~~~~~~~~~~~~~~~ - -This command is only available if the :doc:`Sitemaps framework -</ref/contrib/sitemaps>` (``django.contrib.sitemaps``) is installed. - -Please refer to its :djadmin:`description <ping_google>` in the Sitemaps -documentation. - ``django.contrib.staticfiles`` ------------------------------ diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt index e27fdbbca8..664549473e 100644 --- a/docs/releases/2.2.txt +++ b/docs/releases/2.2.txt @@ -455,10 +455,10 @@ Miscellaneous passed as a value to encode because ``None`` can't be encoded in GET and POST data. Either pass an empty string or omit the value. -* The :djadmin:`ping_google` management command now defaults to ``https`` +* The ``ping_google`` management command now defaults to ``https`` instead of ``http`` for the sitemap's URL. If your site uses http, use the - new :option:`ping_google --sitemap-uses-http` option. If you use the - :func:`~django.contrib.sitemaps.ping_google` function, set the new + new ``ping_google --sitemap-uses-http`` option. If you use the + ``django.contrib.sitemaps.ping_google`` function, set the new ``sitemap_uses_https`` argument to ``False``. * :djadmin:`runserver` no longer supports ``pyinotify`` (replaced by Watchman). diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index aa397e8cb0..722d3bcf0b 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -443,6 +443,15 @@ backends. * Support for GEOS 3.6 and 3.7 is removed. +:mod:`django.contrib.sitemaps` +------------------------------ + +* The ``django.contrib.sitemaps.ping_google()`` function and the + ``ping_google`` management command are removed as the Google + Sitemaps ping endpoint is deprecated and will be removed in January 2024. + +* The ``django.contrib.sitemaps.SitemapNotFound`` exception class is removed. + Using ``create_defaults__exact`` may now be required with ``QuerySet.update_or_create()`` ----------------------------------------------------------------------------------------- |
