Preface
A few months back, I wanted to create an online presence for my band, Daisys Gone. In the past, I would have started from scratch. But I remembered all the domains Ive accumulated over the years that are now nothing more than parking pages at my registrar. Its generally not hard to throw together a few simple brochure-ware pages. I certainly could have done just that for my bands site. However, even simple sites often have content and behavior that needs to be dynamic.
The obvious solution is to use a content management system (CMS). CMS platforms such as WordPress and Drupal offer users prebuilt functionality for everything from creating pages to managing site registration. A full-blown CMS will allow non-technical users to create and manage content and will allow programmers and designers to extend the out-of-the-box functionality by creating themes and modules, respectively.
With Daisys Gone, I was once again presented with the dilemma of whether to build a site from scratch or to use a CMS. Fortunately, I remembered how I had seen a then just-released Orchard CMS used at the NYC Give Camp a few months earlier. Give Camps match developers and designers with charities who have some unmet technical need, often a web presence. One of the developer groups built its charity a new website using Orchard.
I remember being quite impressed by how much this team accomplished in one weekend using this new CMS. So when it came time to start building the website for my band, I made the choice to use Orchard.
The original Daisys Gone website was not much more than a home page. It was primarily a sandbox for me to learn Orchard. As I write this book, Im going to create a new online presence for the band. Ill walk through the steps of creating a custom look and feel (themes) and extending Orchard with new functionality (modules).
Whether you are building a new corporate site for your company or a site for the local youth soccer league, you are likely to have many of the same needs of your CMS. Building a site for a band is no different. You may need to schedule events, manage user comments, support OAuth, or have a site map. The content will vary by your domain, the features much less so.
About the Orchard Project
Microsoft released Orchard in January 2011, along with ASP.NET MVC 3, IIS Express, SQL CE 4, Web Farm Framework, and WebMatrix. What all of these technologies have in common is that they, in some way, aim to make web development on Windows more accessible. PHP owes its wide adoption to its perceived ease of use. With this new tool chain, Microsoft is courting the community who wants a simplified development experience.
The Orchard Project belongs to the Microsoft supported Outercurve Foundation (formerly known as the CodePlex Foundation). The Outercurve Foundation is a nonprofit organization whose mission is to foster support for open source projects, such as Orchard and the popular ASP.NET toolkit, MVC Contrib. Microsoft does not officially support Orchard, but its employees are currently among those leading the development efforts for the project.
There are three stated goals of the Orchard Project. The first is to provide a set of shared components to be used in ASP.NET applications. The second is to create a set of reference applications built using these components. The third is to build a community to support these components and applications. At the time of this writing, Orchard is primarily a platform for creating content-driven websites. Though in Orchard, content is certainly not limited to blog posts or simple text-heavy pages.
Orchard is developed with a full open source stack. It uses ASP.NET MVC 3.0 with the Razor view engine. There are also numerous dependencies on other open source projects, most notably NHibernate for data access and Autofac for dependency injection. Orchard is licensed under the BSD license.
Not much more than a year after its 1.0 release, Orchard has been downloaded nearly 1,000,000 times. More than 300 modules and themes have been created and submitted to the Orchard Gallery. A series of minor releases have taken Orchard to its current 1.4 version. The Orchard community is strong and growing.
Why Another .NET CMS?
There have been several commercial and open source .NET CMS products over the years. DotNetNuke (DNN) is arguably the most notable and most popular. However, it was written in VB.NET and remained that way until earlier this year when it was ported to C#. VB.NET was a deal-breaker for me, as it was for many developers.
Even though DNN is a C# project nowas is another popular open source .NET CMS, Umbracoboth are WebForms projects. Like VB.NET, WebForms is also a deal-breaker for me. While the underlying web framework or programming language used by a CMS is of little consequence to an end user, to a programmer it will likely be important. As an MVC developer , Ive wanted a CMS that is built on ASP.NET MVC and uses metaphors that are familiar to MVC development. I believe the .NET developer community will gravitate towards Orchard, because its development stack is more in line with modern ASP.NET development practices.
That said, it is entirely possible to build content and functionality-rich sites using Orchard without having to write a single line of code. Even though Orchard is a relatively new product, it has a remarkably rich set of extensions. Like other modern CMS products, Orchard marries great programmatic extensibility with rich, out-of-the-box functionality.
Audience
This book is being written for web developers who want to create content-heavy websites without starting from a blank slate. I assume readers have some familiarity with basic CMS concepts and some level of web development skill. Experience with Orchard is neither assumed nor required. Programming custom modules for Orchard does require knowledge of C# and to a lesser extent ASP.NET MVC. If you are unfamiliar with MVC, I suggest reading 20 Recipes for Programming MVC 3 or Programming ASP.NET MVC 4 (OReilly) or Programming Microsoft ASP.NET MVC (Microsoft Press).
Many Orchard users will be able to accomplish their goals without having to write any custom code. This book will fully cover how to get a site up and running with Orchard and will walk readers through customization with existing themes and sites from the Orchard Gallery. However, even users who will not be building custom modules might benefit from the chapters describing module and theme architecture. Knowing how Orchard works will help users debug problems that might arise in production.
Contents of This Book
This book introduces Orchard development by walking a reader through the process of creating a customized Orchard site.
covers getting an Orchard site set up for development and provides a quick tour of the Orchard experience.
details the process of creating content from existing types of content and covers how to create new types of content.
describes how to change the way Orchard displays content by default.
explores the process of customizing an Orchard sites look and feel by building a theme.
provides a walkthrough of creating and configuring a custom module.
provides a walkthrough of creating and configuring a custom widget.
explores options for adding multi-language support to an Orchard site.