1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #23829 -- Made ping_google command/function use https for the sitemap URL.

This commit is contained in:
Sanyam Khurana
2019-01-10 15:30:00 +05:30
committed by Tim Graham
parent 6d73278d38
commit 76d31be2d0
6 changed files with 45 additions and 14 deletions

View File

@@ -481,7 +481,7 @@ 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)
.. function:: ping_google(sitemap_url=None, ping_url=PING_URL, sitemap_uses_https=True)
``ping_google`` takes these optional arguments:
@@ -493,10 +493,18 @@ that: :func:`django.contrib.sitemaps.ping_google()`.
* ``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.
.. versionadded:: 2.2
The ``sitemap_uses_https`` argument was added. Older versions of
Django always use ``http`` for a sitemap's URL.
.. admonition:: Register with Google first!
The :func:`ping_google` command only works if you have registered your
@@ -534,3 +542,9 @@ Once the sitemaps application is added to your project, you may also
ping Google using the ``ping_google`` management command::
python manage.py ping_google [/sitemap.xml]
.. django-admin-option:: --sitemap-uses-http
.. versionadded:: 2.2
Use this option if your sitemap uses ``http`` rather than ``https``.

View File

@@ -479,6 +479,12 @@ 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``
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
``sitemap_uses_https`` argument to ``False``.
.. _deprecated-features-2.2:
Features deprecated in 2.2