Error compiling template "Designs/Swift-v2/Swift-v2_Page.cshtml"
Line 1: An assembly with the same simple name 'Dynamicweb.LoadBalancing' has already been imported. Try removing one of the references (e.g. 'F:\Domains\Sites\dev-jayco.mydwsite3.com\Application\bin\Dynamicweb.LoadBalancing.dll') or sign them to enable side-by-side.
Line 15: The using directive for 'System' appeared previously in this namespace
Line 16: The using directive for 'Dynamicweb.Frontend' appeared previously in this namespace
Line 17: The using directive for 'Dynamicweb.Frontend.Devices' appeared previously in this namespace
Line 29: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 37: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 42: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 51: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 55: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 58: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 68: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 81: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 89: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 107: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 194: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System.Collections.Generic; 8 using System.Linq; 9 using System; 10 using Dynamicweb; 11 using Dynamicweb.Environment; 12 using Dynamicweb.Frontend; 13 using Dynamicweb.Frontend.Devices; 14 using Dynamicweb.Rendering; 15 using System; 16 using Dynamicweb.Frontend; 17 using Dynamicweb.Frontend.Devices; 18 using Dynamicweb.Ecommerce.ProductCatalog; 19 using Dynamicweb.Ecommerce.Products; 20 internal class RazorEngine_74efb65838a140b3bb077132ef10409d : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 21 { 22 #pragma warning disable 1998 23 public async override global::System.Threading.Tasks.Task ExecuteAsync() 24 { 25 WriteLiteral("\r\n"); 26 27 Pageview.Meta.AddTag("fb:app_id", Model.Area?.Item?.GetString("FacebookAppId")); 28 Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification")); 29 Pageview.Meta.AddTag("site_name", Model.Area?.Item?.TryGetString("MetaSiteName", out string? siteName) is true ? siteName : Model.Area?.Name); 30 Pageview.Meta.AddTag("url", Pageview.Meta.Canonical?.ToString()); 31 Pageview.Meta.AddTag("twitter:site", Model.Area?.Item?.GetString("TwitterSite")); 32 Pageview.Meta.AddOpenGraphTag("type", "website"); 33 Pageview.Meta.AddOpenGraphTag("url", Pageview.Meta.Canonical?.ToString()); 34 Pageview.Meta.AddOpenGraphTag("title", Model.Title); 35 Pageview.Meta.AddOpenGraphTag("description", Model.Description); 36 37 if (Model.Area?.Item?.TryGetImageFile("MetaImage", out ImageFileViewModel? image) ?? false) { 38 Pageview.Meta.AddOpenGraphTag("image", image.Path); 39 Pageview.Meta.AddOpenGraphTag("image:alt", Model.Area?.Item?.GetString("MetaImageALT")); 40 } 41 42 string? googleTagManagerID = string.Empty; 43 if (Model.Area?.Item?.TryGetString("GoogleTagManagerID", out googleTagManagerID) ?? false) 44 { 45 googleTagManagerID = googleTagManagerID.Trim(); 46 } 47 48 49 AddStylesheet("/Files/Templates/Designs/Swift-v2/Assets/css/swift.css"); 50 51 if (Model.TryGetColorSchemeStyle(out string? colorSchemeStyle)) 52 { 53 AddStylesheet(colorSchemeStyle); 54 } 55 if (Model.TryGetButtonStyle(out string? buttonStyle)) { 56 AddStylesheet(buttonStyle); 57 } 58 if (Model.TryGetTypographyStyle(out string? typographyStyle)) { 59 AddStylesheet(typographyStyle); 60 } 61 62 63 AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js"); 64 AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/htmx.org/dist/htmx.min.js"); 65 AddScript("/Files/Templates/Designs/Swift-v2/Assets/js/swift.js"); 66 67 68 if (Model.Area?.Item?.TryGetFile("CustomHeadInclude", out FileViewModel? customHeadInclude) ?? false) 69 { 70 Write(RenderPartial($"Designs/Swift-v2/Custom/{customHeadInclude?.Name}")); 71 72 } 73 WriteLiteral("\r\n<!doctype html>\r\n<html"); 74 BeginWriteAttribute("lang", " lang=\"", 2606, "\"", 2664, 1); 75 WriteAttributeValue("", 2613, Pageview.Area.CultureInfo.TwoLetterISOLanguageName, 2613, 51, false); 76 EndWriteAttribute(); 77 WriteLiteral(" data-swift-version=\""); 78 Write(ReadFile("/Files/Templates/Designs/Swift-v2/swift_version.txt")?.Trim()); 79 WriteLiteral("\">\r\n <head>\r\n"); 80 WriteLiteral(" <meta charset=\"utf-8\">\r\n <meta name=\"viewport\" content=\"height=device-height, width=device-width, initial-scale=1.0\">\r\n\r\n"); 81 if (Model.Area?.Item?.TryGetImageFile("Favicon", out ImageFileViewModel? faviconImage) ?? false) 82 { 83 WriteLiteral(" <link rel=\"shortcut icon\""); 84 BeginWriteAttribute("href", " href=\"", 3101, "\"", 3127, 1); 85 WriteAttributeValue("", 3108, faviconImage?.Path, 3108, 19, false); 86 EndWriteAttribute(); 87 WriteLiteral(">\r\n"); 88 } 89 if (Model.Area?.Item?.TryGetImageFile("AppleTouchIcon", out ImageFileViewModel? appleTouchIconImage) ?? false) 90 { 91 WriteLiteral(" <link rel=\"apple-touch-icon\""); 92 BeginWriteAttribute("href", " href=\"", 3314, "\"", 3347, 1); 93 WriteAttributeValue("", 3321, appleTouchIconImage?.Path, 3321, 26, false); 94 EndWriteAttribute(); 95 WriteLiteral(">\r\n"); 96 } 97 98 WriteLiteral(" <title>"); 99 Write(Model.Title); 100 WriteLiteral("</title>\r\n \r\n"); 101 WriteLiteral(" "); 102 Write(Model.MetaTags); 103 WriteLiteral("\r\n \r\n"); 104 WriteLiteral(" "); 105 Write(Model.GetStylesheetsMarkup()); 106 WriteLiteral("\r\n \r\n"); 107 if(Model.Area?.Item?.TryGetString("MediaQueryLimit", out string? mediaQueryLimit) ?? false) { 108 WriteLiteral(" <style>\r\n "); 109 WriteLiteral("@media screen and (min-width: "); 110 Write(mediaQueryLimit); 111 WriteLiteral("px) {\r\n [data-swift-container] {\r\n --dw-container-limit: "); 112 Write(mediaQueryLimit); 113 WriteLiteral(@"px; 114 } 115 116 [data-swift-container], 117 [data-dw-container-width=""3""] { 118 --dw-container-width: calc(var(--dw-container-limit) * .8); 119 } 120 121 [data-dw-container-width=""1""] { 122 --dw-container-width: var(--swift-text-width); 123 } 124 125 [data-dw-container-width=""2""] { 126 --dw-container-width: calc(var(--dw-container-limit) * .65); 127 } 128 } 129 </style> 130 "); 131 } 132 133 WriteLiteral(" "); 134 Write(Model.GetScriptsMarkup()); 135 WriteLiteral("\r\n \r\n"); 136 WriteLiteral(" <script>\r\n window.dataLayer = window.dataLayer || [];\r\n function gtag() { dataLayer.push(arguments); }\r\n </script>\r\n"); 137 if (!string.IsNullOrWhiteSpace(googleTagManagerID)) 138 { 139 WriteLiteral(@" <script> 140 gtag('consent', 'default', { 141 'ad_storage': 'denied', 142 'ad_user_data': 'denied', 143 'ad_personalization': 'denied', 144 'analytics_storage': 'denied' 145 }); 146 </script> 147 <script> 148 (function (w, d, s, l, i) { 149 w[l] = w[l] || []; w[l].push({ 150 'gtm.start': 151 new Date().getTime(), event: 'gtm.js' 152 }); var f = d.getElementsByTagName(s)[0], 153 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 154 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 155 })(window, document, 'script', 'dataLayer', '"); 156 Write(googleTagManagerID); 157 WriteLiteral("\');\r\n </script>\r\n"); 158 if (AllowTracking()) 159 { 160 WriteLiteral(" <script>\r\n gtag(\'consent\', \'update\', {\r\n \'ad_storage\': \'"); 161 Write(CookieManager.IsCookieOptInGranted("Marketing")); 162 WriteLiteral("\',\r\n \'ad_user_data\': \'"); 163 Write(CookieManager.IsCookieOptInGranted("Marketing")); 164 WriteLiteral("\',\r\n \'ad_personalization\': \'"); 165 Write(CookieManager.IsCookieOptInGranted("Marketing")); 166 WriteLiteral("\',\r\n \'analytics_storage\': \'"); 167 Write(CookieManager.IsCookieOptInGranted("Statistical")); 168 WriteLiteral("\'\r\n });\r\n </script>\r\n"); 169 } 170 } 171 WriteLiteral(" </head>\r\n <body data-dw-page-id=\""); 172 Write(Model.ID); 173 WriteLiteral("\" data-dw-itemtype=\""); 174 Write(Model.Item?.SystemName?.ToLower()); 175 WriteLiteral("\">\r\n \r\n"); 176 if (!string.IsNullOrWhiteSpace(googleTagManagerID) && AllowTracking()) 177 { 178 WriteLiteral(" <noscript>\r\n <iframe"); 179 BeginWriteAttribute("src", " src=\"", 6777, "\"", 6848, 2); 180 WriteAttributeValue("", 6783, "https://www.googletagmanager.com/ns.html?id=", 6783, 44, true); 181 WriteAttributeValue("", 6827, googleTagManagerID, 6827, 21, false); 182 EndWriteAttribute(); 183 WriteLiteral(" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>\r\n </noscript>\r\n"); 184 } 185 WriteLiteral("\r\n"); 186 WriteLiteral("\r\n\r\n"); 187 188 bool isContentOnly = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current?.Request.QueryString.Get("ContentOnly") ?? "false"); 189 // Page headers 190 LinkViewModel headerLink; 191 if (!isContentOnly && ((Pageview.Device == DeviceType.Desktop && (Model.Area?.Item?.TryGetLink("HeaderDesktop", out headerLink) ?? false)) || 192 !isContentOnly && (Pageview.Device == DeviceType.Mobile || Pageview.Device == DeviceType.Tablet) && (Model.Area?.Item?.TryGetLink("HeaderMobile", out headerLink) ?? false))) 193 { 194 string? headerCss = null; 195 var headerPage = ContentViewModelFactory.CreatePageInfoViewModel(Dynamicweb.Content.Services.Pages.GetPage(headerLink.PageId)); 196 if ((headerPage.Item?.TryGetString("HeaderPosition", out string headerPosition) ?? false) && !headerPosition.Equals("static", StringComparison.OrdinalIgnoreCase)) 197 { 198 headerCss = headerPosition; 199 } 200 WriteLiteral(" <header data-swift-page-header=\""); 201 Write(headerLink.PageId); 202 WriteLiteral("\""); 203 BeginWriteAttribute("class", " class=\"", 8216, "\"", 8234, 1); 204 WriteAttributeValue("", 8224, headerCss, 8224, 10, false); 205 EndWriteAttribute(); 206 WriteLiteral(" data-dw-colorscheme=\""); 207 Write(headerPage.ColorScheme?.Id); 208 WriteLiteral("\">\r\n "); 209 Write(RenderGrid(headerLink.PageId)); 210 WriteLiteral("\r\n </header>\r\n"); 211 } 212 WriteLiteral("\r\n<main id=\"content\" data-dw-colorscheme=\""); 213 Write(Model.ColorScheme?.Id ?? Model.Area?.ColorScheme?.Id); 214 WriteLiteral("\">\r\n \r\n "); 215 Write(Model.Grid("Grid", "Grid", "default:true;sort:1", "Page")); 216 WriteLiteral("\r\n \r\n</main>\r\n\r\n"); 217 // Page footers 218 LinkViewModel footerLink; 219 if (!isContentOnly && ((Pageview.Device == DeviceType.Desktop) && (Model.Area?.Item?.TryGetLink("FooterDesktop", out footerLink) ?? false)) || 220 !isContentOnly && ((Pageview.Device == DeviceType.Mobile || Pageview.Device == DeviceType.Tablet) && (Model.Area?.Item?.TryGetLink("FooterMobile", out footerLink) ?? false))) 221 { 222 var footerPage = ContentViewModelFactory.CreatePageInfoViewModel(Dynamicweb.Content.Services.Pages.GetPage(footerLink.PageId)); 223 WriteLiteral(" <footer data-swift-page-footer=\""); 224 Write(footerLink.PageId); 225 WriteLiteral("\" data-dw-colorscheme=\""); 226 Write(footerPage.ColorScheme?.Id); 227 WriteLiteral("\">\r\n "); 228 Write(RenderGrid(footerLink.PageId)); 229 WriteLiteral("\r\n </footer>\r\n"); 230 } 231 WriteLiteral("\r\n"); 232 if (isContentOnly) 233 { 234 return; 235 } 236 237 WriteLiteral(@"<div aria-live=""polite"" aria-atomic=""true""> 238 <div class=""position-fixed bottom-0 end-0 p-3"" style=""z-index: 11""> 239 <div id=""favoriteNotificationToast"" class=""toast"" role=""alert"" aria-live=""assertive"" aria-atomic=""true""> 240 <div class=""toast-header""> 241 <strong class=""me-auto"">"); 242 Write(Translate("Favorite list updated")); 243 WriteLiteral(@"</strong> 244 <button type=""button"" class=""btn-close"" data-bs-dismiss=""toast"" aria-label=""Close""></button> 245 </div> 246 <div class=""toast-body d-flex gap-3""> 247 <div id=""favoriteNotificationToast_Image""></div> 248 <div id=""favoriteNotificationToast_Text""></div> 249 </div> 250 </div> 251 </div> 252 </div> 253 254 "); 255 WriteLiteral("<div class=\"modal fade js-product\" id=\"DynamicModal\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <div class=\"modal-dialog modal-dialog-centered modal-md\">\r\n <div class=\"modal-content\" id=\"DynamicModalContent\">\r\n"); 256 WriteLiteral(" </div>\r\n </div>\r\n</div>\r\n\r\n"); 257 WriteLiteral("<div class=\"offcanvas offcanvas-end\" tabindex=\"-1\" id=\"DynamicOffcanvas\">\r\n"); 258 WriteLiteral("</div>\r\n \r\n\t</body>\r\n\r\n</html>\r\n\r\n"); 259 } 260 #pragma warning restore 1998 261 262 bool AllowTracking() 263 { 264 bool allowTracking = true; 265 if (CookieManager.IsCookieManagementActive) 266 { 267 var cookieOptInLevel = CookieManager.GetCookieOptInLevel(); 268 var cookieOptInCategories = CookieManager.GetCookieOptInCategories(); 269 bool consentEither = (cookieOptInCategories.Contains("Statistical") || cookieOptInCategories.Contains("Marketing")); 270 bool consentFunctional = cookieOptInLevel == CookieOptInLevel.Functional; 271 bool consentAtLeastOne = cookieOptInLevel == CookieOptInLevel.All || (consentFunctional && consentEither); 272 allowTracking = consentAtLeastOne; 273 } 274 return allowTracking; 275 } 276 } 277 } 278 #pragma warning restore 1591 279

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 @using System 3 @using Dynamicweb 4 @using Dynamicweb.Environment 5 @using Dynamicweb.Frontend 6 @using Dynamicweb.Frontend.Devices 7 @using Dynamicweb.Rendering 8 9 @{ 10 Pageview.Meta.AddTag("fb:app_id", Model.Area?.Item?.GetString("FacebookAppId")); 11 Pageview.Meta.AddTag("google-site-verification", Model.Area?.Item?.GetString("GoogleSiteVerification")); 12 Pageview.Meta.AddTag("site_name", Model.Area?.Item?.TryGetString("MetaSiteName", out string? siteName) is true ? siteName : Model.Area?.Name); 13 Pageview.Meta.AddTag("url", Pageview.Meta.Canonical?.ToString()); 14 Pageview.Meta.AddTag("twitter:site", Model.Area?.Item?.GetString("TwitterSite")); 15 Pageview.Meta.AddOpenGraphTag("type", "website"); 16 Pageview.Meta.AddOpenGraphTag("url", Pageview.Meta.Canonical?.ToString()); 17 Pageview.Meta.AddOpenGraphTag("title", Model.Title); 18 Pageview.Meta.AddOpenGraphTag("description", Model.Description); 19 20 if (Model.Area?.Item?.TryGetImageFile("MetaImage", out ImageFileViewModel? image) ?? false) { 21 Pageview.Meta.AddOpenGraphTag("image", image.Path); 22 Pageview.Meta.AddOpenGraphTag("image:alt", Model.Area?.Item?.GetString("MetaImageALT")); 23 } 24 25 string? googleTagManagerID = string.Empty; 26 if (Model.Area?.Item?.TryGetString("GoogleTagManagerID", out googleTagManagerID) ?? false) 27 { 28 googleTagManagerID = googleTagManagerID.Trim(); 29 } 30 31 @* Stylesheets *@ 32 AddStylesheet("/Files/Templates/Designs/Swift-v2/Assets/css/swift.css"); 33 34 @* Color schemes stylesheet *@ 35 @if (Model.TryGetColorSchemeStyle(out string? colorSchemeStyle)) 36 { 37 AddStylesheet(colorSchemeStyle); 38 } 39 @* Button stylesheet *@ 40 @if (Model.TryGetButtonStyle(out string? buttonStyle)) { 41 AddStylesheet(buttonStyle); 42 } 43 @* Typography stylesheet *@ 44 @if (Model.TryGetTypographyStyle(out string? typographyStyle)) { 45 AddStylesheet(typographyStyle); 46 } 47 48 @* Scripts *@ 49 AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js"); 50 AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/htmx.org/dist/htmx.min.js"); 51 AddScript("/Files/Templates/Designs/Swift-v2/Assets/js/swift.js"); 52 53 @* Custom <head> include *@ 54 if (Model.Area?.Item?.TryGetFile("CustomHeadInclude", out FileViewModel? customHeadInclude) ?? false) 55 { 56 @RenderPartial($"Designs/Swift-v2/Custom/{customHeadInclude?.Name}") 57 } 58 } 59 60 <!doctype html> 61 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName" data-swift-version="@(ReadFile("/Files/Templates/Designs/Swift-v2/swift_version.txt")?.Trim())"> 62 <head> 63 @* Required meta tags *@ 64 <meta charset="utf-8"> 65 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0"> 66 67 @if (Model.Area?.Item?.TryGetImageFile("Favicon", out ImageFileViewModel? faviconImage) ?? false) 68 { 69 <link rel="shortcut icon" href="@faviconImage?.Path"> 70 } 71 @if (Model.Area?.Item?.TryGetImageFile("AppleTouchIcon", out ImageFileViewModel? appleTouchIconImage) ?? false) 72 { 73 <link rel="apple-touch-icon" href="@appleTouchIconImage?.Path"> 74 } 75 76 @* Pageview Meta *@ 77 <title>@Model.Title</title> 78 79 @* MetaTags *@ 80 @Model.MetaTags 81 82 @* Get stylesheets *@ 83 @Model.GetStylesheetsMarkup() 84 85 @* Media Query Limit *@ 86 @if(Model.Area?.Item?.TryGetString("MediaQueryLimit", out string? mediaQueryLimit) ?? false) { 87 <style> 88 @@media screen and (min-width: @(mediaQueryLimit)px) { 89 [data-swift-container] { 90 --dw-container-limit: @(mediaQueryLimit)px; 91 } 92 93 [data-swift-container], 94 [data-dw-container-width="3"] { 95 --dw-container-width: calc(var(--dw-container-limit) * .8); 96 } 97 98 [data-dw-container-width="1"] { 99 --dw-container-width: var(--swift-text-width); 100 } 101 102 [data-dw-container-width="2"] { 103 --dw-container-width: calc(var(--dw-container-limit) * .65); 104 } 105 } 106 </style> 107 } 108 109 @* Get scripts *@ 110 @Model.GetScriptsMarkup() 111 112 @* Google gtag method - always include even if it is not used for anything *@ 113 <script> 114 window.dataLayer = window.dataLayer || []; 115 function gtag() { dataLayer.push(arguments); } 116 </script> 117 @* Google tag manager *@ 118 @if (!string.IsNullOrWhiteSpace(googleTagManagerID)) 119 { 120 <script> 121 gtag('consent', 'default', { 122 'ad_storage': 'denied', 123 'ad_user_data': 'denied', 124 'ad_personalization': 'denied', 125 'analytics_storage': 'denied' 126 }); 127 </script> 128 <script> 129 (function (w, d, s, l, i) { 130 w[l] = w[l] || []; w[l].push({ 131 'gtm.start': 132 new Date().getTime(), event: 'gtm.js' 133 }); var f = d.getElementsByTagName(s)[0], 134 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 135 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 136 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)'); 137 </script> 138 if (AllowTracking()) 139 { 140 <script> 141 gtag('consent', 'update', { 142 'ad_storage': '@CookieManager.IsCookieOptInGranted("Marketing")', 143 'ad_user_data': '@CookieManager.IsCookieOptInGranted("Marketing")', 144 'ad_personalization': '@CookieManager.IsCookieOptInGranted("Marketing")', 145 'analytics_storage': '@CookieManager.IsCookieOptInGranted("Statistical")' 146 }); 147 </script> 148 } 149 } 150 </head> 151 <body data-dw-page-id="@(Model.ID)" data-dw-itemtype="@Model.Item?.SystemName?.ToLower()"> 152 153 @* Google tag manager *@ 154 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && AllowTracking()) 155 { 156 <noscript> 157 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)" height="0" width="0" style="display:none;visibility:hidden"></iframe> 158 </noscript> 159 } 160 161 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 162 @using System 163 @using Dynamicweb.Frontend 164 @using Dynamicweb.Frontend.Devices 165 @using Dynamicweb.Ecommerce.ProductCatalog 166 @using Dynamicweb.Ecommerce.Products 167 168 169 @{ 170 bool isContentOnly = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current?.Request.QueryString.Get("ContentOnly") ?? "false"); 171 // Page headers 172 LinkViewModel headerLink; 173 if (!isContentOnly && ((Pageview.Device == DeviceType.Desktop && (Model.Area?.Item?.TryGetLink("HeaderDesktop", out headerLink) ?? false)) || 174 !isContentOnly && (Pageview.Device == DeviceType.Mobile || Pageview.Device == DeviceType.Tablet) && (Model.Area?.Item?.TryGetLink("HeaderMobile", out headerLink) ?? false))) 175 { 176 string? headerCss = null; 177 var headerPage = ContentViewModelFactory.CreatePageInfoViewModel(Dynamicweb.Content.Services.Pages.GetPage(headerLink.PageId)); 178 if ((headerPage.Item?.TryGetString("HeaderPosition", out string headerPosition) ?? false) && !headerPosition.Equals("static", StringComparison.OrdinalIgnoreCase)) 179 { 180 headerCss = headerPosition; 181 } 182 <header data-swift-page-header="@(headerLink.PageId)" class="@headerCss" data-dw-colorscheme="@headerPage.ColorScheme?.Id"> 183 @RenderGrid(headerLink.PageId) 184 </header> 185 } 186 } 187 188 <main id="content" data-dw-colorscheme="@(Model.ColorScheme?.Id ?? Model.Area?.ColorScheme?.Id)"> 189 190 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Page") 191 192 </main> 193 194 @{ // Page footers 195 LinkViewModel footerLink; 196 if (!isContentOnly && ((Pageview.Device == DeviceType.Desktop) && (Model.Area?.Item?.TryGetLink("FooterDesktop", out footerLink) ?? false)) || 197 !isContentOnly && ((Pageview.Device == DeviceType.Mobile || Pageview.Device == DeviceType.Tablet) && (Model.Area?.Item?.TryGetLink("FooterMobile", out footerLink) ?? false))) 198 { 199 var footerPage = ContentViewModelFactory.CreatePageInfoViewModel(Dynamicweb.Content.Services.Pages.GetPage(footerLink.PageId)); 200 <footer data-swift-page-footer="@(footerLink.PageId)" data-dw-colorscheme="@footerPage.ColorScheme?.Id"> 201 @RenderGrid(footerLink.PageId) 202 </footer> 203 } 204 } 205 206 @if (isContentOnly) 207 { 208 return; 209 } 210 211 @* Favorite toast *@ 212 <div aria-live="polite" aria-atomic="true"> 213 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11"> 214 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true"> 215 <div class="toast-header"> 216 <strong class="me-auto">@Translate("Favorite list updated")</strong> 217 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> 218 </div> 219 <div class="toast-body d-flex gap-3"> 220 <div id="favoriteNotificationToast_Image"></div> 221 <div id="favoriteNotificationToast_Text"></div> 222 </div> 223 </div> 224 </div> 225 </div> 226 227 @* Modal for dynamic content *@ 228 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true"> 229 <div class="modal-dialog modal-dialog-centered modal-md"> 230 <div class="modal-content" id="DynamicModalContent"> 231 @* The content here comes from an external request *@ 232 </div> 233 </div> 234 </div> 235 236 @* Offcanvas for dynamic content *@ 237 <div class="offcanvas offcanvas-end" tabindex="-1" id="DynamicOffcanvas"> 238 @* The content here comes from an external request *@ 239 </div> 240 241 </body> 242 243 </html> 244 245 @functions { 246 bool AllowTracking() 247 { 248 bool allowTracking = true; 249 if (CookieManager.IsCookieManagementActive) 250 { 251 var cookieOptInLevel = CookieManager.GetCookieOptInLevel(); 252 var cookieOptInCategories = CookieManager.GetCookieOptInCategories(); 253 bool consentEither = (cookieOptInCategories.Contains("Statistical") || cookieOptInCategories.Contains("Marketing")); 254 bool consentFunctional = cookieOptInLevel == CookieOptInLevel.Functional; 255 bool consentAtLeastOne = cookieOptInLevel == CookieOptInLevel.All || (consentFunctional && consentEither); 256 allowTracking = consentAtLeastOne; 257 } 258 return allowTracking; 259 } 260 } 261