Beispiel #1
0
        public static IRouteBuilder UseCustomRoutes(
            this IRouteBuilder
            routes, bool useFolders,
            IConfiguration config)
        {
            var useCustomRoutes = config.GetValue <bool>("DevOptions:UseCustomRoutes");

            if (useFolders)
            {
                routes.AddCultureBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
            }

            routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddBlogRoutesForSimpleContent();

            routes.AddSimpleContentStaticResourceRoutes();

            //TODO filemanager culture routes?

            routes.AddCloudscribeFileManagerRoutes();



            if (useFolders)
            {
                routes.MapRoute(
                    name: "foldererrorhandler",
                    template: "{sitefolder}/oops/error/{statusCode?}",
                    defaults: new { controller = "Oops", action = "Error" },
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap-localized",
                    template: "{sitefolder}/{culture}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap",
                    template: "{sitefolder}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog-localized",
                    template: "{sitefolder}/{culture}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog",
                    template: "{sitefolder}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifolderrss-localized",
                    template: "{sitefolder}/{culture}/api/rss"
                    , defaults: new { controller = "FolderRss", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifolderrss",
                    template: "{sitefolder}/api/rss"
                    , defaults: new { controller = "FolderRss", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                if (useCustomRoutes)
                {
                    routes.MapRoute(
                        name: "folderdefault",
                        template: "{sitefolder}/{controller}/{action}/{id?}"
                        , defaults: new { controller = "Home", action = "Index" }
                        , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                        );

                    routes.AddCultureCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true), "docs");

                    routes.AddCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), "docs");
                }
                else
                {
                    routes.MapRoute(
                        name: "foldersitemap-localized",
                        template: "{sitefolder}/{culture}/sitemap"
                        , defaults: new { controller = "Page", action = "SiteMap" }
                        , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                        );

                    routes.MapRoute(
                        name: "foldersitemap",
                        template: "{sitefolder}/sitemap"
                        , defaults: new { controller = "Page", action = "SiteMap" }
                        , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                        );

                    routes.MapRoute(
                        name: "folderdefault-localized",
                        template: "{sitefolder}/{culture}/{controller}/{action}/{id?}",
                        defaults: new { controller = "Home" },
                        constraints: new { sitefolder = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) });

                    routes.MapRoute(
                        name: "folderdefault",
                        template: "{sitefolder}/{controller}/{action}/{id?}"
                        , defaults: new { controller = "Home" }
                        , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                        );

                    routes.AddCulturePageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                    routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());

                    //routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(),"");
                }
            }

            if (useCustomRoutes)
            {
                routes.AddCultureCustomPageRouteForSimpleContent(new CultureSegmentRouteConstraint(), "docs");
                routes.AddCustomPageRouteForSimpleContent("docs");
            }


            routes.MapRoute(
                name: "errorhandler",
                template: "oops/error/{statusCode?}",
                defaults: new { controller = "Oops", action = "Error" }
                );

            routes.MapRoute(
                name: "api-sitemap-culture",
                template: "{culture}/api/sitemap"
                , defaults: new { controller = "CultureSiteMap", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-rss-culture",
                template: "{culture}/api/rss"
                , defaults: new { controller = "CultureRss", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-metaweblog-culture",
                template: "{culture}/api/metaweblog"
                , defaults: new { controller = "CultureMetaweblog", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap-localized",
                template: "sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap",
                template: "sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                );

            var useHomeIndexAsDefault = config.GetValue <bool>("DevOptions:UseHomeIndexAsDefault");

            if (useHomeIndexAsDefault)
            {
                routes.MapRoute(
                    name: "default-localized",
                    template: "{culture}/{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" },
                    constraints: new { culture = new CultureSegmentRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}"
                    , defaults: new { controller = "Home", action = "Index" }
                    );
            }
            else
            {
                routes.MapRoute(
                    name: "default-localized",
                    template: "{culture}/{controller}/{action}/{id?}",
                    defaults: null,
                    constraints: new { culture = new CultureSegmentRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}"
                    //, defaults: new { controller = "Home", action = "Index" }
                    );
            }


            if (!useCustomRoutes)
            {
                routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint());
                routes.AddDefaultPageRouteForSimpleContent();
            }
            //routes.AddBlogRoutesForSimpleContent("");


            return(routes);
        }
Beispiel #2
0
        public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes)
