Building my first Orchard Recipe

Topics: Administration, Installing Orchard
Nov 27, 2012 at 6:25 AM

Hi,

Since I've built 2 websites now with Orchard, I've been noticing quite some repetitive steps that I want to gather up into a recipe.  I followed instructions on http://docs.orchardproject.net/Documentation/Making-a-Web-Site-Recipe.  I have downloaded the Modules I required from Gallery, Built some custom content types and for the most important changes I added the Vandelay Meta Part to both Page and Blog Post.  Then I installed Import Export and Exported the recipe including Blog Post, Page, my custom content types including their metadata and data an flagging settings and rules.  This worked seemingly well.

Now over to creation of a new website based on this recipe.  I created a new website in WebMatrix 2 Refresh 2 from the App Gallery.  When that was done, I copied the new recipe in Modules\Orchard.Setup\Recipes and refreshed the setup page.  What I noticed immediately was that it was'nt my filename but the reference "generated with Import Export" that appeared in the Recipe List.  I did what I always do, namely enter credentials, use SQL Compact as database and selected the new recipe.  Next was the standard "Cooking Orchard Recipe" screen, that ended abruptly in

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18010

I looked inside the site and found a created log file, but it was 0kb.  This kinda left me wondering what I did wrong.  Do you guys have any suggestions?  Thanks in advance...

Regards,

Andy

Coordinator
Nov 27, 2012 at 7:51 AM

You looked in app_data\logs and it's empty?

Nov 27, 2012 at 8:26 PM

Thanks for your feedback and sorry for the late reply.

I looked into the folder and it contained an empty log file (0Kb).

Coordinator
Nov 27, 2012 at 11:21 PM

Seems like there is an error in your recipe but it's hard to say from that little information. Try to zap the site, start over, attach a debugger and break on exceptions. Re-running through setup this way should get you more info on what's going on.

Dec 1, 2012 at 4:15 PM

I have done things differently now.  Instead of using the Import/Export module, I simply copied the default recipe and started adding modules and features to it.  I have some problems with this as I seem to use wrong package id's.  Where can I find the packageId of a specific module?

Dec 1, 2012 at 4:15 PM

I have done things differently now.  Instead of using the Import/Export module, I simply copied the default recipe and started adding modules and features to it.  I have some problems with this as I seem to use wrong package id's.  Where can I find the packageId of a specific module?

Dec 1, 2012 at 4:27 PM

Never mind, found out that you have to prefix the Module Directory name with "Orchard.Module"...

Dec 1, 2012 at 9:22 PM

Ok, managed to get a recipe working with the modules and features I want.  I do encounter an issue with the Custom Forms module though.  I'm creating a ContactForm content type with a Name, Email and Message field and all of this is created just perfectly.  I also create a custom form with the ContactForm content type selected, and while this is persisted inside the recipe, it seems to get not correctly created.  The Custom Form is created, but it has the default Blog content type selected.  This is the metadata and data part of my recipe:

 

<Metadata>    <Types>      <Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">        <TagsPart />        <LocalizationPart />        <TitlePart/>        <AutoroutePart />      </Page>      <BlogPost ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">        <CommentsPart />        <TagsPart />        <LocalizationPart />        <TitlePart/>        <AutoroutePart />      </BlogPost>      <CustomForm ContentTypeSettings.Draftable="True" DisplayName="Custom Form">        <CommonPart />        <TitlePart />        <AutoroutePart AutorouteSettings.AllowCustomPattern="true" AutorouteSettings.AutomaticAdjustmentOnEdit="false" AutorouteSettings.PatternDefinitions="[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-form'}]" AutorouteSettings.DefaultPatternIndex="0" />        <MenuPart />        <CustomFormPart />      </CustomForm>      <ContactForm ContentTypeSettings.Creatable="False" ContentTypeSettings.Draftable="False" DisplayName="Contact Form">        <CommonPart DateEditorSettings.ShowDateEditor="False" OwnerEditorSettings.ShowOwnerEditor="True" />        <ContactForm />      </ContactForm>      </Types>    <Parts>      <BodyPart BodyPartSettings.FlavorDefault="html" />  <CommonPart ContentPartSettings.Attachable="True" />      <TitlePart ContentPartSettings.Attachable="True" />      <AutoroutePart ContentPartSettings.Attachable="True" />      <MenuPart ContentPartSettings.Attachable="True" />      <CustomFormPart />      <ContactForm ContentPartSettings.Attachable="True">        <Name.InputField DisplayName="Name" InputFieldSettings.Type="Text" InputFieldSettings.Required="True" InputFieldSettings.AutoFocus="True" InputFieldSettings.AutoComplete="False" InputFieldSettings.MaxLength="0" />        <Email.InputField DisplayName="Email" InputFieldSettings.Type="Email" InputFieldSettings.Required="True" InputFieldSettings.AutoFocus="False" InputFieldSettings.AutoComplete="False" InputFieldSettings.MaxLength="0" />        <Message.TextField DisplayName="Message" TextFieldSettings.Flavor="Textarea" TextFieldSettings.Required="True" />      </ContactForm>    </Parts>  </Metadata> 

<Data>    <CustomForm Id="/alias=contact" Status="Published">      <CommonPart Owner="/User.UserName=admin" CreatedUtc="2012-12-01T21:07:50Z" PublishedUtc="2012-12-01T21:07:50Z" ModifiedUtc="2012-12-01T21:07:50Z" />      <AutoroutePart Alias="contact" UseCustomPattern="false" />      <TitlePart Title="Contact" />      <CustomFormPart ContentType="ContactForm" SaveContentItem="false" CustomMessage="true" Message="Thanks for contacting us.  We will get in touch as soon as possible..." Redirect="true" RedirectUrl="/" />    </CustomForm>  </Data>

Dec 2, 2012 at 8:06 AM
Edited Dec 2, 2012 at 8:07 AM

I have found it myself, it seems to be a bug in the import/export module as it doesn't export the attachable property for the CustomFormPart.

Import/Export Module exports this:

 

<Parts>
...
<CustomFormPart />
...
</Parts>

While it does seem to work with this:

 

<Parts>
...
<CustomFormPart ContentPartSettings.Attachable="True" />
...
</Parts>
Coordinator
Dec 3, 2012 at 12:12 AM

Please file a bug.

Dec 3, 2012 at 10:01 AM

Ok, will do.

 

I also have a suggestion for the Import/Export Module: wouldit be possible to allow for Module/Feature selection so that the export also writes out the <Module> and <Feature> Tags based on the selection?  This would make recipe building a lot more productive...

Coordinator
Dec 3, 2012 at 8:11 PM

What do you mean? Can you explain with a specific example?

Dec 3, 2012 at 8:49 PM

Sure, I have made multiple recipes so I can offer "Packaged" websites with different modules.  The smallest offer includes basic modules for SEO like robots.txt, advanced sitemap, Vandelay Meta and a custom contact form. And the other recipes build on this. This means that for this recipe I need to include a couple of modules and the aforementioned features.  It would be nice if the Export module supported listing of installed modules and features, so that it would be exported in the recipe just as the content types that you need to select.  This way you don't need to encode the module and feature tags by hand in the exported recipe.

Coordinator
Dec 3, 2012 at 8:56 PM

Got it. File a bug.

Dec 3, 2012 at 8:57 PM

Ok thanks, will do so now...