44from imio .smartweb .core .contents .rest .events .endpoint import EventsEndpointGet
55from imio .smartweb .core .contents .rest .news .endpoint import NewsEndpointGet
66from imio .smartweb .core .interfaces import IImioSmartwebCoreLayer
7+ from imio .smartweb .locales import SmartwebMessageFactory as _
78from plone .app .layout .navigation .navtree import buildFolderTree
89from plone .app .layout .sitemap .sitemap import SiteMapView
910from plone .base .interfaces import IPloneSiteRoot
@@ -76,7 +77,11 @@ def get_endpoint_data(obj, request):
7677def format_sitemap_items (items , base_url ):
7778 """Format items for sitemap(.xml.gz)"""
7879 formatted_items = []
80+ latest_lastmod = None
81+ item_type = ""
7982 for item in items :
83+ item_type = item .get ("@type" , "" )
84+ lastmod = item .get ("lastmod" )
8085 item_id = normalizeString (item .get ("title" ))
8186 item_uid = item .get ("UID" )
8287 lastmod = item .get ("modified" ) or "1970-01-01T00:00:00Z"
@@ -94,6 +99,29 @@ def format_sitemap_items(items, base_url):
9499 "normalized_portal_type" : "imio-smartweb-authsources-item" ,
95100 }
96101 )
102+ if latest_lastmod is None or lastmod > latest_lastmod :
103+ latest_lastmod = lastmod
104+ seo_title = ""
105+ if item_type == "imio.news.NewsItem" :
106+ seo_title = _ ("News : SEO Links" )
107+ elif item_type == "imio.directory.Contact" :
108+ seo_title = _ ("Directory : SEO Links" )
109+ else :
110+ seo_title = _ ("Agenda : SEO Links" )
111+ formatted_items .append (
112+ {
113+ "loc" : f"{ base_url } /seo_html" ,
114+ "lastmod" : latest_lastmod ,
115+ "Title" : seo_title ,
116+ "Description" : seo_title ,
117+ "getURL" : f"{ base_url } /seo_html" ,
118+ "getRemoteUrl" : Missing .Value ,
119+ "currentItem" : False ,
120+ "currentParent" : False ,
121+ "normalized_review_state" : "published" ,
122+ "normalized_portal_type" : "imio-smartweb-authsources-root" ,
123+ }
124+ )
97125 return formatted_items
98126
99127
0 commit comments