您应该使用
RenderSection
如果要将模板中的内容注入master:
以下是一个示例:
主人cshtml:
<!DOCTYPE html>
<html>
<head>
...
@RenderSection("meta", required: false)
...
</head>
<body>
...
@RenderBody()
...
</body>
</html>
样板cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@section meta
{
<meta property="og:type" content="website">
<meta property="og:site_name" content="SITENAME">
<meta property="og:title" content="Reports"/>
<meta property="og:url" content="www.exameple.com"/>
<meta property="og:image" content="http://via.placeholder.com/2000x2000"/>
}