Пример #1
0
        private static void MapTagsAndCategoriesRoute(RouteCollection routes, IPublishedContent node)
        {
            //Create the routes for /tags/{tag} and /categories/{category}
            routes.MapUmbracoRoute(
                "articulate_tags_" + node.Id,
                (node.Url.EnsureEndsWith('/') + "{action}/{tag}").TrimStart('/'),
                new
            {
                controller = "ArticulateTags",
                tag        = UrlParameter.Optional
            },
                new ArticulateTagsRouteHandler(node.Id,
                                               node.GetPropertyValue <string>("tagsUrlName"),
                                               node.GetPropertyValue <string>("tagsPageName"),
                                               node.GetPropertyValue <string>("categoriesUrlName"),
                                               node.GetPropertyValue <string>("categoriesPageName")),
                //Constraings: only match either the tags or categories url names
                new { action = node.GetPropertyValue <string>("tagsUrlName") + "|" + node.GetPropertyValue <string>("categoriesUrlName") });

            //Create the routes for the RSS specific feeds
            routes.MapUmbracoRoute(
                "articulate_tags_rss_" + node.Id,
                (node.Url.EnsureEndsWith('/') + "{action}/{tag}/rss").TrimStart('/'),
                new
            {
                controller = "ArticulateRss"
            },
                new ArticulateTagsRouteHandler(node.Id,
                                               node.GetPropertyValue <string>("tagsUrlName"),
                                               node.GetPropertyValue <string>("tagsPageName"),
                                               node.GetPropertyValue <string>("categoriesUrlName"),
                                               node.GetPropertyValue <string>("categoriesPageName")),
                //Constraings: only match either the tags or categories url names
                new { action = node.GetPropertyValue <string>("tagsUrlName") + "|" + node.GetPropertyValue <string>("categoriesUrlName") });
        }
Пример #2
0
        private static void MapRssRoute(RouteCollection routes, UrlProvider umbracoUrlProvider, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            var routeHash = nodeRoutePath.GetHashCode();

            //Create the route for the /rss results
            routes.MapUmbracoRoute(
                "articulate_rss_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "rss").TrimStart('/'),
                new
            {
                controller = "ArticulateRss",
                action     = "Index"
            },
                new UmbracoVirtualNodeByIdRouteHandler(umbracoUrlProvider, nodesWithPath));

            routes.MapUmbracoRoute(
                "articulate_rss_xslt_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "rss/xslt").TrimStart('/'),
                new
            {
                controller = "ArticulateRss",
                action     = "FeedXslt"
            },
                new UmbracoVirtualNodeByIdRouteHandler(umbracoUrlProvider, nodesWithPath));
        }
Пример #3
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // Route for the XML sitemap functionality
            routes.MapUmbracoRoute(
                "SitemapXML",
                AppSettings.XMLSitemapRouteUrl,
                new
            {
                controller = nameof(XMLSitemapController).RemoveControllerSuffix(),
                action     = nameof(XMLSitemapController.XMLSitemap)
            },
                new DomainRootRouteHandler()
                );

            // Route for the Content Not Found (Error404) error handling, to make it irrelevant where Error404 node is placed in Content tree.
            string error404RouteUrl = GetError404RouteUrl();

            if (!string.IsNullOrWhiteSpace(error404RouteUrl))
            {
                routes.MapUmbracoRoute(
                    "Error404",
                    error404RouteUrl,
                    new
                {
                    controller = nameof(Error404Controller).RemoveControllerSuffix(),
                    action     = nameof(Error404Controller.Index)
                },
                    new Error404RouteHandler()
                    );
            }
        }
Пример #4
0
        private static void MapTagsAndCategoriesRoute(RouteCollection routes, UrlProvider umbracoUrlProvider, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            var routeHash = nodeRoutePath.GetHashCode();

            //Create the routes for /tags/{tag} and /categories/{category}
            routes.MapUmbracoRoute(
                "articulate_tags_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}").TrimStart('/'),
                new
            {
                controller = "ArticulateTags",
                tag        = UrlParameter.Optional
            },
                new ArticulateTagsRouteHandler(umbracoUrlProvider, nodesWithPath),
                //Constraints: only match either the tags or categories url names
                new { action = new TagsOrCategoryPathRouteConstraint(umbracoUrlProvider, nodesWithPath) });

            //Create the routes for the RSS specific feeds
            routes.MapUmbracoRoute(
                "articulate_tags_rss_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}/rss").TrimStart('/'),
                new
            {
                controller = "ArticulateRss"
            },
                new ArticulateTagsRouteHandler(umbracoUrlProvider, nodesWithPath),
                //Constraints: only match either the tags or categories url names
                new { action = new TagsOrCategoryPathRouteConstraint(umbracoUrlProvider, nodesWithPath) });
        }
