Error executing template "Designs/Swift/_parsed/Swift_PageCustom.parsed.cshtml"
System.ArgumentException: Object type cannot be converted to target type.
at RazorEngine.Compilation.CrossAppDomainCleanUp.CleanupHelper.Init(AppDomain domain, IPrinter printer)
at RazorEngine.Compilation.CrossAppDomainCleanUp.InitHelper.CreateHelper()
at RazorEngine.Compilation.ExecutionContextLessThread.CallHelperSafeHelper`2.AsAction()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at RazorEngine.Compilation.ExecutionContextLessThread.DefaultCallFunc[O](Func`1 f)
at RazorEngine.Compilation.CrossAppDomainCleanUp..ctor(AppDomain toWatch, IPrinter printer)
at RazorEngine.Compilation.CrossAppDomainCleanUp.CreateInitial()
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy`1.get_Value()
at RazorEngine.Compilation.CrossAppDomainCleanUp.RegisterCleanup(String item, Boolean throwOnDefault)
at RazorEngine.Templating.InvalidatingCachingProvider.CacheTemplate(ICompiledTemplate template, ITemplateKey templateKey)
at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
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.Services.Pages?.GetPage(brandingPageId) ?? null; 26 var themesParagraphLastChanged = 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 googleAnalyticsTrackingID = Model.Area.Item.GetString("GoogleAnalyticsTrackingID"); 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="format-detection" content="telephone=no"> 143 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0"> 144 <link rel="shortcut icon" href="@favicon"> 145 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png"> 146147 @Model.MetaTags 148149 @{ 150 @* Languages meta data *@ 151 foreach (var language in languages) 152 { 153 if (language?.Area != null) 154 { 155 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID) 156 { 157 if (!string.IsNullOrEmpty(language.Area.DomainLock)) 158 { 159 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk 160 } 161 string querystring = $"Default.aspx?ID={language.ID}"; 162 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"])) 163 { 164 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}"; 165 } 166 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"])) 167 { 168 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}"; 169 } 170 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"])) 171 { 172 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}"; 173 } 174175 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring); 176 string href = $"{url.Scheme}://{hostName}{friendlyUrl}"; 177178 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href"> 179 } 180 } 181 } 182 } 183184 <title>@Model.Title</title> 185 @* Bootstrap + Swift stylesheet *@ 186 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css"> 187188 @if (disableWideBreakpoints != "disableBoth") 189 { 190 <style> 191 @@media ( min-width: 1600px ) { 192 .container-xxl, 193 .container-xl, 194 .container-lg, 195 .container-md, 196 .container-sm, 197 .container { 198 max-width: 1520px; 199 } 200 } 201 </style> 202203 if (disableWideBreakpoints != "disableUltraWideOnly") 204 { 205 <style> 206 @@media ( min-width: 1920px ) { 207 .container-xxl, 208 .container-xl, 209 .container-lg, 210 .container-md, 211 .container-sm, 212 .container { 213 max-width: 1820px; 214 } 215 } 216 </style> 217 } 218 } 219220 @* Branding and Themes min stylesheet *@ 221 <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"> 222 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script> 223 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script> 224225 <script type="module"> 226 AOS.init({ offset: 0, duration: 400, delay: 100, easing: 'ease-in-out', mirror: true, disable: window.matchMedia('(prefers-reduced-motion: reduce)') }); 227 swift.Scroll.hideHeadersOnScroll(); 228 swift.Scroll.handleAlternativeTheme(); 229 </script> 230231 @* Global site tag (gtag.js) - Google Analytics *@ 232 @if (!string.IsNullOrWhiteSpace(googleAnalyticsTrackingID)) 233 { 234 <!-- Google Consent Mode --> 235 <script data-cookieconsent="ignore"> 236 window.dataLayer = window.dataLayer || []; 237 function gtag() { 238 dataLayer.push(arguments) 239 } 240 gtag("consent", "default", { 241 ad_storage: "denied", 242 analytics_storage: "denied", 243 functionality_storage: "denied", 244 personalization_storage: "denied", 245 security_storage: "granted", 246 wait_for_update: 500 247 }); 248 gtag("set", "ads_data_redaction", true); 249 gtag("set", "url_passthrough", true); 250 </script> 251 <!-- End Google Consent Mode --> 252 <!-- Google Tag Manager --> 253 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 254 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 255 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 256 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 257 })(window,document,'script','dataLayer','@googleAnalyticsTrackingID');</script> 258 <!-- End Google Tag Manager --> 259 } 260261 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID)) 262 { 263 var GoogleAnalyticsDebugMode = ""; 264 bool isLoggedInBackendUser = false; 265266 if (Dynamicweb.Environment.ExecutingContext.IsAdminLoggedIn()) 267 { 268 isLoggedInBackendUser = true; 269 } 270271 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && @isLoggedInBackendUser) 272 { 273 GoogleAnalyticsDebugMode = ", {'debug_mode': true}"; 274 } 275276 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script> 277 <script> 278 window.dataLayer = window.dataLayer || []; 279 function gtag() { dataLayer.push(arguments); } 280 gtag('js', new Date()); 281 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode); 282 </script> 283 } 284285 @if (!string.IsNullOrWhiteSpace(customHeaderInclude)) 286 { 287 @RenderPartial($"Components/Custom/{customHeaderInclude}") 288 } 289 </head> 290 <body class="brand @(masterTheme)" id="page@(Model.ID)"> 291 @if (!string.IsNullOrWhiteSpace(googleAnalyticsTrackingID)) 292 { 293 <!-- Google Tag Manager (noscript) --> 294 <noscript> 295 <iframe src="https://www.googletagmanager.com/ns.html?id=@googleAnalyticsTrackingID" 296 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 297 <!-- End Google Tag Manager (noscript) --> 298 } 299300 @if (renderAsResponsive || !renderMobile) 301 { 302 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop"> 303 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null) 304 { 305 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId) 306 } 307 </header> 308 } 309310 @if ((renderAsResponsive || renderMobile)) 311 { 312 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile"> 313 @if (@Model.Area.Item.GetLink("HeaderMobile") != null) 314 { 315 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId) 316 } 317 </header> 318 } 319320 <main id="content" @(schemaOrgType)> 321 <div data-intersect></div> 322 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 323 @using System 324 @using Dynamicweb.Ecommerce.ProductCatalog 325326327 @{ 328 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty; 329 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop"; 330331 bool isArticlePagePage = Model.ItemType == "Swift_Article"; 332 string schemaOrgProp = string.Empty; 333 if(isArticlePagePage) 334 { 335 schemaOrgProp = "itemprop=\"articleBody\""; 336 } 337338 string theme = ""; 339 string gridContent = ""; 340341 if (Model.PropertyItem != null) 342 { 343 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? " theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 344 } 345346 if (Model.Item != null || Pageview.IsVisualEditorMode) 347 { 348 if (!isProductDetail) 349 { 350 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page"); 351 } 352 else 353 { 354 var productObject = Dynamicweb.Ecommerce.Products.Product.GetProductById(productIdFromUrl); 355 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty; 356 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage"); 357358 @RenderGrid(detailPageId) 359 } 360 } 361362 bool doNotRenderPage = false; 363364 //Check if we are on the poduct detail page, and if there is data to render 365 ProductViewModel product = new ProductViewModel(); 366 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 367 { 368 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 369 if (string.IsNullOrEmpty(product.Id)) { 370 doNotRenderPage = true; 371 } 372 } 373374 //Render the page 375 if (!doNotRenderPage) { 376 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page"; 377378 if (theme != "") 379 { 380 <div class="@theme item_@itemIdentifier" @schemaOrgProp> 381 @gridContent 382 </div> 383 } 384 else 385 { 386 <div class="item_@itemIdentifier" @schemaOrgProp> 387 @gridContent 388 </div> 389 } 390 } else { 391 <div class="container"> 392 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div> 393 </div> 394 } 395396 if (!Model.IsCurrentUserAllowed) 397 { 398 int signInPage = GetPageIdByNavigationTag("SignInPage"); 399 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage"); 400401 if (!Pageview.IsVisualEditorMode) 402 { 403 if (signInPage != 0) 404 { 405 if (signInPage != Model.ID) { 406 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage); 407 } else { 408 if (dashboardPage != 0) { 409 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage); 410 } else { 411 Dynamicweb.Context.Current.Response.Redirect("/"); 412 } 413 } 414 } 415 else 416 { 417 <div class="alert alert-dark m-0" role="alert"> 418 <span>@Translate("You do not have access to this page")</span> 419 </div> 420 } 421 } 422 else 423 { 424 <div class="alert alert-dark m-0" role="alert"> 425 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span> 426 </div> 427 } 428 } 429 } 430431 </main> 432433 @if (renderAsResponsive || !renderMobile) 434 { 435 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop"> 436 @if (@Model.Area.Item.GetLink("FooterDesktop") != null) 437 { 438 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId) 439 } 440 </footer> 441 } 442443 @if (renderAsResponsive || renderMobile) 444 { 445 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile"> 446 @if (@Model.Area.Item.GetLink("FooterMobile") != null) 447 { 448 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId) 449 } 450 </footer> 451 } 452453 @* Render any offcanvas menu here *@ 454 @RenderSnippet("offcanvas") 455456 @{ 457 bool isErpConnectionDown = !Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable(); 458 } 459460 @* Language selector modal *@ 461 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1) 462 { 463 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true"> 464 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent"> 465 @* The content here comes from an external request *@ 466 </div> 467 </div> 468 } 469470 @* Favorite toast *@ 471 <div aria-live="polite" aria-atomic="true"> 472 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11"> 473 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true"> 474 <div class="toast-header"> 475 <strong class="me-auto">@Translate("Favorite list updated")</strong> 476 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> 477 </div> 478 <div class="toast-body d-flex gap-3"> 479 <div id="favoriteNotificationToast_Image"></div> 480 <div id="favoriteNotificationToast_Text"></div> 481 </div> 482 </div> 483 </div> 484 </div> 485486 @* Modal for dynamic content *@ 487 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true"> 488 <div class="modal-dialog modal-dialog-centered modal-md"> 489 <div class="modal-content theme light" id="DynamicModalContent"> 490 @* The content here comes from an external request *@ 491 </div> 492 </div> 493 </div> 494495 @* Offcanvas for dynamic content *@ 496 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem"> 497 @* The content here comes from an external request *@ 498 </div> 499500 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage")) 501 { 502 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light"; 503504 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040"> 505 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true"> 506 <div class="toast-header"> 507 <strong class="me-auto">@Translate("Connection down")</strong> 508 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> 509 </div> 510 <div class="toast-body"> 511 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.") 512 </div> 513 </div> 514 </div> 515 } 516 </body> 517 </html> 518 @functions { 519 void SetMetaTags() 520 { 521 //Verification Tokens 522 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : ""; 523 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : ""; 524 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : ""; 525 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : ""; 526 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : ""; 527 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : ""; 528529 //Generic Site Values 530 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : ""; 531 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : ""; 532 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : ""; 533534 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : ""; 535536 //Page specific values 537 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : ""; 538 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image"); 539 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : ""; 540 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : ""; 541542 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : ""; 543 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : ""; 544 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : ""; 545 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image"); 546 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : ""; 547548 if (!string.IsNullOrEmpty(siteVerificationGoogle)) 549 { 550 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle); 551 } 552553 if (!string.IsNullOrEmpty(openGraphFacebookAppID)) 554 { 555 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID); 556 } 557558 if (!string.IsNullOrEmpty(openGraphType)) 559 { 560 Pageview.Meta.AddTag("og:type", openGraphType); 561 } 562563 if (!string.IsNullOrEmpty(openGraphSiteName)) 564 { 565 Pageview.Meta.AddTag("og:site_name", openGraphSiteName); 566 } 567 if (!string.IsNullOrEmpty(Model.Title)) 568 { 569 Pageview.Meta.AddTag("og:title", Model.Title); 570 } 571 else 572 { 573 Pageview.Meta.AddTag("og:title", openGraphSiteTitle); 574 } 575576 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"])) 577 { 578 if (!string.IsNullOrEmpty(Model.Description)) 579 { 580 Pageview.Meta.AddTag("og:description", Model.Description); 581 } 582 else 583 { 584 Pageview.Meta.AddTag("og:description", openGraphDescription); 585 } 586 if (openGraphImage != null) 587 { 588 Pageview.Meta.AddTag("og:image", openGraphImage.Path); 589 } 590591 if (!string.IsNullOrEmpty(openGraphImageALT)) 592 { 593 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT); 594 } 595 if (!string.IsNullOrEmpty(twitterCardDescription)) 596 { 597 Pageview.Meta.AddTag("twitter:description", twitterCardDescription); 598 } 599600 if (twitterCardImage != null) 601 { 602 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path); 603 } 604605 if (!string.IsNullOrEmpty(twitterCardImageALT)) 606 { 607 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT); 608 } 609 } 610611 if (!string.IsNullOrEmpty(twitterCardSite)) 612 { 613 Pageview.Meta.AddTag("twitter:site", twitterCardSite); 614 } 615616 if (!string.IsNullOrEmpty(twitterCardURL)) 617 { 618 Pageview.Meta.AddTag("twitter:url", twitterCardURL); 619 } 620621 if (!string.IsNullOrEmpty(twitterCardTitle)) 622 { 623 Pageview.Meta.AddTag("twitter:title", twitterCardTitle); 624 } 625 } 626 } 627