Ignore:
Timestamp:
11/16/06 11:47:49 (6 years ago)
Author:
harald
Message:
  • add schema and namespace definition according to sitmaps.org which should also be compliant with other search engines besides google.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sitemap-plugin/trunk/sitemap/api.py

    r26 r27  
    8383    path = '/sitemap.xml' 
    8484     
    85     ns = "http://www.google.com/schemas/sitemap/0.84" 
     85    xsi ="http://www.w3.org/2001/XMLSchema-instance" 
     86    schemaLocation="http://www.sitemaps.org/schemas/sitemaps/0.9 http://www.sitemaps.org/schemas/sitemaps/sitemap.xsd" 
     87    ns = "http://www.sitemaps.org/schemas/sitemap/0.9" 
    8688     
    8789    def get_descriptions(self): 
     
    121123            doc = Document() 
    122124            urlset = doc.createElement("urlset") 
    123             a = doc.createAttribute('xmlns') 
    124             a.value = self.ns 
    125             urlset.setAttributeNode(a) 
     125 
     126            xns = doc.createAttribute('xmlns:xsi') 
     127            xns.value = self.xsi 
     128 
     129            sl = doc.createAttribute('xsi:schemaLocation') 
     130            sl.value = self.nsschemaLocation 
     131 
     132            ns = doc.createAttribute('xmlns') 
     133            ns.value = self.ns 
     134 
     135            urlset.setAttributeNode(xns) 
     136            urlset.setAttributeNode(sl) 
     137            urlset.setAttributeNode(ns) 
     138 
    126139            for c in self.contributors: 
    127140                for ressource_data in c.get_data(req): 
Note: See TracChangeset for help on using the changeset viewer.