mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fix blog and page commands Homepage and Slug switches
--HG-- branch : autoroute
This commit is contained in:
@@ -81,6 +81,16 @@ namespace Orchard.Blogs.Commands {
|
||||
blog.As<MenuPart>().MenuPosition = _menuService.Get().Select(menuPart => menuPart.MenuPosition).Max() + 1 + ".0";
|
||||
blog.As<MenuPart>().MenuText = MenuText;
|
||||
}
|
||||
|
||||
if (Homepage) {
|
||||
dynamic dblog = blog;
|
||||
if (dblog.AutoroutePart != null) {
|
||||
dblog.AutoroutePart.UseCustomPattern = true;
|
||||
dblog.AutoroutePart.CustomPattern = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_contentManager.Create(blog);
|
||||
|
||||
Context.Output.WriteLine(T("Blog created successfully"));
|
||||
|
@@ -57,10 +57,12 @@ 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.
|
||||
dynamic dpage = page;
|
||||
if (dpage.AutoroutePart != null && (Homepage || !String.IsNullOrWhiteSpace(Slug))) {
|
||||
dpage.AutoroutePart.UseCustomPattern = true;
|
||||
dpage.AutoroutePart.CustomPattern = Slug;
|
||||
if (Homepage || !String.IsNullOrWhiteSpace(Slug)) {
|
||||
dynamic dpage = page;
|
||||
if (dpage.AutoroutePart != null) {
|
||||
dpage.AutoroutePart.UseCustomPattern = true;
|
||||
dpage.AutoroutePart.CustomPattern = Homepage?"":Slug;
|
||||
}
|
||||
}
|
||||
|
||||
var text = String.Empty;
|
||||
|
Reference in New Issue
Block a user