mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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>().MenuPosition = _menuService.Get().Select(menuPart => menuPart.MenuPosition).Max() + 1 + ".0";
|
||||||
blog.As<MenuPart>().MenuText = MenuText;
|
blog.As<MenuPart>().MenuText = MenuText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Homepage) {
|
||||||
|
dynamic dblog = blog;
|
||||||
|
if (dblog.AutoroutePart != null) {
|
||||||
|
dblog.AutoroutePart.UseCustomPattern = true;
|
||||||
|
dblog.AutoroutePart.CustomPattern = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_contentManager.Create(blog);
|
_contentManager.Create(blog);
|
||||||
|
|
||||||
Context.Output.WriteLine(T("Blog created successfully"));
|
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
|
// (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.
|
// no AutoroutePart. But it means that normal setup recipes will still be able to give you a homepage without issue.
|
||||||
dynamic dpage = page;
|
if (Homepage || !String.IsNullOrWhiteSpace(Slug)) {
|
||||||
if (dpage.AutoroutePart != null && (Homepage || !String.IsNullOrWhiteSpace(Slug))) {
|
dynamic dpage = page;
|
||||||
dpage.AutoroutePart.UseCustomPattern = true;
|
if (dpage.AutoroutePart != null) {
|
||||||
dpage.AutoroutePart.CustomPattern = Slug;
|
dpage.AutoroutePart.UseCustomPattern = true;
|
||||||
|
dpage.AutoroutePart.CustomPattern = Homepage?"":Slug;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = String.Empty;
|
var text = String.Empty;
|
||||||
|
|||||||
Reference in New Issue
Block a user