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_d567ef9ec714481386f5cb2fac1dfc38.SetMetaTags() in D:\dynamicweb.net\Solutions\Capo\sundqvist-new.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\_parsed\Legacy_BloggPost.parsed.cshtml:line 603
at CompiledRazorTemplates.Dynamic.RazorEngine_d567ef9ec714481386f5cb2fac1dfc38.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(',');
340 int blogListPageId = GetPageIdByNavigationTag("Bloglist");
341342 foreach (var word in categoriesList)
343 {
344 <div>
345 <a
346 class="fs-6 category-btn"
347 style="margin-right: 5px;"
348 href="Default.aspx?id=@(blogListPageId)&BlogCategory=@word"
349 >
350 @Translate(word)
351 </a>
352 </div>
353 }
354 }
355 </div>
356 </div>
357358 @* @if (!Model.Item.GetBoolean("HideMainImage") && mainImage.Length > 0) *@
359 @if (showImage)
360 {
361 <div class="blog-post-page__image">
362 <figure class="mb-0">
363 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("ImageMain"))
364 </figure>
365 </div>
366 }
367 </div>
368 </div>
369370 <section class="blog-post-tips container-xl container-xl pb-5 pb-lg-6">
371 <div class=" theme sundqvist-primary p-md-5 p-5">
372 @Model.Placeholder("dwcontent1", "blogspost", "default:true;sort:1")
373 </div>
374 </section>
375376 <section id="mentioned-products"
377 class="blog-post-mentioned-products container-xl py-5 py-lg-6">
378 @Model.Placeholder("dwcontent2", "mentioned-products", "default:true;sort:2")
379 </section>
380381 <section id="related-reads"
382 class="container-xl blog-post-related-read py-5 py-lg-6">
383 @Model.Placeholder("dwcontent3", "related-reads", "default:true;sort:3")
384 </section>
385386387 @* Find stores modal *@
388 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
389 @using Dynamicweb
390 @using Dynamicweb.Environment
391 @using System;
392393 @helper RenderFindStoresModal()
394 {
395 <div id="findStore" class="find-store-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
396 <div class="find-store-modal-dialog">
397 <div class="find-store-modal-content">
398 <div class="find-store-modal-header">
399 <h4 class="modal-title">@Translate("FindStores", "Hitta köpställe")</h4>
400 <button type="button" class="btn btn-primary close flex center" data-dismiss="modal">×</button>
401 </div>
402 <div class="text-center loading">
403 <div class="spinner-border" role="status">
404 <span class="sr-only"></span>
405 </div>
406 </div>
407 <div class="modal-body" id="modal-body">
408 @* Load jquery as required by findstores.js *@
409 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
410 </div>
411 </div>
412 </div>
413 </div>
414415 <script>
416 // Get the modal element
417 var modal = document.getElementById("findStore");
418 // Get the <span> element that closes the modal
419 var span = document.getElementsByClassName("close")[0];
420 // When the user clicks on the <span> (x), close the modal
421 span.onclick = function () {
422 modal.style.display = "none";
423 document.body.style.overflow = "auto";
424 };
425 // When the user clicks anywhere outside of the modal, close it
426 window.onclick = function (event) {
427 if (event.target == modal) {
428 modal.style.display = "none";
429 document.body.style.overflow = "auto";
430 }
431 };
432 // Get spinner
433 var spinner = document.getElementsByClassName('loading');
434 // Load the content using AJAX when the user clicks on a link
435 var links = document.querySelectorAll("#findStoresButton");
436437 for (var i = 0; i < links.length; i++) {
438 links[i].onclick = function (event) {
439 event.preventDefault();
440 modal.style.display = "flex";
441 document.body.style.overflow = "hidden";
442 var url = "/Default.aspx?ID=" + "@GetPageIdByNavigationTag("findstores")";
443 var xhr = new XMLHttpRequest();
444445 //The specific Brand is handled in the find-stores js adding [?Brands=BLALA] to the Url.
446 xhr.onreadystatechange = function () {
447 if (xhr.readyState == 4 && xhr.status == 200) {
448 document.activeElement.blur();
449 var modalBody = document.getElementById("modal-body");
450 //get just the main content from the main find store page
451 const mainContent = xhr.responseText.match(/<main[^>]*>([\s\S]*?)<\/main>/i)[0];
452 // remove the header text
453 const divWithClassName = document.createElement("div");
454 divWithClassName.innerHTML = mainContent;
455 const myDiv = divWithClassName.querySelector(".item_swift_2columns");
456 const content = myDiv.innerHTML;
457 //populate the modal
458 modalBody.innerHTML = content;
459 //Dynamically add the scripts to the modal so the elements are bound correctly
460 var script2 = document.createElement("script");
461 script2.src = "/Files/Templates/Designs/Swift_Custom/Assets/js/find-stores.min.js";
462 script2.crossOrigin = "anonymous";
463 script2.defer = true;
464 document.getElementById("modal-body").appendChild(script2);
465 var script3 = document.createElement("script");
466 script3.src = "https://unpkg.com/axios/dist/axios.min.js";
467 document.getElementById("modal-body").appendChild(script3);
468 // Hide the loading icon when content has finished loading
469 spinner[0].remove();
470 };
471 };
472 xhr.open("GET", url, true);
473 xhr.send();
474 };
475 }
476 </script>
477 }
478479 @if (Pageview.Page.NavigationTag == "Shop")
480 {
481 @RenderFindStoresModal();
482 }
483 @RenderScrollTopButton()
484 </main>
485486 @if (renderAsResponsive || !renderMobile)
487 {
488 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
489 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
490 {
491 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
492 }
493 </footer>
494 }
495496 @if (renderAsResponsive || renderMobile)
497 {
498 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
499 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
500 {
501 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
502 }
503 </footer>
504 }
505506 @* Render any offcanvas menu here or *@
507 @RenderSnippet("offcanvas")
508509 @{
510 //bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
511 bool isErpConnectionDown = !Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable();
512 }
513514 @* Language selector modal *@
515 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
516 {
517 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
518 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
519 @* The content here comes from an external request *@
520 </div>
521 </div>
522 }
523524 @* Favorite toast *@
525 <div aria-live="polite" aria-atomic="true">
526 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
527 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
528 <div class="toast-header">
529 <strong class="me-auto">@Translate("Favorite list updated")</strong>
530 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
531 </div>
532 <div class="toast-body d-flex gap-3">
533 <div id="favoriteNotificationToast_Image"></div>
534 <div id="favoriteNotificationToast_Text"></div>
535 </div>
536 </div>
537 </div>
538 </div>
539540 @* Modal for dynamic content *@
541 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
542 <div class="modal-dialog modal-dialog-centered modal-md">
543 <div class="modal-content theme light" id="DynamicModalContent">
544 @* The content here comes from an external request *@
545 </div>
546 </div>
547 </div>
548549 @* Offcanvas for dynamic content *@
550 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
551 @* The content here comes from an external request *@
552 </div>
553554 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
555 {
556 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
557558 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
559 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
560 <div class="toast-header">
561 <strong class="me-auto">@Translate("Connection down")</strong>
562 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
563 </div>
564 <div class="toast-body">
565 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
566 </div>
567 </div>
568 </div>
569 }
570 <script async="" src="https://script.extellio.com/sundqvist-se.min.js"></script>
571 </body>
572 </html>
573 @functions {
574 void SetMetaTags()
575 {
576 //Verification Tokens
577 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
578 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
579 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
580 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
581 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
582 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
583584 //Generic Site Values
585 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
586 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
587 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
588589 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
590591 //Page specific values
592 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
593 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
594 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
595 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
596597 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
598 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
599 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
600 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
601 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
602603 string blogPostMainImage = Pageview.Page.Item["ImageMain"]?.ToString();
604605 if (!string.IsNullOrEmpty(siteVerificationGoogle))
606 {
607 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
608 }
609610 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
611 {
612 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
613 }
614615 if (!string.IsNullOrEmpty(openGraphType))
616 {
617 Pageview.Meta.AddTag("og:type", openGraphType);
618 }
619620 if (!string.IsNullOrEmpty(openGraphSiteName))
621 {
622 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
623 }
624625 if (!string.IsNullOrEmpty(Model.Title))
626 {
627 Pageview.Meta.AddTag("og:title", Model.Title);
628 }
629 else
630 {
631 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
632 }
633634 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
635 {
636 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
637 }
638639 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
640 {
641 if (!string.IsNullOrEmpty(Model.Description))
642 {
643 Pageview.Meta.AddTag("og:description", Model.Description);
644 }
645 else
646 {
647 Pageview.Meta.AddTag("og:description", openGraphDescription);
648 }
649 if (openGraphImage != null)
650 {
651 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
652 }
653654 if (Pageview.Page.ItemType == "Blogpost" && !string.IsNullOrEmpty(blogPostMainImage))
655 {
656 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + blogPostMainImage);
657 }
658659 if (!string.IsNullOrEmpty(openGraphImageALT))
660 {
661 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
662 }
663 if (!string.IsNullOrEmpty(twitterCardDescription))
664 {
665 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
666 }
667668 if (twitterCardImage != null)
669 {
670 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
671 }
672673 if (!string.IsNullOrEmpty(twitterCardImageALT))
674 {
675 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
676 }
677 }
678679 if (!string.IsNullOrEmpty(twitterCardSite))
680 {
681 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
682 }
683684 if (!string.IsNullOrEmpty(twitterCardURL))
685 {
686 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
687 }
688689 if (!string.IsNullOrEmpty(twitterCardTitle))
690 {
691 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
692 }
693 }
694 }
695696697 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
698699 @helper RenderScrollTopButton()
700 {
701 var showButton = Model.Area.Item.GetBoolean("ShowScrollTopButton");
702 string theme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ThemeScrollTop")) ? " theme " + Model.Area.Item.GetRawValueString("ThemeScrollTop").Replace(" ", "").Trim().ToLower() : "";
703704 if(showButton && !Pageview.IsVisualEditorMode == true)
705 {
706 <button class="scroll-top-button@(theme)" onclick="scrollToTop()">
707 @Model.Item.GetRawValueString("ThemeScrollTop")
708 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16">
709 <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"/>
710 </svg>
711 </button>
712 }
713 }
714