Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a site with Orchard CMS

Tags:

I'm in the early stages of trying to learn Orchard, and I'm still seem to be struggling with the basics on how to build a page containing a multitude of various content that can be easily managed by non-technical users.

Ideally, what I'm trying to do is the following, I just can't figure out how to fit it into the Orchard architecture using Content Types, Parts, Fields, Widgets, Zones, etc. Also, since I'm still learning, I'm also trying to avoid any custom modules, or hard-coding content into the site (though I'm open to the idea, if that's the best way to get it done!).

Goal: Create a "home page" layout containing a Menu, Image slideshow, and several feature descriptions. For each image in the slideshow, I need a title, sub-title, description, and an image. To make this easy for non-technical users to manage, I would like to define the HTML template (custom Content Type, Part, or whatever), and allow authors to specify just those well-defined properties. I tried using Content Parts for this, but unfortunately, I can only have one Content Part of a particular type on a piece of Content. I also saw recommendations to create multiple Content Parts with the same set of properties, but I don't know how many images will be displayed (and I don't want to assign an arbitrary number).

I need to do something similar for feature descriptions, allowing authors to specify an image, title, description, and a page to link to. I'm running into the same problem as above, I'm not sure how to allow authors to specify a finite list of content, but have each content item be well-defined.

So far, the best option appears to be creating some sort of custom widget to "host" the content, but for some reason, my gut tells me that creating a custom layer for a single page just to specify which content to display is abusing the purpose of layers, which is begin able to customize a particular layout based on some criteria (whether or not the user is authenticated, for example).

I hope that made sense, and I apologize that it took so many words to explain my issue, I've just really reached my peak of frustration, and although I think that the Orchard guys definitely have it figured out in terms of architecture, I just can't get past these seemingly simple problems to build a simple website.

I greatly appreciate any tips, suggestions, advice this community has to offer!

TIA, -Jeremy

like image 570
jeremyalan Avatar asked Mar 11 '12 06:03

jeremyalan


People also ask

What is Orchard framework?

Orchard Core Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that application framework. All components in Orchard Core can be replaced or extended. Content is built from easily composable building blocks.

What is Orchard database?

Orchard Consumer Data blends the UK's leading marketing data files combining geodemographic, transactional and behavioural data to provide a rich source of consumer insight. It's the perfect solution for prospecting; with over 40 million individuals, you get access to a ready-made Prospect Pool.

Is Orchard a headless CMS?

Headless CMSOrchard Core belongs to the headless type systems. This means that it manages content in one place and offers the possibility of distributing it to various types of digital channels via API. Web, e-shop, mobile application, chat or blog.


1 Answers

What you defined in Orchard terms is a Content Type named Feature.

  • Go to Contents -> Content Type, and click Create.
  • Select those parts by default:
    • Title, because you want your authors to provide a nice title/name for the features
    • Autoroute, which will create a SEO friendly url based on the Title (can be customized)
    • Click Save
  • Add specific Fields
    • SubTitle, of type TextField. Configure it to Default, Required.
    • Description, of type TextField. Configure it to TextArea, Required.
    • Image, of type Media Picker. Configure it to Required.
  • You can add some Hints to each fields, which will be displayed in the Feature editor to describe what to enter in each field. Very useful for authors.

Now you can create Features by clicking on the link in the top left part of the Dashboard. Next step is to put those features on the homepage. What I suggest is to create a Projection which will be set as the homepage. A Projection is just a Page with an Url, which will display the result of a query as its content. The Query in your case will be "Give me all Features ordered by Creation Date".

  • In the dashboard, click on Queries
  • Click on "Create a new Query"
  • Enter "All Features"
  • Click on "Add a new Filter"
  • Select Content Type, then select Feature, Save
  • Click on "Add a sort Criterium"
  • Select "Creation Date", then Descending, Save

At this point, you can already preview the result of the query by clicking on Preview. But what we want is a front-end page.

Create a new Projection by clicking on Projection in the "New" section of the dashboard (top left again) - Give it a title, and don't forget to check "Set as Home page" to make it the home page - Select the only available query, named "All Featrues" - Save

On the home page you should see all the features, ordered by date. But what you want is a slider. At that point you need two more steps: - Integrate a slider jQuery plugin - Render the HTML compatible with your jQuery plugin

By default, when you render a Projection it will use the standard "Summary" layout. But using projections you can decide exactly what layout you want to apply, and exactly what html tags and classes.

  • Edit the query named "All Features"
  • Add a new Layout
  • Select Html List
  • Select "Properties" and Save
  • Click Add Properties
  • Select Display Text, Save
  • Do the same for
    • Feature:SubTitle
    • Feature:Description
    • Feature:Image
  • Save your query
  • Edit the home page projection and select this specific Layout instead of the default one.

You will see that each property is rendered in an html container.

By editing each property you can decide which class to apply, and which html tag to use. By changing them you can render exactly what you want, and customize your CSS/HTML to render the slider nicely. This is purely your HTML know have to apply here, or find some articles about that.

For your editors, they just have to go to the dashboard and add/update some feature content items, it will be reflected on the website.

Optionally there is a Slider module on the Orchard Gallery. You can try this one too. But if you want to handle exactly what happens the technique I described is better.

like image 88
Sébastien Ros - MSFT Avatar answered Oct 21 '22 23:10

Sébastien Ros - MSFT