Error executing template "Designs/TwenteBranding/_parsed/EventArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_319477a070954ba7855d4dde8dd0154d.Execute() in D:\inetpub\wwwroot\www.twente.com\Files\Templates\Designs\TwenteBranding\_parsed\EventArticle.parsed.cshtml:line 330
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.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 @using TwenteBranding.Repository.Helpers 3 4 @{ 5 Title("Master view model template"); 6 Description("Master view model template"); 7 var currentPageView = Dynamicweb.Frontend.PageView.Current(); 8 var contentLanguage = currentPageView.GlobalTags.GetTagByName("Global:Area.Lang").Value; 9 var scheme = currentPageView.GlobalTags.GetTagByName("Global:Request.Scheme").Value; 10 var host = currentPageView.GlobalTags.GetTagByName("Global:Request.Host").Value; 11 var requestHost = string.Format("{0}://{1}", scheme, host); 12 var metaDescription = Model.Description; 13 var metaKeywords = Model.Keywords; 14 15 var appJs = FileHelper.GetFilenameWithTimeStamp("/Files/Templates/Designs/TwenteBranding/js/app.min.js"); 16 var appCss = FileHelper.GetFilenameWithTimeStamp("/Files/Templates/Designs/TwenteBranding/css/main.min.css"); 17 18 19 <html lang="@contentLanguage"> 20 <head> 21 <title>@Model.Title</title> 22 @if (!string.IsNullOrWhiteSpace(metaDescription)) 23 { 24 <meta name="description" content="@metaDescription"/> 25 } 26 @if (!string.IsNullOrWhiteSpace(metaKeywords)) 27 { 28 <meta name="keywords" content="@metaKeywords"/> 29 } 30 <meta http-equiv="content-language" content='@contentLanguage'/> 31 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 32 <meta http-equiv="imagetoolbar" content="no"/> 33 <meta http-equiv="x-dns-prefetch-control" content="on"/> 34 <meta http-equiv="x-ua-compatible" content="ie=edge"/> 35 <meta name="viewport" content="width=device-width,initial-scale=1"> 36 <meta name="application-name" content="innovadis.com"/> 37 <meta name="author" content="Innovadis BV, Enschede"/> 38 <meta name="copyright" content='Innovadis BV, Enschede, @DateTime.Now.Year'/> 39 <meta name="web_author" content="Innovadis BV, Enschede"/> 40 <link rel="dns-prefetch" href='@requestHost'/> 41 <link rel="icon" href="/favicon.ico" type="image/x-icon"/> 42 <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> 43 <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" type="text/css" rel="stylesheet"/> 44 <link rel="stylesheet" type="text/css" href="@appCss"/> 45 <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Ubuntu:300i,400,500,700&display=swap" rel="stylesheet"> 46 @{ var gaHeadCode = TwenteBranding.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.Analytics.GoogleAnalyticsTrackingCode); 47 if (!string.IsNullOrWhiteSpace(gaHeadCode)) 48 { 49 <script> 50 (function (i, s, o, g, r, a, m) { 51 i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { 52 (i[r].q = i[r].q || []).push(arguments) 53 }, i[r].l = 1 * new Date(); a = s.createElement(o), 54 m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) 55 })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 56 57 ga('create', '@gaHeadCode', 'auto'); 58 ga('send', 'pageview'); 59 </script> 60 } 61 } 62 @{ var gtmHeadCode = TwenteBranding.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.Analytics.GoogleTagManagerTrackingCode); 63 if (!string.IsNullOrWhiteSpace(gtmHeadCode)) 64 { 65 <script> 66 (function (w, d, s, l, i) { 67 w[l] = w[l] || []; w[l].push({ 68 'gtm.start': 69 new Date().getTime(), event: 'gtm.js' 70 }); var f = d.getElementsByTagName(s)[0], 71 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 72 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 73 })(window, document, 'script', 'dataLayer', '@gtmHeadCode');</script> 74 } 75 } 76 @RenderSnippet("HeadSection") 77 78 @* Print alternate links and content-language meta tags *@ 79 @LanguageHelper.GetMasterLanguageTags(Model.ID) 80 @{ var gtmBodyCode = TwenteBranding.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.Analytics.GoogleTagManagerTrackingCode); 81 if (!string.IsNullOrWhiteSpace(gtmBodyCode)) 82 { 83 var gtmUrl = string.Format("https://www.googletagmanager.com/ns.html?id={0}", gtmBodyCode); 84 <noscript> 85 <iframe src="@gtmUrl" height="0" width="0" style="display:none;visibility:hidden"></iframe> 86 </noscript> 87 } 88 } 89 @{ 90 var trengoKey = TwenteBranding.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.Trengo.Key); 91 if (!string.IsNullOrWhiteSpace(trengoKey)) 92 { 93 <script type="text/javascript"> 94 window.Trengo = window.Trengo || {}; 95 window.Trengo.key = "@trengoKey"; 96 97 (function(d, script, t) { 98 script = d.createElement('script'); 99 script.type = 'text/javascript'; 100 script.async = true; 101 script.src = 'https://static.widget.trengo.eu/embed.js'; 102 d.getElementsByTagName('head')[0].appendChild(script); 103 }(document)); 104 105 </script> 106 } 107 } 108 </head> 109 <body> 110 <main class="twentebranding-container"> 111 @using Dynamicweb.Content 112 @using Dynamicweb.Ecommerce.International 113 @using TwenteBranding.Repository.Helpers 114 @using Page = System.Web.UI.Page 115 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 116 @{ 117 var websiteLanguages = Model.Area.Languages; 118 List<Dynamicweb.Content.Page> topNavigationPages = null; 119 120 int topNavigationFolderId = GetPageIdByNavigationTag("TopNavigation"); 121 if (topNavigationFolderId > 0) 122 { 123 var pageService = new Dynamicweb.Content.PageService(); 124 var topNavigationPageList = pageService.GetPagesByParentID(topNavigationFolderId); 125 if (topNavigationPageList != null && topNavigationPageList.Any()) 126 { 127 topNavigationPages = topNavigationPageList.Where(p => p.Active).ToList(); 128 } 129 } 130 131 var homelinkImage = IconHelper.GetSvgPath("twente", "logo/"); 132 133 <div id="homelink"> 134 <a href="/" target="_top" title="@string.Format(" {0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar" ), Translate("Homelink_Title", "De homepage" )).JsEncode()"><img src="@homelinkImage" alt="@Translate(" Homelink_ImageAlt", "Image met het Twentse Ros die onclick naar de homepge navigeert" )" /></a> 135 </div> 136 137 var searchResultsPageId = AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.PageIds.SearchResults); 138 139 // Top navigation Snippet 140 @SnippetStart("TopNavigation") 141 142 <div class="top-navigation"> 143 @if (topNavigationPages != null && topNavigationPages.Any()) 144 { 145 <ul class="pages"> 146 @foreach (var topNavigationPage in topNavigationPages) 147 { 148 var topNavigationPageName = topNavigationPage.GetDisplayName(); 149 var topNavigationPageTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), topNavigationPageName).JsEncode(); 150 <li><a href="@string.Format("/Default.aspx?ID={0}", topNavigationPage.ID)" title="@topNavigationPageTitle" target="_top">@topNavigationPageName</a></li> 151 } 152 </ul> 153 } 154 155 @if (websiteLanguages != null && websiteLanguages.Any()) 156 { 157 <ul class="languages"> 158 @{ 159 var pageService = new PageService(); 160 var languagePages = pageService.GetLanguagePages(Model.ID); 161 162 foreach (var language in Model.Area.Languages) 163 { 164 var lang = language.Culture.Split('-')[0]; 165 var link = ""; 166 var listClass = language.IsCurrent ? "active" : ""; 167 var langTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), language.Name).JsEncode(); 168 169 if (language.IsMaster && !language.IsCurrent) 170 { 171 var masterAreaPage = pageService.GetPagesByAreaID(1).SingleOrDefault(p => p.GetLanguageVersion(Model.Area.ID) != null && p.GetLanguageVersion(Model.Area.ID).ID.Equals(Model.ID)); 172 if (masterAreaPage != null) 173 { 174 link = string.Format("/Default.aspx?ID={0}", masterAreaPage.ID); 175 } 176 } 177 else if (language.IsCurrent) 178 { 179 link = "javascript:void(0);"; 180 } 181 else 182 { 183 foreach (var languagePage in languagePages) 184 { 185 var languageAreaId = language.ID; 186 if (languageAreaId == languagePage.AreaId) 187 { 188 link = string.Format("/Default.aspx?ID={0}", languagePage.ID); 189 } 190 } 191 } 192 193 //TODO: querystring? 194 195 <li class="@listClass" title="@langTitle"><a href="@link" target="_top">@lang</a></li> 196 } 197 } 198 </ul> 199 } 200 </div> 201 202 @SnippetEnd("TopNavigation") 203 204 // navigation SM 205 <div id="header_mobile" class="d-block d-md-none" data-hometext="@Translate("Navigation_HomeText", "Home")"> 206 <div class="header-mobile-icons"> 207 <a id="mobile-menu-button" class="icon-color--gray-4 icon--hamburger menu-icon"></a> 208 <a id="mobile-search-button" class="icon-color--gray-4 icon--search menu-icon"></a> 209 <a id="mobile-close-button" class="icon-color--gray-4 icon--cross menu-icon"></a> 210 </div> 211 <nav id="mobile-nav" class="navigation-mobile"> 212 @RenderNavigation(new { StartLevel = 1, EndLevel = 2, Template = "LIClean-mobile.xslt", Expandmode = "All" }) 213 <div class="mobile-topnavigation"> 214 @RenderSnippet("TopNavigation") 215 </div> 216 </nav> 217 <div id="mobile-navigation-submenu"></div> 218 219 <div id="mobile-search" class="search-mobile"> 220 @if (!string.IsNullOrWhiteSpace(searchResultsPageId)) 221 { 222 var searchResultUrl = string.Format("/Default.aspx?ID={0}", searchResultsPageId); 223 <div id="searchFormMobile" data-target="@searchResultUrl"> 224 <div class="top-search"> 225 <div class="input-group"> 226 <input type="text" class="form-control" name="q" id="q" placeholder="@Translate(" Searchbar_Placeholder", "Zoeken" )" aria-label="@Translate(" Searchbar_AriaLabel", "Zoeken" )"> 227 <div class="input-group-append"> 228 <button class="btn icon--search icon-color--gray-4 icon-size--x1 search-button-mobile" type="button" aria-label="search"></button> 229 </div> 230 </div> 231 </div> 232 </div> 233 @SnippetStart("JavascriptBottom") 234 <script> 235 $(document).ready(function () { 236 $(".search-button-mobile, #searchFormMobile").off("click").on("click", function () { 237 SearchHelper.SearchMobile(); 238 }); 239 $("#q, #searchFormMobile").keypress(function (e) { 240 if (e.which == 13) { 241 SearchHelper.SearchMobile(); 242 return false; 243 } 244 }); 245 }); 246 </script> 247 @SnippetEnd("JavascriptBottom") 248 249 } 250 </div> 251 </div> 252 253 // navigation MD+ 254 <div id="header" class="d-none d-md-block"> 255 <div class="container"> 256 257 @RenderSnippet("TopNavigation") 258 259 <nav id="navigation" data-hometext="@Translate("Navigation_HomeText", "Home")"> 260 @RenderNavigation(new { StartLevel = 1, EndLevel = 2, Template = "LIClean.xslt", Expandmode = "All" }) 261 </nav> 262 263 @if (!string.IsNullOrWhiteSpace(searchResultsPageId)) 264 { 265 var searchResultUrl = string.Format("/Default.aspx?ID={0}", searchResultsPageId); 266 <div id="searchForm" data-target="@searchResultUrl"> 267 <div class="top-search"> 268 <div class="input-group"> 269 <input type="text" class="form-control" name="q" id="q" placeholder="@Translate(" Searchbar_Placeholder", "Zoeken" )" aria-label="@Translate(" Searchbar_AriaLabel", "Zoeken" )"> 270 <div class="input-group-append"> 271 <button class="btn icon--search icon-color--gray-4 icon-size--x1 search-button" type="button" aria-label="search"></button> 272 </div> 273 </div> 274 </div> 275 </div> 276 277 @SnippetStart("JavascriptBottom") 278 <script> 279 $(document).ready(function () { 280 $(".search-button, #searchForm").off("click").on("click", function () { 281 SearchHelper.Search(); 282 }); 283 $("#q, #searchForm").keypress(function (e) { 284 if (e.which == 13) { 285 SearchHelper.Search(); 286 return false; 287 } 288 }); 289 }); 290 </script> 291 @SnippetEnd("JavascriptBottom") 292 } 293 </div> 294 <div id="navigation-submenu"></div> 295 </div> 296 } 297 <main> 298 @using Dynamicweb.Core 299 @using TwenteBranding.Repository.Helpers 300 @using TwenteBranding.Models.Constants 301 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 302 @Description("View model template for an event article") 303 304 @{ 305 var pService = new Dynamicweb.Content.PageService(); 306 var iService = new Dynamicweb.Content.ItemService(); 307 var pageView = Dynamicweb.Frontend.PageView.Current(); 308 var culture = pageView.GlobalTags.GetTagByName("Global:Area.LongLang").Value; 309 var itemPageId = pageView.ID; 310 var sidebar = pService.GetPageByNavigationTag(Model.Area.ID, StringConstants.NavigationTags.EventArticleSidebar); 311 312 var item = ItemHelper.GetTwenteBrandingItemForPage(Model.ItemId, itemPageId.ToString(), culture, pService, iService); 313 if (item != null) 314 { 315 var hashtag = item.MainHashtag.IsNotNullOrEmpty() ? string.Format("#{0}", item.MainHashtag) : string.Format("#{0}", item.MainHashtagEnglish); 316 317 var goalName = item.GoalName; 318 var background = goalName.FixNameForClass(); 319 var goalType = item.GoalType; 320 var gradientCss = item.GoalGradientCss; 321 var goalIconHeader = item.GoalIconHeader; 322 323 var title = Model.Item.GetString("Title"); 324 var introduction = Model.Item.GetString("Text"); 325 326 var headerImage = ""; 327 328 if (Model.Item.Fields.Where(x => x.SystemName.Contains("Image")).Count() > 0) 329 { 330 headerImage = Model.Item.GetFile("ImageLarge").Path; 331 if (string.IsNullOrWhiteSpace(headerImage)) 332 { 333 headerImage = Model.Item.GetFile("ImageWide").Path; 334 if (string.IsNullOrWhiteSpace(headerImage)) 335 { 336 headerImage = Model.Item.GetString("Image"); 337 } 338 } 339 headerImage = $"/Admin/Public/GetImage.ashx?Image={headerImage}&Format=webp&Width=700&Height=-1&Quality=100&Crop=0&t=2"; 340 } 341 342 var fontColor = item.HeaderFontColor; 343 var eventWhen = item.EventPeriodDatesOnly; 344 var eventTime = item.EventPeriodTimesOnly; 345 var eventOrganizer = item.EventOrganizer; 346 var eventLocation = item.EventLocation; 347 348 <div class="main-container"> 349 <div class="page-title article-title background--@background"> 350 <div class="container"> 351 <div class="grid header-grid"> 352 <div class="title"> 353 <h1 class="font-color--white">@title</h1> 354 @if (!string.IsNullOrWhiteSpace(introduction)) 355 { 356 <div class="sub-header">@introduction</div> 357 } 358 <div class="read-full-article font-color--white">@Translate("EventArticle_Read_Entire_Article", "Lees hieronder meer")<div class="icon--arrow-down">&nbsp;</div></div> 359 360 </div> 361 <div class="image"><img alt="global goal icon" src="@goalIconHeader" /></div> 362 </div> 363 </div> 364 </div> 365 <div class="page-content container"> 366 <div class="grid detail-grid-container"> 367 <div class="content"> 368 <div class="top"> 369 @if (!string.IsNullOrWhiteSpace(headerImage)) 370 { 371 <div class="header-image" style="background: url(@headerImage)"> 372 <div class="@gradientCss"></div> 373 </div> 374 } 375 376 <div class="event-article-details"> 377 <h3 class="event-details-title info">@Translate("EventArticle_Title", "Event details")</h3> 378 <div class="grid cols-2 event-details-content"> 379 <div class="left"> 380 <div> 381 @Translate("EventArticle_When", "Wanneer"): 382 </div> 383 <div>@eventWhen</div> 384 <div> 385 @Translate("EventArticle_Time", "Tijd"): 386 </div> 387 <div>@eventTime</div> 388 <div> 389 @Translate("EventArticle_Organizer", "Organisator"): 390 </div> 391 <div>@eventOrganizer</div> 392 </div> 393 <div class="right"> 394 <div> 395 @Translate("EventArticle_Location", "Locatie"): 396 </div> 397 <div>@eventLocation.NewlineToBr()</div> 398 </div> 399 </div> 400 </div> 401 </div> 402 @Model.Placeholder("Content") 403 404 </div> 405 406 @{ 407 if (sidebar != null) 408 { 409 <div class="sidebar"> 410 @RenderPageContent(sidebar.ID) 411 </div> 412 } 413 } 414 415 @if (Model.Placeholder("Bottom").Any()) 416 { 417 <div class="bottom"> 418 @Model.Placeholder("Bottom") 419 </div> 420 } 421 422 </div> 423 </div> 424 </div> 425 } 426 else 427 { 428 <div>No-Item</div> 429 } 430 } 431 </main> 432 @using Dynamicweb.Frontend 433 @using TwenteBranding.Models.Constants 434 @using TwenteBranding.Repository.Helpers 435 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 436 437 @{ 438 var hashTags = AreaHelper.GetFooterHashTags(Model); 439 var hashTagsTitleField = Model.Area.Item.GetField(StringConstants.ItemInstanceType.FooterTagsTitle).GetValue(); 440 var hashTagsTitle = hashTagsTitleField == null ? "" : hashTagsTitleField.ToString(); 441 if (hashTags.Count > 0) 442 { 443 <div class="background--gray-1"> 444 445 <div class="hashtags-container container"> 446 @{ 447 if (!string.IsNullOrEmpty(hashTagsTitle)) 448 { 449 <div class="title"> 450 @hashTagsTitle 451 </div> 452 } 453 } 454 <div class="hashtags font-color--twente-red"> 455 @foreach (var tag in hashTags) 456 { 457 <a href="@SearchEngineFriendlyURLs.GetFriendlyUrl(tag.ID)">#@tag.MenuText</a> 458 } 459 </div> 460 </div> 461 </div> 462 } 463 } 464 465 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 466 <footer class="background--twente-red"> 467 <div class="container"> 468 <div class="social-media-icon-container"> 469 @using TwenteBranding.Repository.Helpers 470 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 471 472 @if (Model.Area.Item != null) 473 { 474 <ul> 475 @foreach (var field in Model.Area.Item.Fields.Where(f => f.SystemName.StartsWith("Sm_"))) 476 { 477 if (!string.IsNullOrEmpty(field.GetString())) 478 { 479 <li> 480 <a rel="noopener" aria-label="@field.Name.JsEncode()" href="@field.GetString()" title="@field.Name.JsEncode()" target="_blank"> 481 <div class="social-media-icon icon--@field.SystemName.ToLower() icon-size--x2"></div> 482 </a> 483 </li> 484 } 485 } 486 </ul> 487 } 488 </div> 489 <div class="footer-link-container"> 490 @{ 491 List<Dynamicweb.Content.Page> footerNavigationPages = null; 492 int footerNavigationFolderId = GetPageIdByNavigationTag(TwenteBranding.Models.Constants.StringConstants.NavigationTags.FooterNavigation); 493 if (footerNavigationFolderId > 0) 494 { 495 var pageService = new Dynamicweb.Content.PageService(); 496 var footerNavigationPageList = pageService.GetPagesByParentID(footerNavigationFolderId); 497 if (footerNavigationPageList != null && footerNavigationPageList.Any()) 498 { 499 footerNavigationPages = footerNavigationPageList.Where(p => p.Active).ToList(); 500 if (footerNavigationPages != null && footerNavigationPages.Any()) 501 { 502 var footerLinkCounter = 1; 503 foreach (var footerNavigationPage in footerNavigationPages) 504 { 505 var footerNavigationPageName = footerNavigationPage.GetDisplayName(); 506 var footerNavigationPageTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), footerNavigationPageName).JsEncode(); 507 var footerNavigationPageLink = string.Format("/Default.aspx?ID={0}", footerNavigationPage.ID); 508 509 if (footerNavigationPages.Count() == footerLinkCounter) 510 { 511 var copyRight = string.Format(Translate("Footer_CopyRight", "&copy; {0} Twente Branding"), DateTime.Now.Year); 512 513 <div class="footer-link-wrapper"> 514 <div class="footer-link"> 515 <a href="@footerNavigationPageLink" title="@footerNavigationPageTitle">@footerNavigationPageName</a> 516 </div> 517 <div class="footer-link"><span>@copyRight</span></div> 518 </div> 519 } 520 else 521 { 522 <div class="footer-link"> 523 <a href="@footerNavigationPageLink" title="@footerNavigationPageTitle">@footerNavigationPageName</a> 524 </div> 525 } 526 footerLinkCounter++; 527 } 528 } 529 } 530 } 531 } 532 </div> 533 </div> 534 </footer> 535 536 </main> 537 <aside> 538 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 539 @using Dynamicweb.Core 540 @using TwenteBranding.Repository.Helpers 541 @using System.Linq; 542 @using TwenteBranding.Models.ViewModels 543 544 @{ 545 var newsletterSubscriptionModalPageId = GetPageIdByNavigationTag("NewsletterSubscriptionModal"); 546 var jobAlertSubscriptionModalPageId = GetPageIdByNavigationTag("JobAlertSubscriptionModal"); 547 var jobOffersPageId = GetPageIdByNavigationTag("JobOffers"); 548 var jobOfferParentPageId = Dynamicweb.Frontend.PageView.Current().Page.ParentPageId; 549 var utmCampaign = System.Web.HttpContext.Current.Request.QueryString.Get("utm_campaign"); 550 var mainHashtagModal = ""; 551 552 // Specific pages which must not show a subscription modal (jobalert/newsletter) 553 var twenteLeeftPageId = GetPageIdByNavigationTag("MOT_TwenteLeeft"); 554 var jobAlertSubscription = GetPageIdByNavigationTag("JobAlertSubscription"); 555 var pageIdsWithoutModal = new List<int> { twenteLeeftPageId, jobAlertSubscription }; 556 557 // Get the item for the current page 558 TwenteBrandingItemModel pItem = null; 559 if (Model.ItemId != "1") //Item with ID 1 gives error 560 { 561 pItem = ItemHelper.GetTwenteBrandingItemForPage( 562 Model.ItemId, 563 Dynamicweb.Frontend.PageView.Current().ID.ToString(), 564 Dynamicweb.Frontend.PageView.Current().GlobalTags.GetTagByName("Global:Area.LongLang").Value 565 ); 566 } 567 568 if (pItem != null) 569 { 570 // Get main hashtag of the current page item 571 var mainHashtagId = pItem.MainHashtagIds.FirstOrDefault(); 572 if (!string.IsNullOrEmpty(mainHashtagId)) 573 { 574 var hashtagItem = Dynamicweb.Content.Items.Item.GetItemById(TwenteBranding.Models.Constants.StringConstants.ItemInstanceType.Hashtag, mainHashtagId); 575 mainHashtagModal = $"{ItemHelper.GetItemValue<string>(hashtagItem, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.BaseArticle.Title)}"; 576 } 577 } 578 579 // Dont show a modal on the following pages 580 if (pageIdsWithoutModal.Contains(Model.ID) || mainHashtagModal == "talent") 581 { 582 //do noting 583 } 584 else 585 { 586 // Show modal with link to vacancysubscription page on vacancy page and pages with #talent hashtag 587 if ((Model.ID == jobOffersPageId || jobOfferParentPageId == jobOffersPageId) 588 && jobAlertSubscriptionModalPageId > 0) 589 { 590 @RenderPageContent(jobAlertSubscriptionModalPageId) 591 } 592 // If the jobalert modal pageId has a value and utmCampaing matches the specified value 593 else if (jobAlertSubscriptionModalPageId > 0 && utmCampaign == "Remarketing vacaturebank") 594 { 595 @RenderPageContent(jobAlertSubscriptionModalPageId) 596 } 597 // Else if the newsletter pageId has a value, show the newsletter subscription modal 598 else if (newsletterSubscriptionModalPageId > 0) 599 { 600 @RenderPageContent(newsletterSubscriptionModalPageId) 601 } 602 } 603 } 604 </aside> 605 <script rel="prefetch" src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> 606 <script acync rel="prefetch" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js"></script> 607 <script rel="prefetch" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js"></script> 608 <script rel="prefetch" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js"></script> 609 610 <script src="@appJs"></script> 611 @RenderSnippet("JavascriptBottom") 612 </body> 613 </html> 614 }