diff options
| author | nessita <124304+nessita@users.noreply.github.com> | 2025-11-20 15:43:21 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-20 15:43:21 -0300 |
| commit | ee2e0e202874db31449d3c7c292504652fa87f69 (patch) | |
| tree | 3025068cb55648bfb15bf8fc6965821c746feea7 /docs | |
| parent | d9c94c59835ca2b6569583392bbf5c7f65a8e927 (diff) | |
Ensured that Sitemap.items is described as a method in docs/ref/contrib/sitemaps.txt.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/sitemaps.txt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt index 1190b3f852..4ec72d70f4 100644 --- a/docs/ref/contrib/sitemaps.txt +++ b/docs/ref/contrib/sitemaps.txt @@ -122,7 +122,7 @@ Note: attributes corresponding to ``<changefreq>`` and ``<priority>`` elements, respectively. They can be made callable as functions, as :attr:`~Sitemap.lastmod` was in the example. -* :attr:`~Sitemap.items` is a method that returns a :term:`sequence` or +* :meth:`~Sitemap.items` is a method that returns a :term:`sequence` or ``QuerySet`` of objects. The objects returned will get passed to any callable methods corresponding to a sitemap property (:attr:`~Sitemap.location`, :attr:`~Sitemap.lastmod`, :attr:`~Sitemap.changefreq`, and @@ -140,7 +140,7 @@ Note: A ``Sitemap`` class can define the following methods/attributes: - .. attribute:: Sitemap.items + .. method:: Sitemap.items **Required.** A method that returns a :term:`sequence` or ``QuerySet`` of objects. The framework doesn't care what *type* of objects they are; @@ -153,11 +153,11 @@ Note: **Optional.** Either a method or attribute. If it's a method, it should return the absolute path for a given object - as returned by :attr:`~Sitemap.items`. + as returned by :meth:`~Sitemap.items`. If it's an attribute, its value should be a string representing an absolute path to use for *every* object returned by - :attr:`~Sitemap.items`. + :meth:`~Sitemap.items`. In both cases, "absolute path" means a URL that doesn't include the protocol or domain. Examples: @@ -178,12 +178,12 @@ Note: **Optional.** Either a method or attribute. If it's a method, it should take one argument -- an object as returned - by :attr:`~Sitemap.items` -- and return that object's last-modified + by :meth:`~Sitemap.items` -- and return that object's last-modified date/time as a :class:`~datetime.datetime`. If it's an attribute, its value should be a :class:`~datetime.datetime` representing the last-modified date/time for *every* object returned by - :attr:`~Sitemap.items`. + :meth:`~Sitemap.items`. If all items in a sitemap have a :attr:`~Sitemap.lastmod`, the sitemap generated by :func:`views.sitemap` will have a ``Last-Modified`` @@ -197,7 +197,7 @@ Note: **Optional.** This property returns a :class:`~django.core.paginator.Paginator` for - :attr:`~Sitemap.items`. If you generate sitemaps in a batch you may + :meth:`~Sitemap.items`. If you generate sitemaps in a batch you may want to override this as a cached property in order to avoid multiple ``items()`` calls. @@ -206,11 +206,11 @@ Note: **Optional.** Either a method or attribute. If it's a method, it should take one argument -- an object as returned - by :attr:`~Sitemap.items` -- and return that object's change + by :meth:`~Sitemap.items` -- and return that object's change frequency as a string. If it's an attribute, its value should be a string representing the - change frequency of *every* object returned by :attr:`~Sitemap.items`. + change frequency of *every* object returned by :meth:`~Sitemap.items`. Possible values for :attr:`~Sitemap.changefreq`, whether you use a method or attribute, are: @@ -228,12 +228,12 @@ Note: **Optional.** Either a method or attribute. If it's a method, it should take one argument -- an object as returned - by :attr:`~Sitemap.items` -- and return that object's priority as + by :meth:`~Sitemap.items` -- and return that object's priority as either a string or float. If it's an attribute, its value should be either a string or float representing the priority of *every* object returned by - :attr:`~Sitemap.items`. + :meth:`~Sitemap.items`. Example values for :attr:`~Sitemap.priority`: ``0.4``, ``1.0``. The default priority of a page is ``0.5``. See the `sitemaps.org @@ -308,7 +308,7 @@ Note: :attr:`~Sitemap.lastmod`. * If :attr:`~Sitemap.lastmod` is a method: The latest ``lastmod`` returned by calling the method with all - items returned by :meth:`Sitemap.items`. + items returned by :meth:`~Sitemap.items`. .. method:: Sitemap.get_languages_for_item(item) @@ -456,7 +456,7 @@ both :file:`sitemap-flatpages.xml` and :file:`sitemap-blog.xml`. The dict don't change at all. If all sitemaps have a ``lastmod`` returned by -:meth:`Sitemap.get_latest_lastmod` the sitemap index will have a +:meth:`~Sitemap.get_latest_lastmod` the sitemap index will have a ``Last-Modified`` header equal to the latest ``lastmod``. You should create an index file if one of your sitemaps has more than 50,000 @@ -556,7 +556,7 @@ URL. Each alternate is a dictionary with ``location`` and ``lang_code`` keys. The ``item`` attribute has been added for each URL to allow more flexible customization of the templates, such as `Google news sitemaps`_. Assuming -Sitemap's :attr:`~Sitemap.items` would return a list of items with +Sitemap's :meth:`~Sitemap.items` would return a list of items with ``publication_data`` and a ``tags`` field something like this would generate a Google News compatible sitemap: |
