Setting the html tag's class

Topics: Customizing Orchard
Mar 23, 2015 at 6:45 PM
I have a view ("Document.cshtml") in my theme as follows:
@using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@using Orchard.Utility.Extensions;

@{
    RegisterLink(new LinkEntry { Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/Themes/CustomTerra/Content/Images/favicon.ico") });    

    string title = Convert.ToString(Model.Title);
    string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
}
<!DOCTYPE html> 
<html lang="@WorkContext.CurrentCulture" class="static @Html.ClassForPage() @WorkContext.HttpContext.Request.Path.HtmlClassify()"> 
<head> 
    <meta name="viewport" content="width=device-width initial-scale=1, maximum-scale=1">    
    <meta charset="utf-8" />
    <title>@Html.Title(title, siteName)</title> 
    @Display(Model.Head)
    
</head> 
<body>
@* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>
I would like to be able to attach a content part to a page that will allow me to specify a css class, similar to the vandelay industires classy module, but I would like it to add the class to the html tag instead of the shape that is being rendered for the page content item. How would I check within the Document.cshtml file whether that css class part has been added and contains a value and then use that value as the class for the html tag? Can I pass a ViewModel to it somehow? I haven't done much with themes prior to this and know it would be easy to pass a ViewModel for the part into it's own view, but don't know how I would accomplish this within a parent view. Thank you.