How can I create some custom pages in the time of creating a new web site

Topics: Core, Customizing Orchard
Dec 11, 2015 at 10:10 AM

Good day!!!

I need to know about create some custom pages in the time of creating a new web site, just like that Orchard default home page.

Can you please help me!

Thanking you.
Dec 11, 2015 at 12:40 PM
Very easy, especially if you're on the dev branch. Simply create your pages, export them (including any referenced content items such as media items). The exported XML file is in fact a recipe (and when using the dev branch version you can even mark your recipe as a Setup recipe so you don;t have to do this manually). Simply save your XML file with a filename ending in .recipe.xml in a folder called Recipes in your custom module (or the Orchard.Setup module). Checkout the existing recipes form the Orchard.Setup module (Recipes folder) to see how the existing ones are setup. You could copy one of them and add your own pages to it. With that in place, simply delete your App_Data folder, run your site, and select your own recipe, and voila, your pages will be created during setup. Give it a try and let me know if you have any questions.
Marked as answer by Nitheesh on 12/11/2015 at 8:11 AM
Dec 11, 2015 at 4:11 PM
Thank you so much!!!
Dec 16, 2015 at 12:02 PM
Edited Dec 16, 2015 at 12:19 PM

I have successfully created one Recipe just like:

<?xml version="1.0"?>
<Name>My WebSite</Name>
<Description>The WebSite recipe includes pages, custom content types, comments, tags, widgets and basic navigation.</Description>
<Author>Test Limited</Author>
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,Orchard.Alias,Orchard.Autoroute,
               TestDefaultTheme" />
  <Page ContentTypeSettings.Draftable="True" TypeIndexing.Indexes="Search">
    <TagsPart />
    <LocalizationPart />
    <AutoroutePart />
    <MenuPart />
  <BlogPost ContentTypeSettings.Draftable="True" TypeIndexing.Indexes="Search">
    <CommentsPart />
    <TagsPart />
    <LocalizationPart />
    <AutoroutePart />
  <BodyPart BodyPartSettings.FlavorDefault="html" />
<Settings />
<Migration features="*" />
layer create Default /LayerRule:"true" /Description:"The widgets in this layer are displayed on all pages"
layer create Authenticated /LayerRule:"authenticated" /Description:"The widgets in this layer are displayed when the user is authenticated"
layer create Anonymous /LayerRule:"not authenticated" /Description:"The widgets in this layer are displayed when the user is anonymous"
layer create Disabled /LayerRule:"false" /Description:"The widgets in this layer are never displayed"
layer create TheHomepage /LayerRule:"url '~/'" /Description:"The widgets in this layer are displayed on the home page"
site setting set baseurl
menu create /MenuName:"Main Menu"
page create /Slug:"welcome-to-website" /Title:"Welcome to Website!" /Path:"welcome-to-website" /Homepage:true /Publish:true /UseWelcomeText:true
menuitem create /MenuPosition:"0" /MenuText:"Home" /Url:"~/" /MenuName:"Main Menu"
widget create MenuWidget /Title:"Main Menu" /RenderTitle:false /Zone:"Navigation" /Position:"1" /Layer:"Default" /Identity:"MenuWidget1" /MenuName:"Main Menu"
theme activate "My Default Theme"

but after applied this Recipe, Widget is not showing any layers:

Dec 16, 2015 at 12:38 PM
Edited Dec 16, 2015 at 2:40 PM

Sorry it's my mistake

I have forgot to add
Zones: Header, Navigation, Featured, BeforeMain, AsideFirst, Messages, BeforeContent, Content, AfterContent, AsideSecond, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer
in Theme.txt

now it's fixed!

Thank you!
Marked as answer by Nitheesh on 12/16/2015 at 4:42 AM