Пример #5
0
        /// <summary>
        /// The map routes.
        /// </summary>
        /// <param name="routes">
        /// The routes.
        /// </param>
        public static void MapRoutes(RouteCollection routes)
        {
            int    nodeid          = int.Parse(WebConfigurationManager.AppSettings["BrambleBerry:AuthorizationContentId"]);
            string firstUrlSegment = "authorization";


            routes.MapUmbracoRoute(
                "authResetPassword",
                firstUrlSegment + "/reset-password/{token}/{memberId}",
                new
            {
                controller = "Authorization",
                action     = "ResetPassword",
            },
                new UmbracoVirtualNodeByIdRouteHandler(nodeid));


            routes.MapUmbracoRoute(
                "auth",
                firstUrlSegment + "/{action}",
                new
            {
                controller = "Authorization",
                action     = "Index",
            },
                new UmbracoVirtualNodeByIdRouteHandler(nodeid));
        }
Пример #6
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // Routes for the XML sitemap functionality
            routes.MapUmbracoRoute(
                "SitemapXML",
                AppSettings.XMLSitemapRouteUrl,
                new
            {
                controller = nameof(XMLSitemapController).RemoveControllerSuffix(),
                action     = nameof(XMLSitemapController.XMLSitemap)
            },
                new DomainRootRouteHandler()
                );

            // TODO: Remove on single-language site.
            routes.MapUmbracoRoute(
                "LanguageSpecificSitemapXML",
                $"{{language}}/{AppSettings.XMLSitemapRouteUrl}",
                new
            {
                controller = nameof(XMLSitemapController).RemoveControllerSuffix(),
                action     = nameof(XMLSitemapController.XMLSitemap)
            },
                new DomainRootRouteHandler(),
                new { language = new ExistingLanguagesRouteConstraint() }
                );
        }
Пример #7
0
 private static void MapRssRoute(RouteCollection routes, IPublishedContent node)
 {
     //Create the route for the /rss results
     routes.MapUmbracoRoute(
         "articulate_rss_" + node.Id,
         (node.Url.EnsureEndsWith('/') + "rss").TrimStart('/'),
         new
     {
         controller = "ArticulateRss",
         action     = "Index"
     },
         new UmbracoVirtualNodeByIdRouteHandler(node.Id));
     routes.MapUmbracoRoute(
         "articulate_rss_xslt_" + node.Id,
         (node.Url.EnsureEndsWith('/') + "rss/xslt").TrimStart('/'),
         new
     {
         controller = "ArticulateRss",
         action     = "FeedXslt"
     },
         new UmbracoVirtualNodeByIdRouteHandler(node.Id));
 }
Пример #8
0
        /// <summary>
        /// Maps the route for rendering a receipt
        /// </summary>
        /// <param name="routes">
        /// The routes.
        /// </param>
        public static void MapRoutes(RouteCollection routes)
        {
            //// TODO this is pretty brittle
            var receiptContentId = int.Parse(WebConfigurationManager.AppSettings["BrambleBerry:ReceiptContentId"]);

            routes.MapUmbracoRoute(
                "customerReceipt",
                "checkout/receipt/{key}",
                new
            {
                controller = "Receipt",
                action     = "Receipt"
            },
                new UmbracoVirtualNodeByIdRouteHandler(receiptContentId));
        }
Пример #9
0
        /// <summary>
        /// maps all the routes for the Public Wishlist Pages
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="umbracoCache"></param>
        public static void MapRoutes(RouteCollection routes)
        {
            int nodeid = int.Parse(WebConfigurationManager.AppSettings["BrambleBerry:WishListContentId"]);

            routes.MapUmbracoRoute(
                "wishlistSharedPage",
                "wishlist/{customerId}/{wishlistName}",
                new
            {
                controller   = "Wishlist",
                action       = "View",
                wishlistName = UrlParameter.Optional
            },
                new UmbracoVirtualNodeByIdRouteHandler(nodeid));
        }
Пример #10
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            AppSettingsConfig appSettingsConfig = new AppSettingsConfig();

            routes.MapUmbracoRoute("EpubBookCustomRoute",
                                   appSettingsConfig.BooksPathSegment + "/{booknameid}/" + appSettingsConfig.ReadPathSegment + "/{*readparameters}", // get paths sections for the app settings in web.config
                                   new
            {
                controller     = "UmbEpubReader",
                action         = "UmbEpubReader_Read",
                booknameid     = "",
                readparameters = UrlParameter.Optional
            },
                                   new BookContentFinderByNiceUrl()); // this UmbracoVirtualNodeRouteHandler allows '.' in the url so the plugin can route/serve files (embeded files in the epub)
        }
