In the pages inside the folder "lp" i'm using the Sidebar template.
If i do
@{ Layout="Layout.cshtml"; }
There is no error, the page renders with no styles. If I simply preview the page from the back office, it's fine
If I do
@{ Layout="~/Layout.cshtml"; }
I get a not found message:
Server Error in '/' Application.
The layout page "~/Layout.cshtml" could not be found at the following path: "~/Layout.cshtml".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The layout page "~/Layout.cshtml" could not be found at the following path: "~/Layout.cshtml".
Ok, so the approach of using "Layout.cshtml" is probably right. So change it to that.
Now let me see the code of your Layout.cshtml template - I suspect the missing styles are due to the styles being referenced in a relative manner instead of an absolute path.
Referencing master pages from second level
Hello,
I would like to know how I can reference a master page from a template when it is not at the top level.
For example, the following urls use the same template.
www.myurl.com/mypage
www.myurl.com/foldername/myotherpage
The second one, "myotherpage" cannot find the master page while "mypage" can.
I tried to add a "~", but that didn't work
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "~/Layout.cshtml";
}
Hi Christine
I imagine that your templates are structured like this in the Umbraco backoffice
Layout.cshtml - Template1.cshtml - Template2.cshtml - Etc.
Then it should be enough to write the reference like
Simply remove the ~ character - does that help?
/Jan
Yes the templates are arranged like this but neither
or
will pick up the master page when a page that is not at the top level
Hi Christine
Do you mind sending a screenshot of your master template and your textpage templates, or what you have named them? :)
I need to be certain of your context before I can advise further.
Cheers, Jan
Sure! I have taken a screen shot of my Content Pages & Masterpage/Templates
Ok, and which of the above templates is causing the issue?
And what does the error message say?
/Jan
In the pages inside the folder "lp" i'm using the Sidebar template.
If i do
There is no error, the page renders with no styles. If I simply preview the page from the back office, it's fine
If I do
I get a not found message:
Server Error in '/' Application.
The layout page "~/Layout.cshtml" could not be found at the following path: "~/Layout.cshtml".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The layout page "~/Layout.cshtml" could not be found at the following path: "~/Layout.cshtml".
Hi Christine
Ok, so the approach of using "Layout.cshtml" is probably right. So change it to that.
Now let me see the code of your Layout.cshtml template - I suspect the missing styles are due to the styles being referenced in a relative manner instead of an absolute path.
/Jan
ohhhh ok, you are very right - i need to put that tilda on the style sheet. I did this and it works now - thanks very much!
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="index,follow" />
<meta name="description" content="@Umbraco.Field("metaDescription")" />
<meta name="keywords" content="@Umbraco.Field("metaKeywords")" />
<title>@Umbraco.Field("pageTitle")</title>
<link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico"/>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href="~/css/Main.css" rel="stylesheet">
</head>
Hi Christine
Happy to hear you managed to get it solved :-)
Happy umbracoing.
/Jan
is working on a reply...