Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
886f7cc7
Kaydet (Commit)
886f7cc7
authored
May 19, 2013
tarafından
Marc Tamlyn
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1098 from zsiciarz/ticket-16829
Added example of using sitemaps with static views.
üst
753edfa4
d77082b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
sitemaps.txt
docs/ref/contrib/sitemaps.txt
+40
-0
No files found.
docs/ref/contrib/sitemaps.txt
Dosyayı görüntüle @
886f7cc7
...
@@ -280,6 +280,46 @@ Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
...
@@ -280,6 +280,46 @@ Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
.. _URLconf: ../url_dispatch/
.. _URLconf: ../url_dispatch/
Sitemap for static views
========================
Often you want the search engine crawlers to index views which are neither
object detail pages nor flatpages. The solution is to explicitly list URL
names for these views in ``items`` and call
:func:`~django.core.urlresolvers.reverse` in the ``location`` method of
the sitemap. For example::
# sitemaps.py
from django.contrib import sitemaps
from django.core.urlresolvers import reverse
class StaticViewSitemap(sitemaps.Sitemap):
priority = 0.5
changefreq = 'daily'
def items(self):
return ['main', 'about', 'license']
def location(self, item):
return reverse(item)
# urls.py
from django.conf.urls import patterns, url
from .sitemaps import StaticViewSitemap
sitemaps = {
'static': StaticViewSitemap,
}
urlpatterns = patterns('',
url(r'^$', 'views.main', name='main'),
url(r'^about/$', 'views.about', name='about'),
url(r'^license/$', 'views.license', name='license'),
# ...
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
)
Creating a sitemap index
Creating a sitemap index
========================
========================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment