How to display html in a "good-practice" way

Topics: General, Writing themes
Apr 15, 2011 at 2:15 AM

First of all, im very new at Orchard. Actually, this is the first i'm trying. Its a pretty straightforward proyect consisting of moving a html site to an orchard cms. My approach would be to create a theme and define some zones (which i've done). Next, i'd like to have an address like <site>/bio and display the bio page here. What im asking is how to tell orchard that when user points <site>/bio the system loads the bio page, which is simply html. I was doing this using a new content page, but this is not the best approach i guess. I should have something like a Bio widget with its corresponding view and telling it to be load at /bio.  

Coordinator
Apr 15, 2011 at 4:00 AM

Actually a page does look like the right approach. Why do you think you should use a widget?

Apr 15, 2011 at 4:15 AM

Because the site is coded in ASP, and different pages load different scripts and css, so i just guessed it was cleaner to keep a separate html view. I'd rather use the CMS Content approach for text or simple content editing, and keep the code in a separate view. Ist this possible? I was thinking about creating some kind of controller for the route and rendering the view there. Is that somehow possible/good practice here? i will keep reading tough.

Developer
Apr 21, 2011 at 2:34 PM

Hi,

Try to use the Url Alternates module, and create alternate Layout.cshtml views for the pages you want to have customized. So you'll get eg. something like Layout-url-bio.cshtml, which will hold the layout of your /bio page. You could also do more fine-grained customization and add the Url Alternate for specific Zones (instead of the whole layout), so eg. Zone-Content-url-bio.cshtml file would render your Content zone (ie. the place where all page content gets rendered) for /bio page.

Then, you are free to add necessary scripts and styles for this particular site inside, separately from the others.

HTH

Cheers, Piotr