Permalink
Browse files

add navigationroot_sitemap.xml.gz view

  • Loading branch information...
1 parent cb412ed commit 5a15d74bc353a22db851e54732f8d8a6f0548f26 @toutpt toutpt committed Apr 16, 2012
Showing with 20 additions and 5 deletions.
  1. +2 −2 README.rst
  2. +8 −0 collective/linguasitemap/browser/configure.zcml
  3. +10 −3 collective/linguasitemap/browser/sitemap.py
View
@@ -26,8 +26,8 @@ Authors
- JeanMichel FRANCOIS aka toutpt <toutpt@gmail.com>
-..Contributors
+.. Contributors
.. |cirb| image:: http://www.cirb.irisnet.be/logo.jpg
.. _cirb: http://cirb.irisnet.be
-.. _sitemap: http://support.google.com/webmasters/bin/answer.py?hl=fr&answer=183668&topic=8476&ctx=topic
+.. _sitemap: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=183668&topic=8476&ctx=topic
@@ -16,6 +16,14 @@
permission="zope2.Public"
/>
+ <browser:page
+ name="navigationroot_sitemap.xml.gz"
+ for="plone.app.layout.navigation.interfaces.INavigationRoot"
+ class=".sitemap.NavigationRootSiteMapView"
+ layer=".interfaces.ILayer"
+ permission="zope2.Public"
+ />
+
<adapter
for="Products.CMFCore.interfaces.ISiteRoot
zope.publisher.interfaces.http.IHTTPRequest"
@@ -26,9 +26,6 @@ def publishTraverse(self, request, name):
return sitemap_view
def extractLanguage(self, name):
- is_navigation_root = INavigationRoot.providedBy(self.context)
- if is_navigation_root:
- lang = self.context.Language()
if name.startswith('sitemap') and len(name)>11 and '_' in name:
sitemap = name.split('.')[0]
@@ -103,3 +100,13 @@ def objects(self):
#'changefreq': 'always', # hourly/daily/weekly/monthly/yearly/never
#'prioriy': 0.5, # 0.0 to 1.0
}
+
+class NavigationRootSiteMapView(SiteMapView):
+ """A sitemap that extract the language from the navigation root"""
+
+ def objects(self):
+ is_navigation_root = INavigationRoot.providedBy(self.context)
+ if is_navigation_root:
+ self.language = self.context.Language()
+ return super(NavigationRootSiteMapView, self).objects()
+

0 comments on commit 5a15d74

Please sign in to comment.