Пример #11
0
        private void MapAuthorsRssRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            var routeHash = nodeRoutePath.GetHashCode();

            //Create the routes for the RSS author feeds
            routes.MapUmbracoRoute(
                "articulate_author_rss_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "Author/{authorId}/rss").TrimStart('/'),
                new
            {
                controller = "ArticulateRss",
                action     = "Author"
            },
                new ArticulateVirtualNodeByIdRouteHandler(_logger, _contentUrls, nodesWithPath));
        }
Пример #12
0
 private static void MapSearchRoute(RouteCollection routes, IPublishedContent node)
 {
     //Create the route for the /search/{term} results
     routes.MapUmbracoRoute(
         "articulate_search_" + node.Id,
         (node.Url.EnsureEndsWith('/') + node.GetPropertyValue <string>("searchUrlName") + "/{term}").TrimStart('/'),
         new
     {
         controller = "ArticulateSearch",
         action     = "Search",
         term       = UrlParameter.Optional
     },
         new ArticulateSearchRouteHandler(node.Id,
                                          node.GetPropertyValue <string>("searchUrlName"),
                                          node.GetPropertyValue <string>("searchPageName")));
 }
Пример #13
0
        private static void MapMarkdownEditorRoute(RouteCollection routes, UrlProvider umbracoUrlProvider, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //var routePath = (nodeRoutePath.EnsureEndsWith('/') + "a-new/" + node.Id).TrimStart('/');
            var routeHash = nodeRoutePath.GetHashCode();

            //var name = "articulate_markdown_new" + node.Id;

            routes.MapUmbracoRoute(
                "articulate_markdown_new" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "a-new").TrimStart('/'),
                new
            {
                controller = "MarkdownEditor",
                action     = "NewPost"
            },
                new UmbracoVirtualNodeByIdRouteHandler(umbracoUrlProvider, nodesWithPath));
        }
Пример #14
0
        public static void MapRoutes(RouteCollection routes)
        {
            int nodeid = int.Parse(WebConfigurationManager.AppSettings["BrambleBerry:AccountContentId"]);

            routes.MapUmbracoRoute(
                "accountRoutes",
                "account/{controller}/{action}/{id}",
                new
            {
                controller = "MyAccountIndex",
                action     = "index",
                id         = UrlParameter.Optional
            },
                new UmbracoVirtualNodeByIdRouteHandler(nodeid),
                new { controller = new AccountSectionConstraint() },
                new[] { "BrambleBerry.Kitchen.Controllers.Account" }
                );
        }
Пример #15
0
        private static void MapSearchRoute(RouteCollection routes, UrlProvider umbracoUrlProvider, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //we need to group by the search url name and make unique routes amongst those,
            // alternatively we could create route constraints like we do for the tags/categories routes
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue <string>("searchUrlName")))
            {
                //the hash needs to be the combination of the nodeRoutePath and the searchUrl group
                var routeHash = (nodeRoutePath + nodeSearch.Key).GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    "articulate_search_" + routeHash,
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{term}").TrimStart('/'),
                    new
                {
                    controller = "ArticulateSearch",
                    action     = "Search",
                    term       = UrlParameter.Optional
                },
                    new ArticulateSearchRouteHandler(umbracoUrlProvider, nodesWithPath));
            }
        }
        /// <summary>
        /// Create the dialogue page route - It's a fake page
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="umbracoUrlProvider"></param>
        /// <param name="nodeRoutePath"></param>
        /// <param name="nodesWithPath"></param>
        private static void MapDialoguePages(RouteCollection routes, UrlProvider umbracoUrlProvider, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue <string>(AppConstants.PropDialogueUrlName)))
            {
                if (string.IsNullOrWhiteSpace(nodeSearch.Key))
                {
                    continue;
                }

                var routeHash = nodeSearch.Key.GetHashCode();

                routes.MapUmbracoRoute(
                    string.Format(DialoguePageRouteName, routeHash),
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{pagename}").TrimStart('/'),
                    new
                {
                    controller = "DialoguePage",
                    action     = "Show",
                    topicname  = UrlParameter.Optional
                },
                    new DialoguePageRouteHandler(umbracoUrlProvider, nodesWithPath));
            }
        }
