Making it so when a content item is set as the home page it's only accessible as the home page and not at its path

- current implication for blogs is that if a blog is set as the home page its posts are then all rooted (e.g. if a blog at
  /blog is set as the home page then it's available at / and a post at, say, /my-post instead of /blog/my-post). There should
  maybe be a setting to alter the paths of the posts but (1) that's a pain at the moment, (2) hacking the URL by removing
  the post slug would result in a 404 instead of redirecting to /, the path of the blog - we don't handle redirects of that
  nature - and (3) the ability to root a blog in this manner *has* been requested by some.

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-12-01 00:51:42 -08:00
parent 2798850a38
commit 381f70d47c
14 changed files with 292 additions and 231 deletions

View File

@@ -281,8 +281,9 @@ namespace Orchard.Setup.Services {
// create a welcome page that's promoted to the home page
var page = contentManager.Create("Page", VersionOptions.Draft);
page.As<RoutePart>().Title = T("Welcome to Orchard!").Text;
page.As<RoutePart>().Path = "";
page.As<RoutePart>().Slug = "";
page.As<RoutePart>().Path = "welcome-to-orchard";
page.As<RoutePart>().Slug = "welcome-to-orchard";
page.As<RoutePart>().PromoteToHomePage = true;
page.As<BodyPart>().Text = T(
@"<p>You've successfully setup your Orchard Site and this is the homepage of your new site.
Here are a few things you can look at to get familiar with the application.
@@ -304,7 +305,6 @@ Modules are created by other users of Orchard just like you so if you feel up to
<p>Thanks for using Orchard The Orchard Team </p>", page.Id).Text;
contentManager.Publish(page);
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
// add a menu item for the shiny new home page
var menuItem = contentManager.Create("MenuItem");