public override XmlSitemapNode CreateNode(UrlHelper urlHelper, string baseUrl, NamedEntity entity, UrlRecordCollection slugs, Language language)
            {
                var path = string.Empty;

                switch (entity.EntityName)
                {
                case nameof(ForumGroup):
                    path = urlHelper.RouteUrl("ForumGroupSlug", new { id = entity.Id, slug = slugs.GetSlug(language.Id, entity.Id, true) });
                    break;

                case nameof(Forum):
                    path = urlHelper.RouteUrl("ForumSlug", new { id = entity.Id, slug = slugs.GetSlug(language.Id, entity.Id, true) });
                    break;

                case nameof(ForumTopic):
                    path = urlHelper.RouteUrl("TopicSlug", new { id = entity.Id, slug = entity.Slug });
                    break;
                }

                if (path.HasValue())
                {
                    return(new XmlSitemapNode
                    {
                        LastMod = entity.LastMod,
                        Loc = baseUrl + path.TrimStart('/')
                    });
                }

                return(null);
            }
Example #2
0
 private string BuildNodeUrl(string baseUrl, NamedEntity entity, UrlRecordCollection slugs, Language language)
 {
     return(baseUrl + slugs.GetSlug(language.Id, entity.Id, true));
 }
        public virtual XmlSitemapNode CreateNode(UrlHelper urlHelper, string baseUrl, NamedEntity entity, UrlRecordCollection slugs, Language language)
        {
            var slug = slugs.GetSlug(language.Id, entity.Id, true);
            var path = urlHelper.RouteUrl(entity.EntityName, new { SeName = slug }).EmptyNull().TrimStart('/');
            var loc  = baseUrl + path;

            return(new XmlSitemapNode
            {
                LastMod = entity.LastMod,
                Loc = loc
            });
        }