Error executing template "Designs/Junget2026/Master/Partials/Meta.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_9c9beec0023f47638fbb35969a4fe53b.Execute() in D:\Web\Junget\Website\Files\Templates\Designs\Junget2026\Master\Partials\Meta.cshtml:line 5
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using Dynamicweb.Environment 2 @using Dynamicweb.Frontend 3 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4 @{ 5 string shareTitle = !string.IsNullOrEmpty(Model.PropertyItem.GetString("ShareTitle")) ? Model.PropertyItem.GetString("ShareTitle") : Model.Title; 6 string shareDescription = !string.IsNullOrEmpty(Model.PropertyItem.GetString("ShareDescription")) ? Model.PropertyItem.GetString("ShareDescription") : Model.Title; 7 string shareImage = !string.IsNullOrEmpty(Model.PropertyItem.GetString("ShareImage")) ? Model.PropertyItem.GetString("ShareImage") : Model?.Area.Item?.GetString("ShareImageFallback"); 8 string favicon = Model?.Area.Item?.GetString("FavIcon"); 9 string hreflangLinks = Dynamicweb.Context.Current.Items["hreflangLinks"] as string; 10 string customMetaDesc = Dynamicweb.Context.Current.Items["customMetaDescription"] as string; 11 string metaTagsOutput = Model.MetaTags; 12 13 IRequest request = Dynamicweb.Context.Current.Request; 14 string host = request.Url.Host; 15 string scheme = request.Url.Scheme; 16 string fullUrl = $"{scheme}://{host}{Pageview.SearchFriendlyUrl}"; 17 18 string fullUrlWithoutQuery = fullUrl; 19 int queryIndex = fullUrl.IndexOf("?", StringComparison.Ordinal); 20 if (queryIndex > -1) 21 { 22 fullUrlWithoutQuery = fullUrl.Substring(0, queryIndex); 23 } 24 25 bool isProductView = !string.IsNullOrEmpty(request.GetString("ProductId")); 26 27 Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification")); 28 Pageview.Meta.AddTag("og:site_name", Model.Area?.Name); 29 Pageview.Meta.AddTag("og:url", fullUrl); 30 Pageview.Meta.AddTag("og:type", "website"); 31 Pageview.Meta.AddTag("og:title", shareTitle); 32 Pageview.Meta.AddTag("og:description", shareDescription); 33 if (!string.IsNullOrEmpty(shareImage)) 34 { 35 Pageview.Meta.AddTag("og:image", shareImage); 36 } 37 38 //Pageview.Meta.AddTag("canonical", fullUrlWithoutQuery); 39 //check for PageNum query parameter, if greater than 1, add page number to title 40 string title = Model.Title; 41 if (Dynamicweb.Context.Current.Request.QueryString["PageNum"] != null && Dynamicweb.Context.Current.Request.QueryString["PageNum"] != "1") 42 { 43 title = title + " - " + Translate("side") + " " + Dynamicweb.Context.Current.Request.QueryString["PageNum"]; 44 } 45 46 Model.Title = title; 47 48 //if productpage canonical 49 if (isProductView) 50 { 51 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + fullUrlWithoutQuery + "\">"); 52 } 53 } 54 55 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 56 57 <!-- Google Fonts: Prompt --> 58 <link rel="preconnect" href="https://fonts.googleapis.com"> 59 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 60 61 @if (!String.IsNullOrEmpty(favicon)) 62 { 63 <link rel="shortcut icon" href="@favicon"> 64 } 65 66 @if (Dynamicweb.Context.Current.Request.Url.Host.Contains(".vjm.dk") || Dynamicweb.Context.Current.Request.Url.Host.Contains(".dynamicweb.dk") || Pageview.Area.Noindex || Pageview.Page.Noindex) 67 { 68 Pageview.Meta.AddTag("robots", "noindex,nofollow"); 69 } 70 71 @if (!string.IsNullOrEmpty(customMetaDesc)) 72 { 73 metaTagsOutput = System.Text.RegularExpressions.Regex.Replace( 74 metaTagsOutput, 75 @"<meta\s+name=""description""[^>]*?>", 76 "<meta name=\"description\" content=\"" + System.Web.HttpUtility.HtmlAttributeEncode(customMetaDesc) + "\" />" 77 ); 78 } 79 80 @metaTagsOutput 81 82 <title>@Model.Title</title> 83 84 @if (!string.IsNullOrEmpty(hreflangLinks)) 85 { 86 @hreflangLinks 87 }
Template file not found (in RenderRazorTemplate()): D:\Web\Junget\Website\Files\Templates\UserManagement\Login\PasswordRecovery.1.cshtml