Using Django Sitemaps to generate simple dynamic XMLs for SEO?



I am trying to create a basic website where my users can reserve and create their own page which is located at myapp.com/[pagename] assuming that the page name is not already taken by another user. I’d like for an XML file to be dynamically generated each time a user on my website creates their unique page so that search engines can stay informed. I am having trouble using Django’s sitemap system to create a SiteMap object to begin generating dynamic XMLs. Can someone help me get started creating the site map for the userpage object? I've read the documentation, I'm just unsure how the SiteMap object should be properly structured - or if there's a better way to do this since my XML sitemap for this project basically only needs to generate this one type of dynamic URL.


The userpage is based on this object for reference:



class Userpage(models.Model):
PageName = models.CharField(max_length=128, blank=True, unique=True, null=True) #they will enter this input into a form field to reserve their unique url at myapp.com/pagename
PageNameOwner = models.CharField(max_length=128, blank=True, null=True) #owner of page enters their name
OwnerGender = models.CharField(max_length=7, choices=(('male', 'Male'), ('female', 'Female')), blank=True, null=True)
PageViewsCounter = models.IntegerField(null=False, default=0)
PageIsRemoved = models.BooleanField(default=False) #true if mods take down a person’s page

def __unicode__(self):
return self.PageName

No comments:

Post a Comment