Re: Google Sitemap generation - double links

Thorsten Weber <[email protected]> Fri, 27 Jan 2012 12:36:32 +0100
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
Hi Sebastian,

that´s what i thought ...

thanks for sharing the script - works perfect for me!

a way to optimize might be to build the list of folder_types dynamically from metaobj_manager.


kind regards,  
Thorsten Weber

				thorsten weber
				software development

				pro in space gmbh
				spichernstrasse 34a
				50672 köln

				[email protected]
				http://www.proinspace.com

				T: 0049 221.29 21 79.26
				F: 0049 221.29 21 79.94

				managing directors:
				uli wilkes
				jürgen brandt
				oliver blaum

				amtsgericht köln
				hrb 33 444
				ust-idnr DE209049800

Am 27.01.2012 um 12:12 schrieb Sebastian Tänzer:

> I found the problem:
> 
> getHref2IndexHtml() generated the URL of the next child if the parent doesn't have any content (i.e. there's only folders in there).
> I solved this for now by using a python script checking for content like this:
> 
> request = container.REQUEST
> response = request.response
> 
> nodes = context.filteredChildNodes()
> folder_types = ['ZMSFolder', 'ZMSDocument']
> content = []
> 
> for n in nodes:
> if n.meta_id not in folder_types:
> content.append(n.meta_id)
> 
> if content:
> return True
> else:
> return False
> 
> and including it in the sitemap generation:
> 
> ...
> <dtml-in "content.filteredTreeNodes(REQUEST=REQUEST, meta_types=['ZMSFolder'])">
> <dtml-if "checkContent() and not isResource(REQUEST) and isActive(REQUEST)">
> <url>
> <loc><dtml-var domain><dtml-var "getHref2IndexHtml(REQUEST)" html_quote></loc>
> <lastmod><dtml-var "getLangFmtDate(ZopeTime(),'eng','%Y-%m-%d')"></lastmod>
> <dtml-comment><lastmod><dtml-var "getLangFmtDate(getObjProperty('change_dt',REQUEST),'eng','%Y-%m-%d')"></lastmod></dtml-comment>
> <dtml-if "getObjProperty('attr_zmsgoogle_bot_priority',REQUEST)"><priority><dtml-var "getObjProperty('attr_zmsgoogle_bot_priority',REQUEST)" fmt="%.5f"></priority><dtml-else></dtml-if>
> <dtml-if "getObjProperty('attr_zmsgoogle_bot_changefreq',REQUEST)"><changefreq><dtml-var "getObjProperty('attr_zmsgoogle_bot_changefreq',REQUEST)"></changefreq><dtml-else></dtml-if>
> </url>
> </dtml-if>
> </dtml-in> 
> ...
> 
> This works as expected for now.
> 
> Optimizations highly welcome!
> 
> Cheers, Sebastian
> 
> Am 27.01.2012 um 11:32 schrieb Niels Dettenbach:
> 
> > Am Freitag, 27. Januar 2012, 11:12:28 schrieben Sie:
> >> any idea about the double output of some folders?
> > ...not yet, as i can't reproduce this (at least with my published version).
> > 
> > Will check this (i.e. if it relies on some hidden folders or something like 
> > that) on wednesday next week in detail and come back then.
> > 
> > 
> > best regards,
> > 
> > 
> > Niels.
> > -- 
> > ---
> > Niels Dettenbach
> > Syndicat IT&Internet
> > http://www.syndicat.com/
> 
>