Error executing template "Designs/Swift/_parsed/Legacy_BloggPost.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_a7880993e2374e06b99154d214343104.SetMetaTags() in D:\dynamicweb.net\Solutions\Capo\sundqvist-new.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\_parsed\Legacy_BloggPost.parsed.cshtml:line 602
at CompiledRazorTemplates.Dynamic.RazorEngine_a7880993e2374e06b99154d214343104.Execute() in D:\dynamicweb.net\Solutions\Capo\sundqvist-new.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\_parsed\Legacy_BloggPost.parsed.cshtml:line 99
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     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
  2     @using System
  3     @using Dynamicweb
  4     @using Dynamicweb.Environment
  5     @using Dynamicweb.Frontend
  6  7     @{
  8     	string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
  9     	bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
 10     	bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
 11     	string responsiveClassDesktop = string.Empty;
 12     	string responsiveClassMobile = string.Empty;
 13     	if (renderAsResponsive)
 14     	{
 15     		responsiveClassDesktop = " d-none d-xl-block";
 16     		responsiveClassMobile = " d-block d-xl-none";
 17     	}
 18 19     	var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
 20 21     	var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
 22     	var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
 23     	string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
 24 25     	var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
 26     	var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
 27 28     	var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
 29     	var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
 30 31     	// Schema.org details for PDP
 32     	string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
 33     	bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
 34     	bool isArticlePage = Model.ItemType == "Swift_Article";
 35     	string schemaOrgType = string.Empty;
 36 37     	if (isProductDetailsPage)
 38     	{
 39     		schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
 40     	}
 41 42     	if (isArticlePage)
 43     	{
 44     		schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
 45     	}
 46 47     	if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
 48     	{
 49     		//Branding page has been saved or the file is missing. Rewrite the file to disc.
 50     		if (brandingPageId > 0)
 51     		{
 52     			var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
 53     			brandingPageview.Redirect = false;
 54     			brandingPageview.Output();
 55     		}
 56     	}
 57 58     	if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
 59     	{
 60     		//Branding page has been saved or the file is missing. Rewrite the file to disc.
 61     		if (themePageId > 0)
 62     		{
 63     			var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
 64     			themePageview.Redirect = false;
 65     			themePageview.Output();
 66     		}
 67     	}
 68 69     	var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
 70     	var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
 71 72     	string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
 73 74     	string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
 75 76     	string headerCssClass = "sticky-top";
 77     	bool movePageBehind = false;
 78 79     	if (Pageview.Page.PropertyItem != null)
 80     	{
 81     		headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
 82     		movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
 83     	}
 84 85     	headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
 86     	headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
 87 88     	string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
 89     	string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
 90     	var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
 91     	bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
 92 93     	Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
 94     	Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css?{cssLastModified.Ticks}; rel=preload; as=style;");
 95     	Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
 96     	Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
 97     	//Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
 98 99     	SetMetaTags();
100101     	List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
102103     	if (Pageview.Area.IsMaster)
104     	{
105     		languages.Add(Pageview.Page);
106     		if (Pageview.Page.Languages != null)
107     		{
108     			foreach (var language in Pageview.Page.Languages)
109     			{
110     				languages.Add(language);
111     			}
112     		}
113     	}
114     	else
115     	{
116     		languages.Add(Pageview.Page.MasterPage);
117     		if (Pageview.Page.MasterPage != null)
118     		{
119     			if (Pageview.Page.MasterPage.Languages != null)
120     			{
121     				foreach (var language in Pageview.Page.MasterPage.Languages)
122     				{
123     					languages.Add(language);
124     				}
125     			}
126     		}
127     	}
128129     	string siteLanguage = Pageview.Area.CultureInfo.Name;
130     	Uri url = Dynamicweb.Context.Current.Request.Url;
131     	string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
132133     	var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
134     	var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
135     }
136     <!doctype html>
137     <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
138     <head>
139     	<!-- @swiftVersion -->
140     	@* Required meta tags *@
141     	<meta charset="utf-8">
142     	<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
143     	<link rel="shortcut icon" href="@favicon">
144     	<link rel="apple-touch-icon" href="@favicon">
145146     	@Model.MetaTags
147148     	@{
149     		@* Languages meta data *@
150     		foreach (var language in languages)
151     		{
152     			if (language?.Area != null)
153     			{
154     				if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
155     				{
156     					if (!string.IsNullOrEmpty(language.Area.DomainLock))
157     					{
158     						hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
159     					}
160     					string querystring = $"Default.aspx?ID={language.ID}";
161     					if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
162     					{
163     						querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
164     					}
165     					if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
166     					{
167     						querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
168     					}
169     					if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
170     					{
171     						querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
172     					}
173174     					string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
175     					string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
176177     					<link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
178     				}
179     			}
180     		}
181     	}
182183     	<title>@Model.Title</title>
184     	@* Bootstrap + Swift stylesheet *@
185     	<link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
186187     	@if (disableWideBreakpoints != "disableBoth")
188     	{
189     		<style>
190     			@@media ( min-width: 1600px ) {
191     				.container-xxl,
192     				.container-xl,
193     				.container-lg,
194     				.container-md,
195     				.container-sm,
196     				.container {
197     					max-width: 1520px;
198     				}
199     			}
200     		</style>
201202203204     		if (disableWideBreakpoints != "disableUltraWideOnly")
205     		{
206     			<style>
207     				@@media ( min-width: 1920px ) {
208     					.container-xxl,
209     					.container-xl,
210     					.container-lg,
211     					.container-md,
212     					.container-sm,
213     					.container {
214     						max-width: 1820px;
215     					}
216     				}
217     			</style>
218     		}
219     	}
220221     	@* Branding and Themes min stylesheet *@
222     	<link href="/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_@(Model.Area.ID).min.css?@cssLastModified.Ticks" rel="stylesheet" media="all" type="text/css" data-last-modified-content="@cssLastModified">
223     	<script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
224     	<script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
225226     	<script type="module">
227     		AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
228     		swift.Scroll.hideHeadersOnScroll();
229     		swift.Scroll.handleAlternativeTheme();
230     	</script>
231232     	@* Google tag manager *@
233     	@if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
234     	{
235     		<script>
236     			(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
237     			new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
238     			j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
239     			'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
240     			})(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
241242     			function gtag() { dataLayer.push(arguments); }
243     		</script>
244     	}
245246     	@if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
247     	{
248     		var GoogleAnalyticsDebugMode = "";
249     		bool isLoggedInBackendUser = false;
250251     		if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
252     		{
253     			isLoggedInBackendUser = true;
254     		}
255256     		if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
257     		{
258     			GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
259     		}
260261     		<script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
262     		<script>
263     			window.dataLayer = window.dataLayer || [];
264     			function gtag() { dataLayer.push(arguments); }
265     			gtag('js', new Date());
266     			gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
267     		</script>
268     	}
269270     	@if (!string.IsNullOrWhiteSpace(customHeaderInclude))
271     	{
272     		@RenderPartial($"Components/Custom/{customHeaderInclude}")
273     	}
274     </head>
275     <body class="brand @(masterTheme)" id="page@(Model.ID)">
276277     	@* Google tag manager *@
278     	@if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
279     	{
280     		<noscript>
281     			<iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
282     					height="0" width="0" style="display:none;visibility:hidden"></iframe>
283     		</noscript>
284     	}
285286     	@if (renderAsResponsive || !renderMobile)
287     	{
288     		<header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop" data-store-jsn-feed-page-id="@GetPageIdByNavigationTag("StoreJsonFeed")">
289     			@if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
290     			{
291     				@RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
292     			}
293     		</header>
294     	}
295296     	@if ((renderAsResponsive || renderMobile))
297     	{
298     		<header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop" data-store-jsn-feed-page-id="@GetPageIdByNavigationTag("StoreJsonFeed")">
299     			@if (@Model.Area.Item.GetLink("HeaderMobile") != null)
300     			{
301     				@RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
302     			}
303     		</header>
304     	}
305306     	<main id="content" @(schemaOrgType)>
307     		<div data-intersect></div>
308     		@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
309     @using System
310     @using System.Web
311     @using Dynamicweb.Ecommerce.ProductCatalog
312313314     @{
315     	var showImage = Model.Item.GetFile("ImageMain") != null && Model.Item.GetBoolean("HideMainImage") == false;
316     }
317318     <div class="container-xl">
319     	<div class="blog-post-page p-md-5 p-5  @(showImage ? "image" : "noImage")">
320     		@if (!string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Header")))
321     		{
322     			<div class="content-header">
323     				<h1 class="display-3 mb-2 mt-2">@Model.Item.GetRawValueString("Header")</h1>
324     			</div>
325     		}
326     		@if (!string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Author")))
327     		{
328     			<div class="mb-2">
329     				<span class=" fs-6">@Translate("Blog-written-by", "Publicerad av"): @Model.Item.GetRawValueString("Author"), @Model.Item.GetDateTime("Date").ToShortDateString()</span>
330     			</div>
331     		}
332333     		<div class="mb-2" style="display: flex; justify-content: space-between;">
334     			<div class="d-flex gap-2">
335     				<span class="fs-6">@Translate("Blog-tags", "Taggar"): </span>
336     				@if (!string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Categories")))
337     				{
338     					var categories = Model.Item.GetRawValueString("Categories");
339     					string[] categoriesList = categories.Split(',');
340341     					foreach (var word in categoriesList)
342     					{
343     						<div>
344     							<a
345     								class="fs-6 category-btn"
346     								style="margin-right: 5px;"
347     								href="/blogg?BlogCategory=@word"
348     							>
349     								@Translate(word)
350     							</a>
351     						</div>
352     					}
353     				}
354     			</div>
355     		</div>
356357     		@* @if (!Model.Item.GetBoolean("HideMainImage") && mainImage.Length > 0) *@
358     		@if (showImage)
359     		{
360     			<div class="blog-post-page__image">
361     				<figure class="mb-0">
362     					@RenderPartial("Components/Image.cshtml", Model.Item.GetFile("ImageMain"))
363     				</figure>
364     			</div>
365     		}
366     	</div>
367     </div>
368369     <section class="blog-post-tips container-xl container-xl pb-5 pb-lg-6">
370     	<div class=" theme sundqvist-primary p-md-5 p-5">
371     		@Model.Placeholder("dwcontent1", "blogspost", "default:true;sort:1")
372     	</div>
373     </section>
374375     <section id="mentioned-products"
376     		 class="blog-post-mentioned-products container-xl py-5 py-lg-6">
377     	@Model.Placeholder("dwcontent2", "mentioned-products", "default:true;sort:2")
378     </section>
379380     <section id="related-reads"
381     		 class="container-xl blog-post-related-read py-5 py-lg-6">
382     	@Model.Placeholder("dwcontent3", "related-reads", "default:true;sort:3")
383     </section>
384385386     		@* Find stores modal *@
387     		@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
388     @using Dynamicweb
389     @using Dynamicweb.Environment
390     @using System;
391392     @helper RenderFindStoresModal()
393     {
394     	<div id="findStore"  class="find-store-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
395     		<div class="find-store-modal-dialog">
396     			<div class="find-store-modal-content">
397     				<div class="find-store-modal-header">
398     					<h4 class="modal-title">@Translate("FindStores", "Hitta köpställe")</h4>
399     					<button type="button" class="btn btn-primary close flex center" data-dismiss="modal">×</button>
400     				</div>
401     				<div class="text-center loading">
402     					<div class="spinner-border" role="status">
403     						<span class="sr-only"></span>
404     					</div>
405     				</div>
406     				<div class="modal-body" id="modal-body">
407     					@* Load jquery as required by findstores.js  *@
408     					<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
409     				</div>
410     			</div>
411     		</div>
412     	</div>
413414     	<script>
415     		// Get the modal element
416     		var modal = document.getElementById("findStore");
417     		// Get the <span> element that closes the modal
418     		var span = document.getElementsByClassName("close")[0];
419     		// When the user clicks on the <span> (x), close the modal
420     		span.onclick = function () {
421     			modal.style.display = "none";
422     			document.body.style.overflow = "auto";
423     		};
424     		// When the user clicks anywhere outside of the modal, close it
425     		window.onclick = function (event) {
426     			if (event.target == modal) {
427     				modal.style.display = "none";
428     				document.body.style.overflow = "auto";
429     			}
430     		};
431     		// Get spinner
432     		var spinner = document.getElementsByClassName('loading');
433     		// Load the content using AJAX when the user clicks on a link
434     		var links = document.querySelectorAll("#findStoresButton");
435436     		for (var i = 0; i < links.length; i++) {
437     			links[i].onclick = function (event) {
438     				event.preventDefault();
439     				modal.style.display = "flex";
440     				document.body.style.overflow = "hidden";
441     				var url = "/Default.aspx?ID=" + "@GetPageIdByNavigationTag("findstores")";
442     				var xhr = new XMLHttpRequest();
443444     				//The specific Brand is handled in the find-stores js adding [?Brands=BLALA] to the Url.
445     				xhr.onreadystatechange = function () {
446     					if (xhr.readyState == 4 && xhr.status == 200) {
447     						document.activeElement.blur();
448     						var modalBody = document.getElementById("modal-body");
449     						//get just the main content from the main find store page
450     						const mainContent = xhr.responseText.match(/<main[^>]*>([\s\S]*?)<\/main>/i)[0];
451     						// remove the header text
452     						const divWithClassName = document.createElement("div");
453     						divWithClassName.innerHTML = mainContent;
454     						const myDiv = divWithClassName.querySelector(".item_swift_2columns");
455     						const content = myDiv.innerHTML;
456     						//populate the modal
457     						modalBody.innerHTML = content;
458     						//Dynamically add the scripts to the modal so the elements are bound correctly
459     						var script2 = document.createElement("script");
460     						script2.src = "/Files/Templates/Designs/Swift_Custom/Assets/js/find-stores.min.js";
461     						script2.crossOrigin = "anonymous";
462     						script2.defer = true;
463     						document.getElementById("modal-body").appendChild(script2);
464     						var script3 = document.createElement("script");
465     						script3.src = "https://unpkg.com/axios/dist/axios.min.js";
466     						document.getElementById("modal-body").appendChild(script3);
467     						// Hide the loading icon when content has finished loading
468     						spinner[0].remove();
469     					};
470     				};
471     				xhr.open("GET", url, true);
472     				xhr.send();
473     			};
474     		}
475     	</script>
476     }
477478     		@if (Pageview.Page.NavigationTag == "Shop")
479     		{
480     			@RenderFindStoresModal();
481     		}
482     		@RenderScrollTopButton()
483     	</main>
484485     	@if (renderAsResponsive || !renderMobile)
486     	{
487     		<footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
488     			@if (@Model.Area.Item.GetLink("FooterDesktop") != null)
489     			{
490     				@RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
491     			}
492     		</footer>
493     	}
494495     	@if (renderAsResponsive || renderMobile)
496     	{
497     		<footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
498     			@if (@Model.Area.Item.GetLink("FooterMobile") != null)
499     			{
500     				@RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
501     			}
502     		</footer>
503     	}
504505     	@* Render any offcanvas menu here or *@
506     	@RenderSnippet("offcanvas")
507508     	@{
509     		//bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
510     		bool isErpConnectionDown = !Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable();
511     	}
512513     	@* Language selector modal *@
514     	@if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
515     	{
516     		<div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
517     			<div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
518     				@* The content here comes from an external request *@
519     			</div>
520     		</div>
521     	}
522523     	@* Favorite toast *@
524     	<div aria-live="polite" aria-atomic="true">
525     		<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
526     			<div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
527     				<div class="toast-header">
528     					<strong class="me-auto">@Translate("Favorite list updated")</strong>
529     					<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
530     				</div>
531     				<div class="toast-body d-flex gap-3">
532     					<div id="favoriteNotificationToast_Image"></div>
533     					<div id="favoriteNotificationToast_Text"></div>
534     				</div>
535     			</div>
536     		</div>
537     	</div>
538539     	@* Modal for dynamic content *@
540     	<div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
541     		<div class="modal-dialog modal-dialog-centered modal-md">
542     			<div class="modal-content theme light" id="DynamicModalContent">
543     				@* The content here comes from an external request *@
544     			</div>
545     		</div>
546     	</div>
547548     	@* Offcanvas for dynamic content *@
549     	<div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
550     		@* The content here comes from an external request *@
551     	</div>
552553     	@if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
554     	{
555     		string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
556557     		<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
558     			<div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
559     				<div class="toast-header">
560     					<strong class="me-auto">@Translate("Connection down")</strong>
561     					<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
562     				</div>
563     				<div class="toast-body">
564     					@Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
565     				</div>
566     			</div>
567     		</div>
568     	}
569     	<script async src="https://script.extellio.com/sundqvist-se.min.js"></script>
570     </body>
571     </html>
572     @functions {
573     	void SetMetaTags()
574     	{
575     		//Verification Tokens
576     		string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
577     		//string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
578     		//string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
579     		//string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
580     		//string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
581     		//string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
582583     		//Generic Site Values
584     		string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
585     		string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
586     		string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
587588     		string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
589590     		//Page specific values
591     		string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
592     		FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
593     		string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
594     		string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
595596     		string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
597     		string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
598     		string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
599     		FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
600     		string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
601602     		string blogPostMainImage = Pageview.Page.Item["ImageMain"]?.ToString();
603604     		if (!string.IsNullOrEmpty(siteVerificationGoogle))
605     		{
606     			Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
607     		}
608609     		if (!string.IsNullOrEmpty(openGraphFacebookAppID))
610     		{
611     			Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
612     		}
613614     		if (!string.IsNullOrEmpty(openGraphType))
615     		{
616     			Pageview.Meta.AddTag("og:type", openGraphType);
617     		}
618619     		if (!string.IsNullOrEmpty(openGraphSiteName))
620     		{
621     			Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
622     		}
623624     		if (!string.IsNullOrEmpty(Model.Title))
625     		{
626     			Pageview.Meta.AddTag("og:title", Model.Title);
627     		}
628     		else
629     		{
630     			Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
631     		}
632633     		if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
634     		{
635     			Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
636     		}
637638     		if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
639     		{
640     			if (!string.IsNullOrEmpty(Model.Description))
641     			{
642     				Pageview.Meta.AddTag("og:description", Model.Description);
643     			}
644     			else
645     			{
646     				Pageview.Meta.AddTag("og:description", openGraphDescription);
647     			}
648     			if (openGraphImage != null)
649     			{
650     				Pageview.Meta.AddTag("og:image", openGraphImage.Path);
651     			}
652653     			if (Pageview.Page.ItemType == "Blogpost" && !string.IsNullOrEmpty(blogPostMainImage))
654     			{
655     				Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + blogPostMainImage);
656     			}
657658     			if (!string.IsNullOrEmpty(openGraphImageALT))
659     			{
660     				Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
661     			}
662     			if (!string.IsNullOrEmpty(twitterCardDescription))
663     			{
664     				Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
665     			}
666667     			if (twitterCardImage != null)
668     			{
669     				Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
670     			}
671672     			if (!string.IsNullOrEmpty(twitterCardImageALT))
673     			{
674     				Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
675     			}
676     		}
677678     		if (!string.IsNullOrEmpty(twitterCardSite))
679     		{
680     			Pageview.Meta.AddTag("twitter:site", twitterCardSite);
681     		}
682683     		if (!string.IsNullOrEmpty(twitterCardURL))
684     		{
685     			Pageview.Meta.AddTag("twitter:url", twitterCardURL);
686     		}
687688     		if (!string.IsNullOrEmpty(twitterCardTitle))
689     		{
690     			Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
691     		}
692     	}
693     }
694695696     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
697698     @helper RenderScrollTopButton()
699     {
700     	var showButton = Model.Area.Item.GetBoolean("ShowScrollTopButton");
701     	string theme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ThemeScrollTop")) ? " theme " + Model.Area.Item.GetRawValueString("ThemeScrollTop").Replace(" ", "").Trim().ToLower() : "";
702703     	if(showButton && !Pageview.IsVisualEditorMode == true)
704     	{
705     		<button class="scroll-top-button@(theme)" onclick="scrollToTop()">
706     			@Model.Item.GetRawValueString("ThemeScrollTop")
707     			<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16">
708     				<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/>
709     			</svg>
710     		</button>
711     	}
712     }
713