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