#endif
        {
#if (SimpleContentConfig != "z")
#if (SimpleContentConfig != "c")
#if (MultiTenantMode == 'FolderName')
            if (useFolders)
            {
                routes.AddCultureBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
            }
#endif
            routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddBlogRoutesForSimpleContent();
#endif
            routes.AddSimpleContentStaticResourceRoutes();
#endif
            routes.AddCloudscribeFileManagerRoutes();
#if (MultiTenantMode == 'FolderName')
            if (useFolders)
            {
                routes.MapRoute(
                    name: "foldererrorhandler",
                    template: "{sitefolder}/oops/error/{statusCode?}",
                    defaults: new { controller = "Oops", action = "Error" },
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap-localized",
                    template: "{sitefolder}/{culture}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap",
                    template: "{sitefolder}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

#if (ContactForm)
                routes.MapRoute(
                    name: "foldercontact-localized",
                    template: "{sitefolder}/{culture}/contact",
                    defaults: new { controller = "Contact", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "foldercontact",
                    template: "{sitefolder}/contact",
                    defaults: new { controller = "Contact", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );
#endif
#if (SimpleContentConfig == "a" || SimpleContentConfig == "b")
                routes.MapRoute(
                    name: "foldersitemap-localized",
                    template: "{sitefolder}/{culture}/sitemap"
                    , defaults: new { controller = "Page", action = "SiteMap" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "foldersitemap",
                    template: "{sitefolder}/sitemap"
                    , defaults: new { controller = "Page", action = "SiteMap" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog-localized",
                    template: "{sitefolder}/{culture}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog",
                    template: "{sitefolder}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifolderrss",
                    template: "{sitefolder}/api/rss"
                    , defaults: new { controller = "FolderRss", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );
#endif
#if (SimpleContentConfig == "c")
                // you can easily add pages by uncommenting this and uncommenting the coresponding node in navigation.xml
                //routes.AddCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), "NONROOTPAGESEGMENT");
#endif
#if (SimpleContentConfig == "a" || SimpleContentConfig == "c")
                routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: null,
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );
#endif
#if (SimpleContentConfig == "a")
                routes.AddCulturePageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
#endif
#if (SimpleContentConfig == "b")
                routes.AddCultureCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true), "NONROOTPAGESEGMENT");
                routes.AddCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), "NONROOTPAGESEGMENT");
#endif
#if (SimpleContentConfig == "z" || SimpleContentConfig == "b" || SimpleContentConfig == "d")
                routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: new { action = "Index" },
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );
#endif
#if (SimpleContentConfig == "c")
                //blog as default route
                routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), "");
#endif
            }
#endif
            routes.MapRoute(
                name: "errorhandler",
                template: "oops/error/{statusCode?}",
                defaults: new { controller = "Oops", action = "Error" }
                );
