Error executing template "Designs/Swift/_parsed/Swift_Page_Custom.parsed.cshtml"
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at Dynamicweb.Frontend.ContentViewModelFactory.CreateItemFieldViewModel(ItemField field, Item item)
at Dynamicweb.Frontend.ContentViewModelFactory.CreateItemViewModel(Item item, Page page, Paragraph paragraph)
at Dynamicweb.Frontend.ContentViewModelFactory.CreateGridRowViewModel(Layout layout, String gridId, GridRow row, IEnumerable`1 paragraphs, Func`2 contentRenderer)
at Dynamicweb.Frontend.ContentViewModelFactory.CreateGridViewModel(Layout layout, String gridId, IEnumerable`1 rows, IEnumerable`1 paragraphs, Func`2 contentRenderer)
at Dynamicweb.Frontend.Content.CreateGridContent(IEnumerable`1 gridRows, IEnumerable`1 paragraphs, Layout layout)
at Dynamicweb.Frontend.Content.CreateGridContent(Int32 contentId, Boolean ignoreVisualEdit)
at Dynamicweb.Frontend.Content.RenderExternalGrid(Int32 pageId, String container)
at CompiledRazorTemplates.Dynamic.RazorEngine_48029f4596594472a307c8f370576b81.Execute() in D:\dynamicweb.net\Solutions\Co3\flowconcept.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\_parsed\Swift_Page_Custom.parsed.cshtml:line 269
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 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();
100
101 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
102
103 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 }
128
129 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
132
133 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="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
143 <link rel="shortcut icon" href="@favicon">
144 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
145
146 @Model.MetaTags
147
148 @{
149 @* Languages meta data *@
150 foreach (var language in languages)
151 {
152 if (language?.Area != null)
153 {
154 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
155 {
156 if (!string.IsNullOrEmpty(language.Area.DomainLock))
157 {
158 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
159 }
160 string querystring = $"Default.aspx?ID={language.ID}";
161 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
162 {
163 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
164 }
165 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
166 {
167 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
168 }
169 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
170 {
171 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
172 }
173
174 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
175 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
176
177 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
178 }
179 }
180 }
181 }
182
183 <title>@Model.Title</title>
184 @* Bootstrap + Swift stylesheet *@
185 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
186
187 @if (disableWideBreakpoints != "disableBoth")
188 {
189 <style>
190 @@media ( min-width: 1600px ) {
191 .container-xxl,
192 .container-xl,
193 .container-lg,
194 .container-md,
195 .container-sm,
196 .container {
197 max-width: 1520px;
198 }
199 }
200 </style>
201
202 if (disableWideBreakpoints != "disableUltraWideOnly")
203 {
204 <style>
205 @@media ( min-width: 1920px ) {
206 .container-xxl,
207 .container-xl,
208 .container-lg,
209 .container-md,
210 .container-sm,
211 .container {
212 max-width: 1820px;
213 }
214 }
215 </style>
216 }
217 }
218
219 @* Branding and Themes min stylesheet *@
220 <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">
221 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
222 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
223
224 <script type="module">
225 AOS.init({ offset: 0, duration: 400, delay: 100, easing: 'ease-in-out', mirror: true, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
226 swift.Scroll.hideHeadersOnScroll();
227 swift.Scroll.handleAlternativeTheme();
228 </script>
229
230 @* Global site tag (gtag.js) - Google Analytics *@
231 @if (!string.IsNullOrWhiteSpace(googleAnalyticsTrackingID))
232 {
233 <script src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsTrackingID" async></script>
234 <script>
235 window.dataLayer = window.dataLayer || [];
236 function gtag() { window.dataLayer.push(arguments); }
237 gtag('js', new Date());
238 gtag('config', '@googleAnalyticsTrackingID');
239 </script>
240 }
241
242 @{
243 var GoogleAnalyticsDebugMode = "";
244 bool isLoggedInBackendUser = false;
245
246 if (Dynamicweb.Environment.ExecutingContext.IsAdminLoggedIn())
247 {
248 isLoggedInBackendUser = true;
249 }
250
251 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && @isLoggedInBackendUser)
252 {
253 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
254 }
255 }
256
257 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
258 {
259 @RenderPartial($"Components/Custom/{customHeaderInclude}")
260 }
261 </head>
262 <body class="brand @(masterTheme)" id="page@(Model.ID)">
263 <div class="container">
264 @if (renderAsResponsive || !renderMobile)
265 {
266 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
267 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
268 {
269 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
270 }
271 </header>
272 }
273
274 @if ((renderAsResponsive || renderMobile))
275 {
276 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
277 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
278 {
279 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
280 }
281 </header>
282 }
283
284 <main id="content" @(schemaOrgType)>
285 <div data-intersect></div>
286 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
287 @using System
288 @using Dynamicweb.Ecommerce.ProductCatalog
289
290
291 @{
292 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
293 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
294
295 bool isArticlePagePage = Model.ItemType == "Swift_Article";
296 string schemaOrgProp = string.Empty;
297 if(isArticlePagePage)
298 {
299 schemaOrgProp = "itemprop=\"articleBody\"";
300 }
301
302 string theme = "";
303 string gridContent = "";
304
305 if (Model.PropertyItem != null)
306 {
307 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? " theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
308 }
309
310 if (Model.Item != null || Pageview.IsVisualEditorMode)
311 {
312 if (!isProductDetail)
313 {
314 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
315 }
316 else
317 {
318 var productObject = Dynamicweb.Ecommerce.Products.Product.GetProductById(productIdFromUrl);
319 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
320 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
321
322 @RenderGrid(detailPageId)
323 }
324 }
325
326 bool doNotRenderPage = false;
327
328 //Check if we are on the poduct detail page, and if there is data to render
329 ProductViewModel product = new ProductViewModel();
330 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
331 {
332 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
333 if (string.IsNullOrEmpty(product.Id)) {
334 doNotRenderPage = true;
335 }
336 }
337
338 //Render the page
339 if (!doNotRenderPage) {
340 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
341
342 if (theme != "")
343 {
344 <div class="@theme item_@itemIdentifier" @schemaOrgProp>
345 @gridContent
346 </div>
347 }
348 else
349 {
350 <div class="item_@itemIdentifier" @schemaOrgProp>
351 @gridContent
352 </div>
353 }
354 } else {
355 <div class="container">
356 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
357 </div>
358 }
359
360 if (!Model.IsCurrentUserAllowed)
361 {
362 int signInPage = GetPageIdByNavigationTag("SignInPage");
363 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
364
365 if (!Pageview.IsVisualEditorMode)
366 {
367 if (signInPage != 0)
368 {
369 if (signInPage != Model.ID) {
370 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
371 } else {
372 if (dashboardPage != 0) {
373 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
374 } else {
375 Dynamicweb.Context.Current.Response.Redirect("/");
376 }
377 }
378 }
379 else
380 {
381 <div class="alert alert-dark m-0" role="alert">
382 <span>@Translate("You do not have access to this page")</span>
383 </div>
384 }
385 }
386 else
387 {
388 <div class="alert alert-dark m-0" role="alert">
389 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
390 </div>
391 }
392 }
393 }
394
395 </main>
396
397 @if (renderAsResponsive || !renderMobile)
398 {
399 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
400 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
401 {
402 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
403 }
404 </footer>
405 }
406
407 @if (renderAsResponsive || renderMobile)
408 {
409 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
410 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
411 {
412 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
413 }
414 </footer>
415 }
416
417 @* Render any offcanvas menu here *@
418 @RenderSnippet("offcanvas")
419
420 @{
421 bool isErpConnectionDown = !Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable();
422 }
423
424 @* Language selector modal *@
425 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
426 {
427 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
428 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
429 @* The content here comes from an external request *@
430 </div>
431 </div>
432 }
433
434 @* Favorite toast *@
435 <div aria-live="polite" aria-atomic="true">
436 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
437 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
438 <div class="toast-header">
439 <strong class="me-auto">@Translate("Favorite list updated")</strong>
440 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
441 </div>
442 <div class="toast-body d-flex gap-3">
443 <div id="favoriteNotificationToast_Image"></div>
444 <div id="favoriteNotificationToast_Text"></div>
445 </div>
446 </div>
447 </div>
448 </div>
449
450 @* Modal for dynamic content *@
451 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
452 <div class="modal-dialog modal-dialog-centered modal-md">
453 <div class="modal-content theme light" id="DynamicModalContent">
454 @* The content here comes from an external request *@
455 </div>
456 </div>
457 </div>
458
459 @* Offcanvas for dynamic content *@
460 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
461 @* The content here comes from an external request *@
462 </div>
463
464 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
465 {
466 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
467
468 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
469 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
470 <div class="toast-header">
471 <strong class="me-auto">@Translate("Connection down")</strong>
472 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
473 </div>
474 <div class="toast-body">
475 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
476 </div>
477 </div>
478 </div>
479 }
480 </div>
481 </body>
482 </html>
483 @functions {
484 void SetMetaTags()
485 {
486 //Verification Tokens
487 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
488 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
489 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
490 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
491 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
492 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
493
494 //Generic Site Values
495 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
496 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
497 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
498
499 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
500
501 //Page specific values
502 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
503 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
504 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
505 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
506
507 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
508 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
509 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
510 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
511 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
512
513 if (!string.IsNullOrEmpty(siteVerificationGoogle))
514 {
515 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
516 }
517
518 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
519 {
520 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
521 }
522
523 if (!string.IsNullOrEmpty(openGraphType))
524 {
525 Pageview.Meta.AddTag("og:type", openGraphType);
526 }
527
528 if (!string.IsNullOrEmpty(openGraphSiteName))
529 {
530 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
531 }
532
533 if (!string.IsNullOrEmpty(Model.Title))
534 {
535 Pageview.Meta.AddTag("og:title", Model.Title);
536 }
537 else
538 {
539 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
540 }
541
542 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
543 {
544 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
545 }
546
547 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
548 {
549 if (!string.IsNullOrEmpty(Model.Description))
550 {
551 Pageview.Meta.AddTag("og:description", Model.Description);
552 }
553 else
554 {
555 Pageview.Meta.AddTag("og:description", openGraphDescription);
556 }
557 if (openGraphImage != null)
558 {
559 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
560 }
561
562 if (!string.IsNullOrEmpty(openGraphImageALT))
563 {
564 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
565 }
566 if (!string.IsNullOrEmpty(twitterCardDescription))
567 {
568 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
569 }
570
571 if (twitterCardImage != null)
572 {
573 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
574 }
575
576 if (!string.IsNullOrEmpty(twitterCardImageALT))
577 {
578 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
579 }
580 }
581
582 if (!string.IsNullOrEmpty(twitterCardSite))
583 {
584 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
585 }
586
587 if (!string.IsNullOrEmpty(twitterCardURL))
588 {
589 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
590 }
591
592 if (!string.IsNullOrEmpty(twitterCardTitle))
593 {
594 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
595 }
596 }
597 }
598