def iter_entries(self): language_subset = app.website.get_published_languages( languages=self.included_locales or None) content = Publishable.select_accessible( Publishable.robots_should_index.equal(True), language=language_subset) if self.content_expression: context = {"site_map": self, "content": content} SiteMap.content_expression.execute(self, context) content = context["content"] for publishable in content: if not publishable.is_internal_content(): continue if publishable.per_language_publication: languages = language_subset & publishable.enabled_translations else: languages = (None, ) if not languages: continue properties = {} if publishable.x_sitemap_priority: properties["priority"] = publishable.x_sitemap_priority if publishable.x_sitemap_change_frequency: properties[ "changefreq"] = publishable.x_sitemap_change_frequency entries = [(properties, [(language, publishable.get_uri(host="!", language=language)) for language in languages])] if self.entries_expression: context = { "site_map": self, "publishable": publishable, "languages": languages, "entries": entries, "default_properties": properties } SiteMap.entries_expression.execute(self, context) entries = context["entries"] for entry in entries: yield entry
def items(self): return Publishable.select_accessible( [Publishable.sitemap_indexable.equal(True)])