#if (Forum)
            routes.AddForumRoutes(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
#endif

#if (ContactForm)
            routes.MapRoute(
                name: "contact",
                template: "contact",
                defaults: new { controller = "Contact", action = "Index" }
                );
#endif

#if (SimpleContentConfig == "a" || SimpleContentConfig == "b")
            routes.MapRoute(
                name: "api-sitemap-culture",
                template: "{culture}/api/sitemap"
                , defaults: new { controller = "CultureSiteMap", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-rss-culture",
                template: "{culture}/api/rss"
                , defaults: new { controller = "CultureRss", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-metaweblog-culture",
                template: "{culture}/api/metaweblog"
                , defaults: new { controller = "CultureMetaweblog", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap-localized",
                template: "{culture}/sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap",
                template: "sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                );
#endif
#if (SimpleContentConfig == "c")
            // you can easily add pages by uncommenting this and uncommenting the coresponding node in navigation.xml
            //routes.AddCustomPageRouteForSimpleContent("NONROOTPAGESEGMENT");
#endif
#if (SimpleContentConfig == "a" || SimpleContentConfig == "c")
            routes.MapRoute(
                name: "default-localized",
                template: "{culture}/{controller}/{action}/{id?}",
                defaults: new { action = "Index" },
                constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "def",
                template: "{controller}/{action}"
                , defaults: new { action = "Index" }
                );
#endif
#if (SimpleContentConfig == "a")
            routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddDefaultPageRouteForSimpleContent();
#endif
#if (SimpleContentConfig == "b")
            routes.AddCultureCustomPageRouteForSimpleContent(new CultureSegmentRouteConstraint(), "NONROOTPAGESEGMENT");
            routes.AddCustomPageRouteForSimpleContent("NONROOTPAGESEGMENT");
#endif

#if (SimpleContentConfig == "z" || SimpleContentConfig == "b" || SimpleContentConfig == "d")
            routes.MapRoute(
                name: "default-localized",
                template: "{culture}/{controller}/{action}/{id?}",
                defaults: new { controller = "Home", action = "Index" },
                constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "def",
                template: "{controller}/{action}"
                , defaults: new { controller = "Home", action = "Index" }
                );
#endif
#if (SimpleContentConfig == "c")
            //blog as default route
            routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint(), "");
            routes.AddBlogRoutesForSimpleContent("");
#endif

            return(routes);
        }
Beispiel #3
0
        /// this traditional mvc routing works around a bug in endpoint routing
        public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes, bool useFolders)
        {
            if (useFolders)
            {
                routes.AddCultureBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
            }
            routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddBlogRoutesForSimpleContent();
            routes.AddSimpleContentStaticResourceRoutes();
            routes.AddCloudscribeFileManagerRoutes();
            if (useFolders)
            {
                routes.MapRoute(
                    name: "foldererrorhandler",
                    template: "{sitefolder}/oops/error/{statusCode?}",
                    defaults: new { controller = "Oops", action = "Error" },
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap-localized",
                    template: "{sitefolder}/{culture}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldersitemap",
                    template: "{sitefolder}/api/sitemap"
                    , defaults: new { controller = "FolderSiteMap", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "foldersitemap-localized",
                    template: "{sitefolder}/{culture}/sitemap"
                    , defaults: new { controller = "Page", action = "SiteMap" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "foldersitemap",
                    template: "{sitefolder}/sitemap"
                    , defaults: new { controller = "Page", action = "SiteMap" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog-localized",
                    template: "{sitefolder}/{culture}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) }
                    );

                routes.MapRoute(
                    name: "apifoldermetaweblog",
                    template: "{sitefolder}/api/metaweblog"
                    , defaults: new { controller = "FolderMetaweblog", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "apifolderrss",
                    template: "{sitefolder}/api/rss"
                    , defaults: new { controller = "FolderRss", action = "Index" }
                    , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );

                routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: null,
                    constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }
                    );
                routes.AddCulturePageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true));
                routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint());
            }
            routes.MapRoute(
                name: "errorhandler",
                template: "oops/error/{statusCode?}",
                defaults: new { controller = "Oops", action = "Error" }
                );


            routes.MapRoute(
                name: "api-sitemap-culture",
                template: "{culture}/api/sitemap"
                , defaults: new { controller = "CultureSiteMap", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-rss-culture",
                template: "{culture}/api/rss"
                , defaults: new { controller = "CultureRss", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-metaweblog-culture",
                template: "{culture}/api/metaweblog"
                , defaults: new { controller = "CultureMetaweblog", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap-localized",
                template: "{culture}/sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap",
                template: "sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                );
            routes.MapRoute(
                name: "default-localized",
                template: "{culture}/{controller}/{action}/{id?}",
                defaults: new { action = "Index" },
                constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "def",
                template: "{controller}/{action}"
                , defaults: new { action = "Index" }
                );
            routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddDefaultPageRouteForSimpleContent();


            return(routes);
        }
        /// this traditional mvc routing works around a bug in endpoint routing
        public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes)
        {
            routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddBlogRoutesForSimpleContent();
            routes.AddSimpleContentStaticResourceRoutes();
            routes.AddCloudscribeFileManagerRoutes();
            routes.MapRoute(
                name: "errorhandler",
                template: "oops/error/{statusCode?}",
                defaults: new { controller = "Oops", action = "Error" }
                );

            routes.MapRoute(
                name: "contact",
                template: "contact",
                defaults: new { controller = "Contact", action = "Index" }
                );

            routes.MapRoute(
                name: "api-sitemap-culture",
                template: "{culture}/api/sitemap"
                , defaults: new { controller = "CultureSiteMap", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-rss-culture",
                template: "{culture}/api/rss"
                , defaults: new { controller = "CultureRss", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "api-metaweblog-culture",
                template: "{culture}/api/metaweblog"
                , defaults: new { controller = "CultureMetaweblog", action = "Index" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap-localized",
                template: "{culture}/sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                , constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "sitemap",
                template: "sitemap"
                , defaults: new { controller = "Page", action = "SiteMap" }
                );
            routes.MapRoute(
                name: "default-localized",
                template: "{culture}/{controller}/{action}/{id?}",
                defaults: new { action = "Index" },
                constraints: new { culture = new CultureSegmentRouteConstraint() }
                );

            routes.MapRoute(
                name: "def",
                template: "{controller}/{action}"
                , defaults: new { action = "Index" }
                );
            routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint());
            routes.AddDefaultPageRouteForSimpleContent();


            return(routes);
        }