Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at S_DW_BKI_Swift.CustomModules.Helpers.SchemaMarkupHelpers.<>c__DisplayClass1_0.<GetParagraphById>b__0(Paragraph p) in E:\TeamCity\buildAgent\work\d0551284be6385e5\S_DW_BKI_Swift\CustomModules\Helpers\SchemaMarkupHelpers.cs:line 39
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at S_DW_BKI_Swift.CustomModules.Helpers.SchemaMarkupHelpers.GetParagraphById(PageView pageView, String paragraphId) in E:\TeamCity\buildAgent\work\d0551284be6385e5\S_DW_BKI_Swift\CustomModules\Helpers\SchemaMarkupHelpers.cs:line 39
   at CompiledRazorTemplates.Dynamic.RazorEngine_b9fe05cdd580413884a6a6feb7d0ca58.Execute() in D:\Solution\BKI LIVE\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 41
   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> @using System @using Dynamicweb @using Dynamicweb.Environment @using Dynamicweb.Frontend @using S_DW_BKI_Swift.CustomModules.Helpers @{ string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt"); bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase); bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet; string responsiveClassDesktop = string.Empty; string responsiveClassMobile = string.Empty; if (renderAsResponsive) { responsiveClassDesktop = " d-none d-xl-block"; responsiveClassMobile = " d-block d-xl-none"; } var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default"); var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0; var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0; string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty; var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null; var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault(); var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt; var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css")); string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : ""; bool isProductDetailsPage = !string.IsNullOrEmpty(productId); bool isArticlePage = Model.ItemType == "Swift_Article"; Dynamicweb.Content.PageService ps = new Dynamicweb.Content.PageService(); var page = ps.GetFirstPageForArea(Dynamicweb.Frontend.PageView.Current().AreaID); bool isFrontpage = Dynamicweb.Frontend.PageView.Current().Page.ID == page.ID ? true : false; var getSchemaParagraph = SchemaMarkupHelpers.GetParagraphById(Pageview, "ActivateSchema"); bool activateOrgSchema = getSchemaParagraph != null ? Convert.ToBoolean(getSchemaParagraph.Item["ShowOrganizationShema"]) : false; bool showOrgSchema = false; var customSettings = SchemaMarkupHelpers.GetCustomSettings(Pageview); bool useSchema = false; if(customSettings != null) { useSchema = customSettings.Item["ShowSchema"] != null ? Convert.ToBoolean(customSettings.Item["ShowSchema"]) : false; } string schemaOrgType = string.Empty; if (isProductDetailsPage) { schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\""; } if (isArticlePage) { schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\""; } if(isFrontpage) { schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Organization\""; } if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt) { //Branding page has been saved or the file is missing. Rewrite the file to disc. if (brandingPageId > 0) { var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId); brandingPageview.Redirect = false; brandingPageview.Output(); } } if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt) { //Branding page has been saved or the file is missing. Rewrite the file to disc. if (themePageId > 0) { var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId); themePageview.Redirect = false; themePageview.Output(); } } var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css")); var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js")); string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png"; string headerCssClass = "sticky-top"; bool movePageBehind = false; if (Pageview.Page.PropertyItem != null) { headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; } headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass; headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass; string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID"); string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID"); var cookieOptInLevel = CookieManager.GetCookieOptInLevel(); bool allowTracking = true; Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;"); 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;"); Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;"); Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;"); //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster SetMetaTags(); List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); if (Pageview.Area.IsMaster) { languages.Add(Pageview.Page); if (Pageview.Page.Languages != null) { foreach (var language in Pageview.Page.Languages) { languages.Add(language); } } } else { languages.Add(Pageview.Page.MasterPage); if (Pageview.Page.MasterPage != null) { if (Pageview.Page.MasterPage.Languages != null) { foreach (var language in Pageview.Page.MasterPage.Languages) { languages.Add(language); } } } } string siteLanguage = Pageview.Area.CultureInfo.Name; Uri url = Dynamicweb.Context.Current.Request.Url; string hostName = url.Host; // domain.com/da-dk or domain.com/en-us var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries(); var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies(); } <!doctype html> <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> <head> <!-- @swiftVersion --> @* Required meta tags *@ <meta charset="utf-8"> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="@favicon"> @*custom edit start*@ @if (isFrontpage && useSchema) { @SchemaMarkupHelpers.GetSchemaMarkupForOrganization(customSettings, Pageview) } @if (isArticlePage && useSchema) { @SchemaMarkupHelpers.GetSchemaMarkupForArticle(customSettings, Pageview) } @if (isProductDetailsPage && useSchema) { @SchemaMarkupHelpers.GetSchemaMarkupForProduct(customSettings, Pageview, productId) } @if (!string.IsNullOrEmpty(favicon)) { <link rel="apple-touch-icon" href="@favicon"> } @RenderSnippet("videoSchema") @RenderSnippet("recipeSchema") @*custom edit end*@ @Model.MetaTags @{ var alreadyWrittenTwoletterIsos = new List<string>(); @* Languages meta data *@ foreach (var language in languages) { hostName = url.Host; if (language?.Area != null) { if (language.Area?.MasterArea != null && !string.IsNullOrEmpty(language.Area.MasterArea.DomainLock)) { hostName = language.Area.MasterArea.DomainLock; //dk.domain.com or dk-domain.dk } if (language != null && language.Published && language.Area.Active && language.Area.Published) { if (!string.IsNullOrEmpty(language.Area.DomainLock)) { hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk } string querystring = $"Default.aspx?ID={language.ID}"; if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"])) { querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}"; } if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"])) { querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}"; } if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"])) { querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}"; } string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring); if (language.Area.RedirectFirstPage && language.ParentPageId == 0 && language.Sort == 1) { friendlyUrl = "/"; } string href = $"{url.Scheme}://{hostName}{friendlyUrl}"; <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href"> if (!alreadyWrittenTwoletterIsos.Contains(language.Area.CultureInfo.TwoLetterISOLanguageName)) { <link rel="alternate" hreflang="@language.Area.CultureInfo.TwoLetterISOLanguageName.ToLower()" href="@href"> } } } } } <title>@Model.Title</title> @* Bootstrap + Swift stylesheet *@ <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css"> @if (disableWideBreakpoints != "disableBoth") { <style> @@media ( min-width: 1600px ) { .container-xxl, .container-xl, .container-lg, .container-md, .container-sm, .container { max-width: 1520px; } } </style> if (disableWideBreakpoints != "disableUltraWideOnly") { <style> @@media ( min-width: 1920px ) { .container-xxl, .container-xl, .container-lg, .container-md, .container-sm, .container { max-width: 1820px; } } </style> } } @* Branding and Themes min stylesheet *@ <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"> <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script> <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script> <script type="module"> AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') }); swift.Scroll.hideHeadersOnScroll(); swift.Scroll.handleAlternativeTheme(); </script> @* Google tag manager *@ @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking) { <script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)'); function gtag() { dataLayer.push(arguments); } </script> } @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking) { var GoogleAnalyticsDebugMode = ""; bool isLoggedInBackendUser = false; if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null) { isLoggedInBackendUser = true; } if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser) { GoogleAnalyticsDebugMode = ", {'debug_mode': true}"; } <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode); </script> } @if (!string.IsNullOrWhiteSpace(customHeaderInclude)) { @RenderPartial($"Components/Custom/{customHeaderInclude}") } </head> <body class="brand @(masterTheme)" id="page@(Model.ID)"> @* Google tag manager *@ @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking) { <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> } @if (renderAsResponsive || !renderMobile) { <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop"> @if (@Model.Area.Item.GetLink("HeaderDesktop") != null) { @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId) } </header> } @if ((renderAsResponsive || renderMobile)) { <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile"> @if (@Model.Area.Item.GetLink("HeaderMobile") != null) { @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId) } </header> } <main id="content" @(schemaOrgType)> <div data-intersect></div> @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using Dynamicweb.Ecommerce.ProductCatalog @{ string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty; bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && new[] { "shop", "shopanonymous" }.Contains(Pageview.Page.NavigationTag.ToLower()); // CUSTOM EDIT bool isArticlePagePage = Model.ItemType == "Swift_Article"; bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage"; string schemaOrgProp = string.Empty; if(isArticlePagePage) { schemaOrgProp = "itemprop=\"articleBody\""; } string theme = ""; string gridContent = ""; if (Model.PropertyItem != null) { theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; } if (Model.Item != null || Pageview.IsVisualEditorMode) { if (!isProductDetail) { gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page"); } else { var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId); var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty; var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage"); @RenderGrid(detailPageId) } } bool doNotRenderPage = false; //Check if we are on the poduct detail page, and if there is data to render ProductViewModel product = new ProductViewModel(); if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; if (string.IsNullOrEmpty(product.Id)) { doNotRenderPage = true; } } //Render the page if (!doNotRenderPage) { string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page"; <div class="@theme @itemIdentifier" @schemaOrgProp> @if (isArticleListPage) { var hx = $"hx-get=\"{Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.ID)}\" hx-select=\"#content\" hx-target=\"#content\" hx-swap=\"outerHTML\" hx-trigger=\"change\" hx-headers='{{\"feed\": \"true\"}}' hx-push-url=\"true\" hx-indicator=\"#ArticleFacetForm\""; <form @hx id="ArticleFacetForm"> @gridContent </form> <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script> <script type="module"> document.addEventListener('htmx:confirm', (event) => { let filters = event.detail.elt.querySelectorAll('select'); for (var i = 0; i < filters.length; i++) { let input = filters[i]; if (input.name && !input.value) { input.name = ''; } } }); document.addEventListener('htmx:beforeOnLoad', (event) => { swift.Scroll.stopIntersectionObserver(); }); document.addEventListener('htmx:afterOnLoad', () => { swift.Scroll.hideHeadersOnScroll(); swift.Scroll.handleAlternativeTheme(); }); </script> } else { @gridContent } </div> } else { <div class="container"> <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div> </div> } if (!Model.IsCurrentUserAllowed) { int signInPage = GetPageIdByNavigationTag("SignInPage"); int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage"); if (!Pageview.IsVisualEditorMode) { if (signInPage != 0) { if (signInPage != Model.ID) { Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage); } else { if (dashboardPage != 0) { Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage); } else { Dynamicweb.Context.Current.Response.Redirect("/"); } } } else { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("You do not have access to this page")</span> </div> } } else { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("To work on this page, you must be signed in, in the frontend")</span> </div> } } } </main> @if (renderAsResponsive || !renderMobile) { <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop"> @if (@Model.Area.Item.GetLink("FooterDesktop") != null) { @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId) } </footer> } @if (renderAsResponsive || renderMobile) { <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile"> @if (@Model.Area.Item.GetLink("FooterMobile") != null) { @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId) } </footer> } @* Render any offcanvas menu here *@ @RenderSnippet("offcanvas") @{ bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]); } @* Language selector modal *@ @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1) { <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent"> @* The content here comes from an external request *@ </div> </div> } @* Favorite toast *@ <div aria-live="polite" aria-atomic="true"> <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11"> <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <strong class="me-auto">@Translate("Favorite list updated")</strong> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body d-flex gap-3"> <div id="favoriteNotificationToast_Image"></div> <div id="favoriteNotificationToast_Text"></div> </div> </div> </div> </div> @* Modal for dynamic content *@ <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-md"> <div class="modal-content theme light" id="DynamicModalContent"> @* The content here comes from an external request *@ </div> </div> </div> @* Offcanvas for dynamic content *@ <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem"> @* The content here comes from an external request *@ </div> @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage")) { string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light"; <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040"> <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <strong class="me-auto">@Translate("Connection down")</strong> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @Translate("We are experiencing some connectivity issues. Not all features may be available to you.") </div> </div> </div> } </body> </html> @functions { void SetMetaTags() { //Verification Tokens string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : ""; //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : ""; //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : ""; //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : ""; //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : ""; //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : ""; //Generic Site Values string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : ""; string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : ""; string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : ""; string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : ""; //Page specific values string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : ""; FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image"); string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : ""; string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : ""; string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : ""; string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : ""; string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : ""; FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image"); string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : ""; if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"])) { if (!string.IsNullOrEmpty(Model.Description)) { Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{Model.Description}\" />"); } else { Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{openGraphDescription}\" />"); } if (!string.IsNullOrEmpty(Pageview.Page.TopImage)) { Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}\" />"); Pageview.Meta.AddTag($"<meta property=\"og:image:secure_url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}\" />"); } else if (openGraphImage != null) { Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />"); Pageview.Meta.AddTag($"<meta property=\"og:image:secure_url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />"); } if (!string.IsNullOrEmpty(openGraphImageALT)) { Pageview.Meta.AddTag($"<meta property=\"og:image:alt\" content=\"{openGraphImageALT}\"/>"); } if (!string.IsNullOrEmpty(twitterCardDescription)) { Pageview.Meta.AddTag("twitter:description", twitterCardDescription); } if (!string.IsNullOrEmpty(Pageview.Page.TopImage)) { Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}"); } else if (twitterCardImage != null) { Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}"); } if (!string.IsNullOrEmpty(twitterCardImageALT)) { Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT); } } if (!string.IsNullOrEmpty(siteVerificationGoogle)) { Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle); } if (!string.IsNullOrEmpty(openGraphFacebookAppID)) { Pageview.Meta.AddTag($"<meta property=\"fb:app_id\" content=\"{openGraphFacebookAppID}\" />"); } if (!string.IsNullOrEmpty(openGraphType)) { Pageview.Meta.AddTag($"<meta property=\"og:type\" content=\"{openGraphType}\" />"); } if (!string.IsNullOrEmpty(openGraphSiteName)) { Pageview.Meta.AddTag($"<meta property=\"og:url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{Pageview.SearchFriendlyUrl}\" />"); } if (!string.IsNullOrEmpty(openGraphSiteName)) { Pageview.Meta.AddTag($"<meta property=\"og:site_name\" content=\"{openGraphSiteName}\" />"); } if (!string.IsNullOrEmpty(Model.Title)) { Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{Model.Title}\"/>"); } else { Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{openGraphSiteTitle}\" />"); } if (!string.IsNullOrEmpty(twitterCardSite)) { Pageview.Meta.AddTag("twitter:site", twitterCardSite); } if (!string.IsNullOrEmpty(twitterCardURL)) { Pageview.Meta.AddTag("twitter:url", twitterCardURL); } if (!string.IsNullOrEmpty(twitterCardTitle)) { Pageview.Meta.AddTag("twitter:title", twitterCardTitle); } } }