Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_899aa325c082434f9ddb9dafb3d6c8c9.Execute() in C:\inetpub\wwwroot\plus-staging\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 22
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 System.Collections.Generic
4 @using System.Linq
5 @using Dynamicweb.Content
6 @using Dynamicweb.Environment
7 @using Dynamicweb.Frontend
8 @using System.Runtime
9
10 @{
11 string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
12 bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
13 bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
14 string responsiveClassDesktop = string.Empty;
15 string responsiveClassMobile = string.Empty;
16 if (renderAsResponsive)
17 {
18 responsiveClassDesktop = " d-none d-xl-block";
19 responsiveClassMobile = " d-block d-xl-none";
20 }
21
22 var selectedLangId = Dynamicweb.Environment.CookieManager.GetCookie("Ecom.SelectedLangID.Frontend").Value;
23 if (selectedLangId != null && selectedLangId != Pageview.Area.EcomLanguageId)
24 {
25 Dynamicweb.Ecommerce.Common.Context.LanguageID = Pageview.Area.EcomLanguageId;
26 }
27
28 var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
29
30 var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
31 var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
32 string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
33
34 var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
35 var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
36
37 var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
38 var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
39
40 // Schema.org details for PDP
41 string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
42 bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
43 bool isArticlePage = Model.ItemType == "Swift_Article";
44 string schemaOrgType = string.Empty;
45
46 if (isProductDetailsPage)
47 {
48 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
49 }
50
51 if (isArticlePage)
52 {
53 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
54 }
55
56 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
57 {
58 //Branding page has been saved or the file is missing. Rewrite the file to disc.
59 if (brandingPageId > 0)
60 {
61 var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
62 brandingPageview.Redirect = false;
63 brandingPageview.Output();
64 }
65 }
66
67 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
68 {
69 //Branding page has been saved or the file is missing. Rewrite the file to disc.
70 if (themePageId > 0)
71 {
72 var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
73 themePageview.Redirect = false;
74 themePageview.Output();
75 }
76 }
77
78 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
79 var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
80
81 string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
82
83 string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
84
85 string headerCssClass = "sticky-top";
86 bool movePageBehind = false;
87
88 if (Pageview.Page.PropertyItem != null)
89 {
90 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
91 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
92 }
93
94 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
95 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
96
97 string googleAnalyticsTrackingID = Model.Area.Item.GetString("GoogleAnalyticsTrackingID");
98 string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
99 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
100 bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
101
102 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
103 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;");
104 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
105 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
106 //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
107
108 SetMetaTags();
109
110 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
111
112 if (Pageview.Area.IsMaster)
113 {
114 languages.Add(Pageview.Page);
115 if (Pageview.Page.Languages != null)
116 {
117 foreach (var language in Pageview.Page.Languages)
118 {
119 languages.Add(language);
120 }
121 }
122 }
123 else
124 {
125 languages.Add(Pageview.Page.MasterPage);
126 if (Pageview.Page.MasterPage != null)
127 {
128 if (Pageview.Page.MasterPage.Languages != null)
129 {
130 foreach (var language in Pageview.Page.MasterPage.Languages)
131 {
132 languages.Add(language);
133 }
134 }
135 }
136 }
137
138 string siteLanguage = Pageview.Area.CultureInfo.Name;
139 Uri url = Dynamicweb.Context.Current.Request.Url;
140 string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
141
142 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
143 var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
144
145 string values = string.Empty;
146 IEnumerable<Paragraph> utmCampaignParagraphs = Enumerable.Empty<Paragraph>();
147 var utmCampaignPage = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "UTM_Campaigns");
148 if (utmCampaignPage != null)
149 {
150 utmCampaignParagraphs = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(utmCampaignPage.ID).Where(x => x.ShowParagraph);
151 var utmCampaignString = utmCampaignParagraphs.Select(p => p.Item);
152 foreach (Dynamicweb.Content.Items.Item item in utmCampaignString)
153 {
154 values = item.FirstOrDefault(k => k.Key == "ParameterValue").Value.ToString();
155 }
156 }
157
158 }
159 <!doctype html>
160 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
161 <head>
162 <!-- Google Tag Manager -->
163 <script>
164 (function (w, d, s, l, i) {
165 w[l] = w[l] || []; w[l].push({
166 'gtm.start':
167 new Date().getTime(), event: 'gtm.js'
168 }); var f = d.getElementsByTagName(s)[0],
169 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
170 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
171 })(window, document, 'script', 'dataLayer', 'GTM-MDSFDQX');
172 </script>
173 <!-- End Google Tag Manager -->
174 <!-- @swiftVersion -->
175 @* Required meta tags *@
176 <meta name="facebook-domain-verification" content="49gii406emphmj02uqo2yyq1li9kzu" />
177 <meta charset="utf-8">
178 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
179 <link rel="shortcut icon" href="@favicon">
180 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
181
182 @Model.MetaTags
183
184 @{
185 @* Languages meta data *@
186 foreach (var language in languages)
187 {
188 if (language?.Area != null)
189 {
190 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
191 {
192 if (!string.IsNullOrEmpty(language.Area.DomainLock))
193 {
194 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
195 }
196 string querystring = $"Default.aspx?ID={language.ID}";
197 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
198 {
199 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
200 }
201 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
202 {
203 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
204 }
205 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
206 {
207 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
208 }
209
210 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
211 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
212
213 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
214 }
215 }
216 }
217 }
218
219 <title>@Model.Title</title>
220 @* Bootstrap + Swift stylesheet *@
221 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
222
223 @if (disableWideBreakpoints != "disableBoth")
224 {
225 <style>
226 @@media (min-width: 1600px) {
227 .container-xxl,
228 .container-xl,
229 .container-lg,
230 .container-md,
231 .container-sm,
232 .container {
233 max-width: 1520px;
234 }
235 }
236 </style>
237
238 if (disableWideBreakpoints != "disableUltraWideOnly")
239 {
240 <style>
241 @@media (min-width: 1920px) {
242 .container-xxl,
243 .container-xl,
244 .container-lg,
245 .container-md,
246 .container-sm,
247 .container {
248 max-width: 1820px;
249 }
250 }
251 </style>
252 }
253 }
254
255 @* Branding and Themes min stylesheet *@
256 <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">
257 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
258 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
259
260 <script type="module">
261 AOS.init({ offset: 0, duration: 400, delay: 100, easing: 'ease-in-out', mirror: true, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
262 swift.Scroll.hideHeadersOnScroll();
263 swift.Scroll.handleAlternativeTheme();
264 </script>
265
266 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/rizzo/sr-emptyCart.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
267
268 <script>
269 document.addEventListener("DOMContentLoaded", function() {
270 // Function to get the value of a parameter from the URL
271 function getParameterByName(name, url) {
272 if (!url) url = window.location.href;
273 name = name.replace(/[\[\]]/g, "\\$&");
274 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
275 results = regex.exec(url);
276 if (!results) return null;
277 if (!results[2]) return '';
278 return decodeURIComponent(results[2].replace(/\+/g, " "));
279 }
280
281 // Get the value of the parameter from the URL
282 var paramValue = getParameterByName('utm_campaign');
283 var valueString = '@values';
284 console.log(valueString);
285 if (paramValue != null && valueString.includes(paramValue)) {
286 // Create a session cookie with the parameter value
287 let cName = "RemoveDealer",
288 cValue = true;
289 document.cookie = cName + "=" + cValue + "; path=/";
290 }
291 });
292 </script>
293
294 @* Global site tag (gtag.js) - Google Analytics *@
295 @if (!string.IsNullOrWhiteSpace(googleAnalyticsTrackingID) && allowTracking)
296 {
297 <script src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsTrackingID" async></script>
298 <script>
299 window.dataLayer = window.dataLayer || [];
300 function gtag() { window.dataLayer.push(arguments); }
301 gtag('js', new Date());
302 gtag('config', '@googleAnalyticsTrackingID');
303 </script>
304 }
305
306 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
307 {
308 var GoogleAnalyticsDebugMode = "";
309 bool isLoggedInBackendUser = false;
310
311 if (Dynamicweb.Environment.ExecutingContext.IsAdminLoggedIn())
312 {
313 isLoggedInBackendUser = true;
314 }
315
316 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && @isLoggedInBackendUser)
317 {
318 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
319 }
320
321 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
322 <script>
323 window.dataLayer = window.dataLayer || [];
324 function gtag() { dataLayer.push(arguments); }
325 gtag('js', new Date());
326 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
327 </script>
328 }
329
330 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
331 {
332 @RenderPartial($"Components/Custom/{customHeaderInclude}")
333 }
334 </head>
335 <body class="brand @(masterTheme)" id="page@(Model.ID)">
336 <!-- Google Tag Manager (noscript) -->
337 <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MDSFDQX"
338 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
339 <!-- End Google Tag Manager (noscript) -->
340 @if (renderAsResponsive || !renderMobile)
341 {
342 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
343 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
344 {
345 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
346 }
347 </header>
348 }
349
350 @if ((renderAsResponsive || renderMobile))
351 {
352 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
353 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
354 {
355 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
356 }
357 </header>
358 }
359
360 <main id="content" @(schemaOrgType)>
361 <div data-intersect></div>
362 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
363 @using System
364 @using Dynamicweb.Ecommerce.ProductCatalog
365
366
367 @{
368 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
369 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
370
371 bool isArticlePagePage = Model.ItemType == "Swift_Article";
372 string schemaOrgProp = string.Empty;
373 if(isArticlePagePage)
374 {
375 schemaOrgProp = "itemprop=\"articleBody\"";
376 }
377
378 string theme = "";
379 string gridContent = "";
380
381 if (Model.PropertyItem != null)
382 {
383 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? " theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
384 }
385
386 if (Model.Item != null || Pageview.IsVisualEditorMode)
387 {
388 if (!isProductDetail)
389 {
390 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
391 }
392 else
393 {
394 var productObject = Dynamicweb.Ecommerce.Products.Product.GetProductById(productIdFromUrl);
395 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
396 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
397
398 @RenderGrid(detailPageId)
399 }
400 }
401
402 bool doNotRenderPage = false;
403
404 //Check if we are on the poduct detail page, and if there is data to render
405 ProductViewModel product = new ProductViewModel();
406 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
407 {
408 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
409 if (string.IsNullOrEmpty(product.Id)) {
410 doNotRenderPage = true;
411 }
412 }
413
414 //Render the page
415 if (!doNotRenderPage) {
416 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
417
418 if (theme != "")
419 {
420 <div class="@theme item_@itemIdentifier" @schemaOrgProp>
421 @gridContent
422 </div>
423 }
424 else
425 {
426 <div class="item_@itemIdentifier" @schemaOrgProp>
427 @gridContent
428 </div>
429 }
430 } else {
431 <div class="container">
432 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
433 </div>
434 }
435
436 if (!Model.IsCurrentUserAllowed)
437 {
438 int signInPage = GetPageIdByNavigationTag("SignInPage");
439 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
440
441 if (!Pageview.IsVisualEditorMode)
442 {
443 if (signInPage != 0)
444 {
445 if (signInPage != Model.ID) {
446 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
447 } else {
448 if (dashboardPage != 0) {
449 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
450 } else {
451 Dynamicweb.Context.Current.Response.Redirect("/");
452 }
453 }
454 }
455 else
456 {
457 <div class="alert alert-dark m-0" role="alert">
458 <span>@Translate("You do not have access to this page")</span>
459 </div>
460 }
461 }
462 else
463 {
464 <div class="alert alert-dark m-0" role="alert">
465 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
466 </div>
467 }
468 }
469 }
470
471 </main>
472
473 @if (renderAsResponsive || !renderMobile)
474 {
475 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
476 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
477 {
478 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
479 }
480 </footer>
481 }
482
483 @if (renderAsResponsive || renderMobile)
484 {
485 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
486 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
487 {
488 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
489 }
490 </footer>
491 }
492
493 @* Render any offcanvas menu here *@
494 @RenderSnippet("offcanvas")
495
496 @{
497 bool isErpConnectionDown = !Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable();
498 }
499
500 @* Language selector modal *@
501 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
502 {
503 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
504 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
505 @* The content here comes from an external request *@
506 </div>
507 </div>
508 }
509
510 @* Favorite toast *@
511 <div aria-live="polite" aria-atomic="true">
512 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
513 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
514 <div class="toast-header">
515 <strong class="me-auto">@Translate("Favorite list updated")</strong>
516 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
517 </div>
518 <div class="toast-body d-flex gap-3">
519 <div id="favoriteNotificationToast_Image"></div>
520 <div id="favoriteNotificationToast_Text"></div>
521 </div>
522 </div>
523 </div>
524 </div>
525
526 @* Modal for dynamic content *@
527 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
528 <div class="modal-dialog modal-dialog-centered modal-md">
529 <div class="modal-content theme light" id="DynamicModalContent">
530 @* The content here comes from an external request *@
531 </div>
532 </div>
533 </div>
534
535 @* Offcanvas for dynamic content *@
536 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
537 @* The content here comes from an external request *@
538 </div>
539
540 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
541 {
542 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
543
544 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
545 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
546 <div class="toast-header">
547 <strong class="me-auto">@Translate("Connection down")</strong>
548 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
549 </div>
550 <div class="toast-body">
551 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
552 </div>
553 </div>
554 </div>
555 }
556
557 </body>
558 </html>
559 @functions {
560 void SetMetaTags()
561 {
562 //Verification Tokens
563 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
564 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
565 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
566 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
567 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
568 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
569
570 //Generic Site Values
571 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
572 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
573 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
574
575 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
576
577 //Page specific values
578 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
579 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
580 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
581 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
582
583 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
584 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
585 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
586 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
587 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
588
589 if (!string.IsNullOrEmpty(siteVerificationGoogle))
590 {
591 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
592 }
593
594 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
595 {
596 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
597 }
598
599 if (!string.IsNullOrEmpty(openGraphType))
600 {
601 Pageview.Meta.AddTag("og:type", openGraphType);
602 }
603
604 if (!string.IsNullOrEmpty(openGraphSiteName))
605 {
606 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
607 }
608
609 if (!string.IsNullOrEmpty(Model.Title))
610 {
611 Pageview.Meta.AddTag("og:title", Model.Title);
612 }
613 else
614 {
615 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
616 }
617
618 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
619 {
620 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
621 }
622
623 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
624 {
625 if (!string.IsNullOrEmpty(Model.Description))
626 {
627 Pageview.Meta.AddTag("og:description", Model.Description);
628 }
629 else
630 {
631 Pageview.Meta.AddTag("og:description", openGraphDescription);
632 }
633 if (openGraphImage != null)
634 {
635 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
636 }
637
638 if (!string.IsNullOrEmpty(openGraphImageALT))
639 {
640 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
641 }
642 if (!string.IsNullOrEmpty(twitterCardDescription))
643 {
644 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
645 }
646
647 if (twitterCardImage != null)
648 {
649 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
650 }
651
652 if (!string.IsNullOrEmpty(twitterCardImageALT))
653 {
654 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
655 }
656 }
657
658 if (!string.IsNullOrEmpty(twitterCardSite))
659 {
660 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
661 }
662
663 if (!string.IsNullOrEmpty(twitterCardURL))
664 {
665 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
666 }
667
668 if (!string.IsNullOrEmpty(twitterCardTitle))
669 {
670 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
671 }
672 }
673 }
674