Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: HTML and BODY tags on XhtmlDocument placeholders

$
0
0
I'm trying to migrate old Razor functiond in the new Composite C1 4.0 Razor templates. I migrated an old 3.2 web site, and I tried with success to create a new Razor layout, and to create some Razor templates that use this layout. Every template has just one placeholder, like this one
@inherits RazorPageTemplate
              
@functions {
    public override void Configure()
    {
        TemplateId = new Guid("d33435be-3b0d-45ed-9698-0a464b5648eb");
        TemplateTitle = "SebaProva";
        Layout = "RazorSyncroSystemLayout.cshtml";
    }

    [Placeholder(Id="content", Title="Content", IsDefault=true)]
    public XhtmlDocument Content { get; set; }
}
<!DOCTYPE html>
<html lang="@Lang" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0" xmlns:lang="http://www.composite.net/ns/localization/1.0" xmlns:asp="http://www.composite.net/ns/asp.net/controls">
    <head>
        <title>@CurrentPageNode.Title</title>
        @if (!string.IsNullOrEmpty(CurrentPageNode.Description)) {
            <meta name="description" content="@CurrentPageNode.Description" />
        }
        <f:function name="Composite.Web.Html.Template.CommonMetaTags" />
        <link rel="stylesheet" type="text/css" href="~/Frontend/Styles/VisualEditor.common.css" />
    </head>
    <body>
        <h1>@CurrentPageNode.Title</h1>
        <h2>@CurrentPageNode.Description</h2>
        <div>
            @Markup(Content)
        </div>
        <h2>Bottom Placeholder</h2>
    </body>
</html>
The problem is that where @Markup(Content) is, it is rendered the entire HTML content of the placeholder, with HTML and BODY tags as well, something like that:
<div>
            <html xmlns="http://www.w3.org/1999/xhtml">
                <head></head>
                <body>
                    <p>text inside</p>
                </body>
            </html>
        </div>
Am I doing something wrong???

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>