diff --git a/Oqtane.Client/UI/SiteRouter.razor b/Oqtane.Client/UI/SiteRouter.razor index 82df0175..b1570c9f 100644 --- a/Oqtane.Client/UI/SiteRouter.razor +++ b/Oqtane.Client/UI/SiteRouter.razor @@ -240,17 +240,16 @@ page = PageState.Page; } - // failsafe in case router cannot locate the home page for the site - if (page == null && path == "") + // get the page if the path has changed + if (page == null || page.Path != path) { - page = pages.FirstOrDefault(); - path = page.Path; - } - - // check if page has changed - if (page != null && page.Path != path) - { - page = pages.Where(item => item.Path == path).FirstOrDefault(); + page = pages.FirstOrDefault(item => item.Path.Equals(path, StringComparison.OrdinalIgnoreCase)); + // if the home page path does not exist then use the first page in the collection (a future enhancement would allow the admin to specify a home page) + if (page == null && path == "") + { + page = pages.FirstOrDefault(); + path = page.Path; + } editmode = false; }