Пример #17
0
        /// <summary>
        /// Create the Topic route - It's a fake page
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="nodeRoutePath"></param>
        /// <param name="nodesWithPath"></param>
        private static void MapTopicRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue <string>(AppConstants.PropTopicUrlName)))
            {
                if (string.IsNullOrWhiteSpace(nodeSearch.Key))
                {
                    continue;
                }

                var routeHash = nodeSearch.Key.GetHashCode();

                //Create the route for the /topic/{topic-name-here}
                routes.MapUmbracoRoute(
                    string.Format(TopicRouteName, routeHash),
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{topicname}").TrimStart('/'),
                    new
                {
                    controller = "DialogueTopic",
                    action     = "Show",
                    topicname  = UrlParameter.Optional
                },
                    new DialogueTopicRouteHandler(nodesWithPath));
            }
        }
Пример #18
0
        /// <summary>
        /// Create the member profile route - It's a fake page
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="nodeRoutePath"></param>
        /// <param name="nodesWithPath"></param>
        private static void MapMemberRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
 
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>(AppConstants.PropMemberUrlName)))
            {
                if (string.IsNullOrWhiteSpace(nodeSearch.Key))
                    continue;
                    
                var routeHash = nodeSearch.Key.GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    string.Format(MemberRouteName, routeHash),
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{membername}").TrimStart('/'),
                    new
                    {
                        controller = "DialogueMember",
                        action = "Show",
                        topicname = UrlParameter.Optional
                    },
                    new DialogueMemberRouteHandler(nodesWithPath));
            }

        }
