{"action":"created","issue":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6273","labels_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6273/labels{/name}","comments_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6273/comments","events_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6273/events","html_url":"https://github.com/OrchardCMS/Orchard/issues/6273","id":126055532,"number":6273,"title":"IHomeAliasService GetHomePage() issue with a possible fix","user":{"login":"jtkech","id":8586360,"avatar_url":"https://avatars.githubusercontent.com/u/8586360?v=3","gravatar_id":"","url":"https://api.github.com/users/jtkech","html_url":"https://github.com/jtkech","followers_url":"https://api.github.com/users/jtkech/followers","following_url":"https://api.github.com/users/jtkech/following{/other_user}","gists_url":"https://api.github.com/users/jtkech/gists{/gist_id}","starred_url":"https://api.github.com/users/jtkech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtkech/subscriptions","organizations_url":"https://api.github.com/users/jtkech/orgs","repos_url":"https://api.github.com/users/jtkech/repos","events_url":"https://api.github.com/users/jtkech/events{/privacy}","received_events_url":"https://api.github.com/users/jtkech/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/milestones/32","html_url":"https://github.com/OrchardCMS/Orchard/milestones/Orchard%201.10","labels_url":"https://api.github.com/repos/OrchardCMS/Orchard/milestones/32/labels","id":1298264,"number":32,"title":"Orchard 1.10","description":"Issues assigned to this milestone have been approved to be shipped in Orchard 1.10.","creator":{"login":"sebastienros","id":1165805,"avatar_url":"https://avatars.githubusercontent.com/u/1165805?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastienros","html_url":"https://github.com/sebastienros","followers_url":"https://api.github.com/users/sebastienros/followers","following_url":"https://api.github.com/users/sebastienros/following{/other_user}","gists_url":"https://api.github.com/users/sebastienros/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastienros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastienros/subscriptions","organizations_url":"https://api.github.com/users/sebastienros/orgs","repos_url":"https://api.github.com/users/sebastienros/repos","events_url":"https://api.github.com/users/sebastienros/events{/privacy}","received_events_url":"https://api.github.com/users/sebastienros/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":71,"state":"open","created_at":"2015-09-09T19:10:02Z","updated_at":"2016-01-14T21:03:08Z","due_on":"2015-10-05T07:00:00Z","closed_at":null},"comments":4,"created_at":"2016-01-11T22:49:19Z","updated_at":"2016-01-14T22:05:06Z","closed_at":null,"body":"Now, in the dev branch, `IHomeAliasService GetHomePage()` uses somewhere an alias map, based on the area name, and assumes that the home page alias is the first one. But this is not true in some use cases, e.g with some more complex route path graphs...\r\n\r\nE.g if you define a route `.../foo1/` with a trailing slash, and another route like this `.../foo1/foo2`, then, in the alias map, these aliases will be before the home page alias. This is the case when you create a taxonomy and then create some child terms... You have the same kind of issue when modifying the home page slug or promoting another page to be the home page...\r\n\r\n@sfmskywalker, i can fix it easily by modifying the `GetHomePage()` method as below. This to use as before the content manager directly with the `Id` retrieved from the `homePageRoute`... But maybe there is a good reason to use now an `alias map` and then the `AutoroutePartRecord` table... If so, i may have another fix that still take into account the `Id key` in the route values (not only the `area key`)... Let me know.\r\n\r\n        public IContent GetHomePage(VersionOptions version = null) {\r\n            var homePageRoute = GetHomeRoute();\r\n\r\n            if (homePageRoute == null)\r\n                return null;\r\n\r\n            object id;\r\n            if (homePageRoute.TryGetValue(\"id\", out id)) {\r\n                int homePageId;\r\n                if (Int32.TryParse(id.ToString(), out homePageId))\r\n                    return _contentManager.Get(homePageId, version?? VersionOptions.Published);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\nBest"},"comment":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/comments/171796560","html_url":"https://github.com/OrchardCMS/Orchard/issues/6273#issuecomment-171796560","issue_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/6273","id":171796560,"user":{"login":"jtkech","id":8586360,"avatar_url":"https://avatars.githubusercontent.com/u/8586360?v=3","gravatar_id":"","url":"https://api.github.com/users/jtkech","html_url":"https://github.com/jtkech","followers_url":"https://api.github.com/users/jtkech/followers","following_url":"https://api.github.com/users/jtkech/following{/other_user}","gists_url":"https://api.github.com/users/jtkech/gists{/gist_id}","starred_url":"https://api.github.com/users/jtkech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtkech/subscriptions","organizations_url":"https://api.github.com/users/jtkech/orgs","repos_url":"https://api.github.com/users/jtkech/repos","events_url":"https://api.github.com/users/jtkech/events{/privacy}","received_events_url":"https://api.github.com/users/jtkech/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T22:05:06Z","updated_at":"2016-01-14T22:05:06Z","body":"@sebastienros \r\n\r\nI don't recall exactly but i've seen this when trying to use the `FrontEndCultureSelector.cshtml` razor view in `Orchard.Localization` that uses the `GetHomePage()` method. Then i've seen the problem in the scenarios described above. Note: when i was saying: \"define a route .../foo1/\" i meant create a page with \"foo1/\" slug...\r\n\r\nBut the easiest way to repro, with a fresh dev branch installation, is to create one or two new pages. Then edit one of this new page and promote it to be the home page. Then go to the `Welcome to Orchard!` page and you still see `This content is the current home page`.\r\n\r\n@sfmskywalker \r\n\r\nYes, i was referring to the line 73. One question, do you use `Query` on `AutoroutePartRecord` rather than `Get` because it' faster? Or for another reason?\r\n\r\nOh, i didn't think about custom route values as with `blogId`. So i need to re-visit the code, maybe i will have some questions...\r\n\r\nBest\r\n\r\n"}}