1
주기적으로 추가 및 제거되는 콘텐츠 용 동적 페이지가 포함 된 웹 사이트가 있습니다. 이와 함께 웹 사이트에는 /,/about, how-it-works 등과 같이 항상 존재하는 정적 페이지가 있습니다. 사이트 맵에 모든 동적 콘텐츠 페이지를로드하도록 sitemaps.py 파일을 구성했습니다.Django 사이트 맵 정적 페이지
sitemap.xml의
...
<url>
<loc>
https://www.mywebsite.com/record?type=poem&id=165
</loc>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
...
sitemaps.py
from django.contrib.sitemaps import Sitemap
from website.models import Content
class MySitemap(Sitemap):
changefreq = "weekly"
priority = 0.5
def items(self):
return Content.objects.all()
models.py
class Content(models.Model):
content_type = models.CharField(max_length=255)
...
def get_absolute_url(self):
return '/record?type=' + self.content_type + '&id=' + str(self.id)
가 어떻게 tho를 추가하려면 정적 페이지 (/,/about 등) 내 사이트 맵에? 감사합니다.