Пример #19
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var root = new UmbracoHelper(UmbracoContext.Current).TypedContentAtRoot().FirstOrDefault();

            routes.MapUmbracoRoute(
                name: "about",
                url: "{lang}/about",
                defaults: new
            {
                lang       = "da",
                controller = "About",
                action     = "About"
            },
                constraints: new { lang = "[a-z]{2}" },
                virtualNodeHandler: new UmbracoVirtualNodeByIdRouteHandler(root != null ? root.Id : 0)
                );

            routes.MapUmbracoRoute(
                name: "enDefaultLocations",
                url: "{lang}/places/{tagId}/{tag}",
                defaults: new
            {
                lang       = "da",
                tagId      = UrlParameter.Optional,
                tag        = UrlParameter.Optional,
                controller = "locations",
                action     = "locations"
            },
                constraints: new { lang = "[a-z]{2}" },
                virtualNodeHandler: new UmbracoVirtualNodeByIdRouteHandler(root != null ? root.Id : 0)
                );

            routes.MapUmbracoRoute(
                name: "enLocationDetails",
                url: "{lang}/place/{id}/{name}",
                defaults: new
            {
                controller = "Location",
                action     = "Location",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "locationDetails",
                url: "place/{id}/{name}",
                defaults: new
            {
                controller = "Location",
                action     = "Location",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "enLocationArchive",
                url: "{lang}/placeArchive/{id}/{name}",
                defaults: new
            {
                controller = "LocationArchive",
                action     = "LocationArchive",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "locationArchive",
                url: "placeArchive/{id}/{name}",
                defaults: new
            {
                controller = "LocationArchive",
                action     = "LocationArchive",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "writerArchive",
                url: "writerArchive/{id}/{name}/{filter}",
                defaults: new
            {
                controller = "WriterArchive",
                action     = "WriterArchive",
                lang       = "da",
                filter     = UrlParameter.Optional,
                name       = UrlParameter.Optional
            },
                constraints: new { id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "enWriterArchive",
                url: "{lang}/writerArchive/{id}/{name}/{filter}",
                defaults: new
            {
                controller = "WriterArchive",
                action     = "WriterArchive",
                lang       = "da",
                filter     = UrlParameter.Optional,
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "writer",
                url: "writer/{id}/{name}",
                defaults: new
            {
                controller = "Writer",
                action     = "Writer",
                name       = UrlParameter.Optional
            },
                constraints: new { id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "enWriter",
                url: "{lang}/writer/{id}/{name}",
                defaults: new
            {
                controller = "Writer",
                action     = "Writer",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "enDefaultArticles",
                url: "{lang}/articles/{tagId}/{tag}",
                defaults: new
            {
                lang       = "da",
                tagId      = UrlParameter.Optional,
                tag        = UrlParameter.Optional,
                controller = "Articles",
                action     = "Articles"
            },
                constraints: new { lang = "[a-z]{2}" },
                virtualNodeHandler: new UmbracoVirtualNodeByIdRouteHandler(root != null ? root.Id : 0)
                );

            routes.MapUmbracoRoute(
                name: "enArticleDetails",
                url: "{lang}/article/{id}/{name}",
                defaults: new
            {
                controller = "Article",
                action     = "Article",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "articleDetails",
                url: "article/{id}/{name}",
                defaults: new
            {
                controller = "Article",
                action     = "Article",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "enDetails",
                url: "{lang}/{id}/{name}",
                defaults: new
            {
                controller = "Recommendation",
                action     = "Recommendation",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapUmbracoRoute(
                name: "details",
                url: "{id}/{name}",
                defaults: new
            {
                controller = "Recommendation",
                action     = "Recommendation",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { lang = "[a-z]{2}", id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapRoute(
                name: "tips",
                url: "tips",
                defaults: new {
                controller = "Recommendations",
                action     = "Tips"
            });

            routes.MapUmbracoRoute(
                name: "default",
                url: "{lang}/{controller}/{action}",
                defaults: new { lang = "da", controller = "Recommendations", action = "Recommendations" },
                constraints: new { lang = "[a-z]{2}" },
                virtualNodeHandler: new UmbracoVirtualNodeByIdRouteHandler(root != null ? root.Id : 0)
                );

            routes.MapUmbracoRoute(
                name: "preview",
                url: "{id}.aspx",
                defaults: new
            {
                controller = "Recommendation",
                action     = "Recommendation",
                lang       = "da",
                name       = UrlParameter.Optional
            },
                constraints: new { id = @"\d+" },
                virtualNodeHandler: new RecommendationNodeRouteHandler()
                );

            routes.MapRoute(
                name: "defaultMVC",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });

            routes.MapHttpRoute(
                name: "DictionanyApi",
                routeTemplate: "api/{controller}/{action}/{label}/{lang}"
                );
        }
Пример #20
0
        private static void MapRssRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            var routeHash = nodeRoutePath.GetHashCode();

            //Create the route for the /rss results
            routes.MapUmbracoRoute(
                "articulate_rss_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "rss").TrimStart('/'),
                new
                {
                    controller = "ArticulateRss",
                    action = "Index"
                },
                new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));

            routes.MapUmbracoRoute(
                "articulate_rss_xslt_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "rss/xslt").TrimStart('/'),
                new
                {
                    controller = "ArticulateRss",
                    action = "FeedXslt"
                },
                new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));
        }
Пример #21
0
        private static void MapSearchRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //we need to group by the search url name and make unique routes amongst those,
            // alternatively we could create route constraints like we do for the tags/categories routes
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>("searchUrlName")))
            {
                //the hash needs to be the combination of the nodeRoutePath and the searchUrl group
                var routeHash = (nodeRoutePath + nodeSearch.Key).GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    "articulate_search_" + routeHash,
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{term}").TrimStart('/'),
                    new
                    {
                        controller = "ArticulateSearch",
                        action = "Search",
                        term = UrlParameter.Optional
                    },
                    new ArticulateSearchRouteHandler(nodesWithPath));
            }
        }
Пример #22
0
        private static void MapTagsAndCategoriesRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            var routeHash = nodeRoutePath.GetHashCode();

            //Create the routes for /tags/{tag} and /categories/{category}
            routes.MapUmbracoRoute(
                "articulate_tags_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}").TrimStart('/'),
                new
                {
                    controller = "ArticulateTags",
                    tag = UrlParameter.Optional
                },
                new ArticulateTagsRouteHandler(nodesWithPath),
                //Constraints: only match either the tags or categories url names
                new { action = new TagsOrCategoryPathRouteConstraint(nodesWithPath) });

            //Create the routes for the RSS specific feeds
            routes.MapUmbracoRoute(
                "articulate_tags_rss_" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}/rss").TrimStart('/'),
                new
                {
                    controller = "ArticulateRss"
                },
                new ArticulateTagsRouteHandler(nodesWithPath),
                //Constraints: only match either the tags or categories url names
                new { action = new TagsOrCategoryPathRouteConstraint(nodesWithPath) });
        }
Пример #23
0
        private static void MapMarkdownEditorRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //var routePath = (nodeRoutePath.EnsureEndsWith('/') + "a-new/" + node.Id).TrimStart('/');
            var routeHash = nodeRoutePath.GetHashCode();

            //var name = "articulate_markdown_new" + node.Id;

            routes.MapUmbracoRoute(
                "articulate_markdown_new" + routeHash,
                (nodeRoutePath.EnsureEndsWith('/') + "a-new").TrimStart('/'),
                new
                {
                    controller = "MarkdownEditor",
                    action = "NewPost"
                },
                new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));
        }