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_922727b1817b4bb385aa1d4597fe0040.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 10 IRequest request = Dynamicweb.Context.Current.Request; 11 string host = request.Url.Host; 12 string scheme = request.Url.Scheme; 13 string fullUrl = $"{scheme}://{host}{Pageview.SearchFriendlyUrl}"; 14 15 string fullUrlWithoutQuery = fullUrl; 16 int queryIndex = fullUrl.IndexOf("?", StringComparison.Ordinal); 17 if (queryIndex > -1) 18 { 19 fullUrlWithoutQuery = fullUrl.Substring(0, queryIndex); 20 } 21 bool isProductView = !string.IsNullOrEmpty(request.GetString("ProductId")); 22 23 Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification")); 24 Pageview.Meta.AddTag("og:site_name", Model.Area?.Name); 25 Pageview.Meta.AddTag("og:url", fullUrl); 26 Pageview.Meta.AddTag("og:type", "website"); 27 Pageview.Meta.AddTag("og:title", shareTitle); 28 Pageview.Meta.AddTag("og:description", shareDescription); 29 if (!string.IsNullOrEmpty(shareImage)) 30 { 31 Pageview.Meta.AddTag("og:image", shareImage); 32 } 33 34 35 //Pageview.Meta.AddTag("canonical", fullUrlWithoutQuery); 36 //check for PageNum query parameter, if greater than 1, add page number to title 37 string title = Model.Title; 38 if (Dynamicweb.Context.Current.Request.QueryString["PageNum"] != null && Dynamicweb.Context.Current.Request.QueryString["PageNum"] != "1") 39 { 40 title = title + " - " + Translate("side") + " " + Dynamicweb.Context.Current.Request.QueryString["PageNum"]; 41 } 42 Model.Title = title; 43 44 //if productpage canonical 45 if (isProductView) 46 { 47 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + fullUrlWithoutQuery + "\">"); 48 } 49 } 50 51 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 52 53 <!-- Google Fonts: Prompt --> 54 <link rel="preconnect" href="https://fonts.googleapis.com"> 55 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 56 57 @if (!String.IsNullOrEmpty(favicon)) 58 { 59 <link rel="shortcut icon" href="@favicon"> 60 } 61 62 @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) 63 { 64 Pageview.Meta.AddTag("robots", "noindex,nofollow"); 65 } 66 67 @Model.MetaTags 68 69 <title>@Model.Title</title>

Blog med tips og tricks

Denne kategori indeholder blogindlæg, der omhandler tips og tricks til værktøj og maskiner.

Tilmeld dig vores nyhedsbrev
Gå ikke glip af kommende kurser og events, spændende nyheder og knivskarpe tilbud.