Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
at Dynamicweb.Data.Database.CreateConnection()
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductById(String productId, String productVariantId, String productLanguageId)
at Dynamicweb.Ecommerce.Products.ProductService.FetchMissingProductsInternal(IProductRepository repo, IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, User user, Boolean showUntranslated)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, Boolean useAssortments)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId)
at CompiledRazorTemplates.Dynamic.RazorEngine_c2a5011d67964d3580ba7e60ad09d327.Execute() in D:\dynamicweb.net\Solutions\danitech.live\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 341
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()
ClientConnectionId:332a62da-6456-444d-bfda-97ffd13c67ce
Error Number:258,State:0,Class:20
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.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
26 var themesParagraphLastChanged = Dynamicweb.Content.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 googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
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
203
204 if (disableWideBreakpoints != "disableUltraWideOnly")
205 {
206 <style>
207 @@media ( min-width: 1920px ) {
208 .container-xxl,
209 .container-xl,
210 .container-lg,
211 .container-md,
212 .container-sm,
213 .container {
214 max-width: 1820px;
215 }
216 }
217 </style>
218 }
219 }
220
221 @* Branding and Themes min stylesheet *@
222 <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">
223 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
224 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
225
226 <script type="module">
227 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
228 swift.Scroll.hideHeadersOnScroll();
229 swift.Scroll.handleAlternativeTheme();
230 </script>
231
232 @* Google tag manager *@
233 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
234 {
235 <script>
236 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
237 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
238 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
239 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
240 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
241
242 function gtag() { dataLayer.push(arguments); }
243 </script>
244 }
245
246 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
247 {
248 var GoogleAnalyticsDebugMode = "";
249 bool isLoggedInBackendUser = false;
250
251 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
252 {
253 isLoggedInBackendUser = true;
254 }
255
256 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
257 {
258 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
259 }
260
261 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
262 <script>
263 window.dataLayer = window.dataLayer || [];
264 function gtag() { dataLayer.push(arguments); }
265 gtag('js', new Date());
266 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
267 </script>
268 }
269
270 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
271 {
272 @RenderPartial($"Components/Custom/{customHeaderInclude}")
273 }
274 </head>
275 <body class="brand @(masterTheme)" id="page@(Model.ID)">
276
277 @* Google tag manager *@
278 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
279 {
280 <noscript>
281 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
282 height="0" width="0" style="display:none;visibility:hidden"></iframe>
283 </noscript>
284 }
285
286 @if (renderAsResponsive || !renderMobile)
287 {
288 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
289 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
290 {
291 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
292 }
293 </header>
294 }
295
296 @if ((renderAsResponsive || renderMobile))
297 {
298 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
299 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
300 {
301 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
302 }
303 </header>
304 }
305
306 <main id="content" @(schemaOrgType)>
307 <div data-intersect></div>
308 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
309 @using System
310 @using Dynamicweb.Ecommerce.ProductCatalog
311
312
313 @{
314 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
315 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
316
317 bool isArticlePagePage = Model.ItemType == "Swift_Article";
318 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
319 string schemaOrgProp = string.Empty;
320 if(isArticlePagePage)
321 {
322 schemaOrgProp = "itemprop=\"articleBody\"";
323 }
324
325 string theme = "";
326 string gridContent = "";
327
328 if (Model.PropertyItem != null)
329 {
330 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
331 }
332
333 if (Model.Item != null || Pageview.IsVisualEditorMode)
334 {
335 if (!isProductDetail)
336 {
337 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
338 }
339 else
340 {
341 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
342 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
343 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
344
345 @RenderGrid(detailPageId)
346 }
347 }
348
349 bool doNotRenderPage = false;
350
351 //Check if we are on the poduct detail page, and if there is data to render
352 ProductViewModel product = new ProductViewModel();
353 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
354 {
355 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
356 if (string.IsNullOrEmpty(product.Id)) {
357 doNotRenderPage = true;
358 }
359 }
360
361 //Render the page
362 if (!doNotRenderPage) {
363 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
364
365
366 <div class="@theme @itemIdentifier" @schemaOrgProp>
367 @if (isArticleListPage)
368 {
369 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\"";
370
371 <form @hx id="ArticleFacetForm">
372 @gridContent
373 </form>
374 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
375 <script type="module">
376 document.addEventListener('htmx:confirm', (event) => {
377 let filters = event.detail.elt.querySelectorAll('select');
378 for (var i = 0; i < filters.length; i++) {
379 let input = filters[i];
380 if (input.name && !input.value) {
381 input.name = '';
382 }
383 }
384 });
385
386 document.addEventListener('htmx:beforeOnLoad', (event) => {
387 swift.Scroll.stopIntersectionObserver();
388 });
389
390 document.addEventListener('htmx:afterOnLoad', () => {
391 swift.Scroll.hideHeadersOnScroll();
392 swift.Scroll.handleAlternativeTheme();
393 });
394 </script>
395 }
396 else
397 {
398 @gridContent
399 }
400 </div>
401
402 } else {
403 <div class="container">
404 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
405 </div>
406 }
407
408 if (!Model.IsCurrentUserAllowed)
409 {
410 int signInPage = GetPageIdByNavigationTag("SignInPage");
411 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
412
413 if (!Pageview.IsVisualEditorMode)
414 {
415 if (signInPage != 0)
416 {
417 if (signInPage != Model.ID) {
418 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
419 } else {
420 if (dashboardPage != 0) {
421 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
422 } else {
423 Dynamicweb.Context.Current.Response.Redirect("/");
424 }
425 }
426 }
427 else
428 {
429 <div class="alert alert-dark m-0" role="alert">
430 <span>@Translate("You do not have access to this page")</span>
431 </div>
432 }
433 }
434 else
435 {
436 <div class="alert alert-dark m-0" role="alert">
437 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
438 </div>
439 }
440 }
441 }
442
443 </main>
444
445 @if (renderAsResponsive || !renderMobile)
446 {
447 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
448 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
449 {
450 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
451 }
452 </footer>
453 }
454
455 @if (renderAsResponsive || renderMobile)
456 {
457 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
458 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
459 {
460 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
461 }
462 </footer>
463 }
464
465 @* Render any offcanvas menu here *@
466 @RenderSnippet("offcanvas")
467
468 @{
469 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
470 }
471
472 @* Language selector modal *@
473 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
474 {
475 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
476 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
477 @* The content here comes from an external request *@
478 </div>
479 </div>
480 }
481
482 @* Favorite toast *@
483 <div aria-live="polite" aria-atomic="true">
484 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
485 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
486 <div class="toast-header">
487 <strong class="me-auto">@Translate("Favorite list updated")</strong>
488 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
489 </div>
490 <div class="toast-body d-flex gap-3">
491 <div id="favoriteNotificationToast_Image"></div>
492 <div id="favoriteNotificationToast_Text"></div>
493 </div>
494 </div>
495 </div>
496 </div>
497
498 @* Modal for dynamic content *@
499 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
500 <div class="modal-dialog modal-dialog-centered modal-md">
501 <div class="modal-content theme light" id="DynamicModalContent">
502 @* The content here comes from an external request *@
503 </div>
504 </div>
505 </div>
506
507 @* Offcanvas for dynamic content *@
508 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
509 @* The content here comes from an external request *@
510 </div>
511
512 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
513 {
514 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
515
516 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
517 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
518 <div class="toast-header">
519 <strong class="me-auto">@Translate("Connection down")</strong>
520 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
521 </div>
522 <div class="toast-body">
523 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
524 </div>
525 </div>
526 </div>
527 }
528 </body>
529 </html>
530 @functions {
531 void SetMetaTags()
532 {
533 //Verification Tokens
534 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
535 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
536 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
537 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
538 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
539 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
540
541 //Generic Site Values
542 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
543 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
544 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
545
546 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
547
548 //Page specific values
549 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
550 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
551 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
552 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
553
554 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
555 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
556 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
557 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
558 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
559
560 if (!string.IsNullOrEmpty(siteVerificationGoogle))
561 {
562 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
563 }
564
565 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
566 {
567 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
568 }
569
570 if (!string.IsNullOrEmpty(openGraphType))
571 {
572 Pageview.Meta.AddTag("og:type", openGraphType);
573 }
574
575 if (!string.IsNullOrEmpty(openGraphSiteName))
576 {
577 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
578 }
579
580 if (!string.IsNullOrEmpty(Model.Title))
581 {
582 Pageview.Meta.AddTag("og:title", Model.Title);
583 }
584 else
585 {
586 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
587 }
588
589 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
590 {
591 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
592 }
593
594 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
595 {
596 if (!string.IsNullOrEmpty(Model.Description))
597 {
598 Pageview.Meta.AddTag("og:description", Model.Description);
599 }
600 else
601 {
602 Pageview.Meta.AddTag("og:description", openGraphDescription);
603 }
604 if (openGraphImage != null)
605 {
606 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
607 }
608
609 if (!string.IsNullOrEmpty(openGraphImageALT))
610 {
611 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
612 }
613 if (!string.IsNullOrEmpty(twitterCardDescription))
614 {
615 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
616 }
617
618 if (twitterCardImage != null)
619 {
620 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
621 }
622
623 if (!string.IsNullOrEmpty(twitterCardImageALT))
624 {
625 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
626 }
627 }
628
629 if (!string.IsNullOrEmpty(twitterCardSite))
630 {
631 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
632 }
633
634 if (!string.IsNullOrEmpty(twitterCardURL))
635 {
636 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
637 }
638
639 if (!string.IsNullOrEmpty(twitterCardTitle))
640 {
641 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
642 }
643 }
644 }
645