Esempio n. 1
0
        public override void Build(BuildContext context)
        {
            var homeAliasRoute = _homeAliasService.GetHomeRoute() ?? new RouteValueDictionary();
            var root           = new XElement("HomeAlias", homeAliasRoute.Select(x => new XElement(Capitalize(x.Key), x.Value)));
            var homePage       = _homeAliasService.GetHomePage(VersionOptions.Latest);

            // If the home alias points to a content item, store its identifier in addition to the routevalues,
            // so we can publish the home page alias during import where the ID primary key value of the home page might have changed,
            // so we can't rely on the route values in that case.
            if (homePage != null)
            {
                var homePageIdentifier = _contentManager.GetItemMetadata(homePage).Identity.ToString();
                root.Attr("Id", homePageIdentifier);
            }

            context.RecipeDocument.Element("Orchard").Add(root);
        }