diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs index 1e18c16bc..00bb39d74 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs @@ -1,5 +1,6 @@ using System; using System.Web; +using Orchard.Autoroute.Services; using Orchard.Commands; using Orchard.ContentManagement; using Orchard.ContentManagement.Aspects; @@ -21,6 +22,7 @@ namespace Orchard.Pages.Commands { private readonly IMenuService _menuService; private readonly INavigationManager _navigationManager; private readonly IAuthenticationService _authenticationService; + private readonly IHomeAliasService _homeAliasService; public PageCommands( IContentManager contentManager, @@ -28,12 +30,15 @@ namespace Orchard.Pages.Commands { IAuthenticationService authenticationService, ISiteService siteService, IMenuService menuService, - INavigationManager navigationManager) { + INavigationManager navigationManager, + IHomeAliasService homeAliasService) { + _contentManager = contentManager; _membershipService = membershipService; _siteService = siteService; _menuService = menuService; _navigationManager = navigationManager; + _homeAliasService = homeAliasService; _authenticationService = authenticationService; } @@ -94,15 +99,9 @@ namespace Orchard.Pages.Commands { } } - //// (PH:Autoroute) Hackish way to leave Slug and Homepage switches intact without requiring a dependency on Autoroute. This may throw an Exception with - //// no AutoroutePart. But it means that normal setup recipes will still be able to give you a homepage without issue. - //if (Homepage || !String.IsNullOrWhiteSpace(Slug)) { - // dynamic dpage = page; - // if (dpage.AutoroutePart != null) { - // dpage.AutoroutePart.UseCustomPattern = true; - // dpage.AutoroutePart.CustomPattern = Homepage ? "/" : Slug; - // } - //} + if (Homepage) { + _homeAliasService.PublishHomeAlias(page); + } var layout = default(string); if (UseWelcomeText) { diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Module.txt b/src/Orchard.Web/Modules/Orchard.Pages/Module.txt index 359f0fc88..bc4ec9972 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Pages/Module.txt @@ -6,5 +6,5 @@ Version: 1.9.1 OrchardVersion: 1.9 Description: Introduces a preconfigured page content type. FeatureDescription: A basic page content type. -Dependencies: Contents, Orchard.ContentPicker +Dependencies: Contents, Orchard.ContentPicker, Orchard.Autoroute Category: Content diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj index ee7a6e2b5..acb29258f 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj +++ b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj @@ -78,6 +78,10 @@ Orchard.Core false + + {66fccd76-2761-47e3-8d11-b45d0001ddaa} + Orchard.Autoroute + {f301ef7d-f19c-4d83-aa94-cb64f29c037d} Orchard.ContentPicker