Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:17:58+00:00 2026-06-01T03:17:58+00:00

I am currently working on a website that requires the ability to overwrite the

  • 0

I am currently working on a website that requires the ability to overwrite the document.cshtml file so that I can apply a specific CSS-class based on the user’s current location.

I have attempted to use URL alternatives such as:

  • Document.cshtml
  • Document-url-AreaA.cshtml
  • Document-url-AreaB.cshtml
  • Document.url-AreaC.cshtml

however it appears that all of them use the Document.cshtml as opposed to using one based on the URL. I could easily understand that this is the intended purpose, however I was wondering if it would be possible to implement the functionality above.


Update

I believe that I may have made some progress in this area, as opposed to using URL alternatives, and simply adding a field on the Model (for the document) to simply pull the current “Area” of the site and apply that class to the body.

(Within document.cshtml)

@using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@{
    RegisterLink(new LinkEntry {Type = "image/x-icon", ...});

    string title = Convert.ToString(Model.Title);
    string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);

     //Pull the Area here
    string area = Model.DesignatedAreaField;
}
<!DOCTYPE html> 
<html lang="en" class="static @Html.ClassForPage()"> 
<head> 
    <meta charset="utf-8" />
    <title>@Html.Title(title, siteName)</title> 
    @Display(Model.Head)
</head> 
<body class='@area'>
//Body goes here
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>

I believe that this may be an easier solution than the one previously suggested. However, I am wondering what the easiest method of actually placing a field that I could access from the Model of the Document, would be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:17:59+00:00Added an answer on June 1, 2026 at 3:17 am

    Document.cshtml is a wrapper for the Layout shape. Wrappers don’t support alternates. The only way to replace the document.cshtml template selectively is to remove the existing wrapper from the wrappers collection on the metadata of the layout shape and add your own.

    But wait… I can’t think of any good reason why you’d want to do that. What’s in document.cshtml is boilerplate HTML that should be the same across the site. The solution described in your update is the way to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a website that requires me to enable validation for different
I am currently working on a website that is an advertisement portal for businesses.
I am currently working on a website that will have a high volume of
I am working on a website that currently has a number of disparate search
So I'm currently working on rebuilding an existing website that is used internally at
I am currently working on adding pre-validation to my website. So that pages that
I'm currently working on a website that you'll find here: http://steadfastdesignfirm.com/rgw/ . I used
I'm currently working on a website that imports XML data that we download from
I'm currently working on a website admin panel, I added a form that adds
I am currently working on a form that displays information about a specific product

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.