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