Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
What is the best way to get all pages/url's from a Vorto website? I need to create a custom sitemap.xml.
Anyone an idea or suggestion?
Thanks in advance.
Grtz Sander
Hey Sander,
In a recent project doing something similar I took the approach of having a custom controller for my XML site map.
In the action I use this line to get all the domains for my root node (which has all the language elements)
var domains = Services.DomainService.GetAssignedDomains(rootItem.Id, false).ToList();
Then I call this recursive method:
private void AddItemToList(ICollection<SitemapUrl> urlList, IPublishedContent item, IList<IDomain> domains) { if(item.IsVisible() && item.TemplateId != 0 && item.DocumentTypeAlias.Equals("xmlSitemap") == false) { urlList.Add(new SitemapUrl { Url = item.UrlWithDomain().Trim('/'), LastModified = item.UpdateDate.ToString("yyyy-MM-dd"), Alternatives = domains?.Select(d => new SitemapUrlAlternative { Language = d.LanguageIsoCode, Url = $"{Request.Url.Scheme}://{d.DomainName.TrimEnd('/')}{item.Url}".TrimEnd('/') }).ToList() }); } foreach(var child in item.Children()) { AddItemToList(urlList, child, domains); } }
This works pretty well if you ask me :-)
Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Get all urls from all languages in Vorto for sitemap.xml
What is the best way to get all pages/url's from a Vorto website? I need to create a custom sitemap.xml.
Anyone an idea or suggestion?
Thanks in advance.
Grtz Sander
Hey Sander,
In a recent project doing something similar I took the approach of having a custom controller for my XML site map.
In the action I use this line to get all the domains for my root node (which has all the language elements)
Then I call this recursive method:
This works pretty well if you ask me :-)
Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.