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_7ac6cba848164fc8983608f7409d5ed1.Execute() in D:\inetpub\wwwroot\www.twente.com\Files\Templates\Designs\TwenteBranding\_parsed\EventArticle.parsed.cshtml:line 311
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 <!DOCTYPE html> 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 </head> 90 <body> 91 <main class="twentebranding-container"> 92 @using Dynamicweb.Content 93 @using Dynamicweb.Ecommerce.International 94 @using TwenteBranding.Repository.Helpers 95 @using Page = System.Web.UI.Page 96 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 97 @{ 98 var websiteLanguages = Model.Area.Languages; 99 List<Dynamicweb.Content.Page> topNavigationPages = null; 100 101 int topNavigationFolderId = GetPageIdByNavigationTag("TopNavigation"); 102 if (topNavigationFolderId > 0) 103 { 104 var pageService = new Dynamicweb.Content.PageService(); 105 var topNavigationPageList = pageService.GetPagesByParentID(topNavigationFolderId); 106 if (topNavigationPageList != null && topNavigationPageList.Any()) 107 { 108 topNavigationPages = topNavigationPageList.Where(p => p.Active).ToList(); 109 } 110 } 111 112 var homelinkImage = IconHelper.GetSvgPath("twente", "logo/"); 113 114 <div id="homelink"> 115 <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> 116 </div> 117 118 var searchResultsPageId = AreaHelper.GetAreaItemStringValueBySystemName(TwenteBranding.Models.Constants.StringConstants.WebsiteSettings.PageIds.SearchResults); 119 120 // Top navigation Snippet 121 @SnippetStart("TopNavigation") 122 123 <div class="top-navigation"> 124 @if (topNavigationPages != null && topNavigationPages.Any()) 125 { 126 <ul class="pages"> 127 @foreach (var topNavigationPage in topNavigationPages) 128 { 129 var topNavigationPageName = topNavigationPage.GetDisplayName(); 130 var topNavigationPageTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), topNavigationPageName).JsEncode(); 131 <li><a href="@string.Format("/Default.aspx?ID={0}", topNavigationPage.ID)" title="@topNavigationPageTitle" target="_top">@topNavigationPageName</a></li> 132 } 133 </ul> 134 } 135 136 @if (websiteLanguages != null && websiteLanguages.Any()) 137 { 138 <ul class="languages"> 139 @{ 140 var pageService = new PageService(); 141 var languagePages = pageService.GetLanguagePages(Model.ID); 142 143 foreach (var language in Model.Area.Languages) 144 { 145 var lang = language.Culture.Split('-')[0]; 146 var link = ""; 147 var listClass = language.IsCurrent ? "active" : ""; 148 var langTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), language.Name).JsEncode(); 149 150 if (language.IsMaster && !language.IsCurrent) 151 { 152 var masterAreaPage = pageService.GetPagesByAreaID(1).SingleOrDefault(p => p.GetLanguageVersion(Model.Area.ID) != null && p.GetLanguageVersion(Model.Area.ID).ID.Equals(Model.ID)); 153 if (masterAreaPage != null) 154 { 155 link = string.Format("/Default.aspx?ID={0}", masterAreaPage.ID); 156 } 157 } 158 else if (language.IsCurrent) 159 { 160 link = "javascript:void(0);"; 161 } 162 else 163 { 164 foreach (var languagePage in languagePages) 165 { 166 var languageAreaId = language.ID; 167 if (languageAreaId == languagePage.AreaId) 168 { 169 link = string.Format("/Default.aspx?ID={0}", languagePage.ID); 170 } 171 } 172 } 173 174 //TODO: querystring? 175 176 <li class="@listClass" title="@langTitle"><a href="@link" target="_top">@lang</a></li> 177 } 178 } 179 </ul> 180 } 181 </div> 182 183 @SnippetEnd("TopNavigation") 184 185 // navigation SM 186 <div id="header_mobile" class="d-block d-md-none" data-hometext="@Translate("Navigation_HomeText", "Home")"> 187 <div class="header-mobile-icons"> 188 <a id="mobile-menu-button" class="icon-color--gray-4 icon--hamburger menu-icon"></a> 189 <a id="mobile-search-button" class="icon-color--gray-4 icon--search menu-icon"></a> 190 <a id="mobile-close-button" class="icon-color--gray-4 icon--cross menu-icon"></a> 191 </div> 192 <nav id="mobile-nav" class="navigation-mobile"> 193 @RenderNavigation(new { StartLevel = 1, EndLevel = 2, Template = "LIClean-mobile.xslt", Expandmode = "All" }) 194 <div class="mobile-topnavigation"> 195 @RenderSnippet("TopNavigation") 196 </div> 197 </nav> 198 <div id="mobile-navigation-submenu"></div> 199 200 <div id="mobile-search" class="search-mobile"> 201 @if (!string.IsNullOrWhiteSpace(searchResultsPageId)) 202 { 203 var searchResultUrl = string.Format("/Default.aspx?ID={0}", searchResultsPageId); 204 <div id="searchFormMobile" data-target="@searchResultUrl"> 205 <div class="top-search"> 206 <div class="input-group"> 207 <input type="text" class="form-control" name="q" id="q" placeholder="@Translate(" Searchbar_Placeholder", "Zoeken" )" aria-label="@Translate(" Searchbar_AriaLabel", "Zoeken" )"> 208 <div class="input-group-append"> 209 <button class="btn icon--search icon-color--gray-4 icon-size--x1 search-button-mobile" type="button" aria-label="search"></button> 210 </div> 211 </div> 212 </div> 213 </div> 214 @SnippetStart("JavascriptBottom") 215 <script> 216 $(document).ready(function () { 217 $(".search-button-mobile, #searchFormMobile").off("click").on("click", function () { 218 SearchHelper.SearchMobile(); 219 }); 220 $("#q, #searchFormMobile").keypress(function (e) { 221 if (e.which == 13) { 222 SearchHelper.SearchMobile(); 223 return false; 224 } 225 }); 226 }); 227 </script> 228 @SnippetEnd("JavascriptBottom") 229 230 } 231 </div> 232 </div> 233 234 // navigation MD+ 235 <div id="header" class="d-none d-md-block"> 236 <div class="container"> 237 238 @RenderSnippet("TopNavigation") 239 240 <nav id="navigation" data-hometext="@Translate("Navigation_HomeText", "Home")"> 241 @RenderNavigation(new { StartLevel = 1, EndLevel = 2, Template = "LIClean.xslt", Expandmode = "All" }) 242 </nav> 243 244 @if (!string.IsNullOrWhiteSpace(searchResultsPageId)) 245 { 246 var searchResultUrl = string.Format("/Default.aspx?ID={0}", searchResultsPageId); 247 <div id="searchForm" data-target="@searchResultUrl"> 248 <div class="top-search"> 249 <div class="input-group"> 250 <input type="text" class="form-control" name="q" id="q" placeholder="@Translate(" Searchbar_Placeholder", "Zoeken" )" aria-label="@Translate(" Searchbar_AriaLabel", "Zoeken" )"> 251 <div class="input-group-append"> 252 <button class="btn icon--search icon-color--gray-4 icon-size--x1 search-button" type="button" aria-label="search"></button> 253 </div> 254 </div> 255 </div> 256 </div> 257 258 @SnippetStart("JavascriptBottom") 259 <script> 260 $(document).ready(function () { 261 $(".search-button, #searchForm").off("click").on("click", function () { 262 SearchHelper.Search(); 263 }); 264 $("#q, #searchForm").keypress(function (e) { 265 if (e.which == 13) { 266 SearchHelper.Search(); 267 return false; 268 } 269 }); 270 }); 271 </script> 272 @SnippetEnd("JavascriptBottom") 273 } 274 </div> 275 <div id="navigation-submenu"></div> 276 </div> 277 } 278 <main> 279 @using Dynamicweb.Core 280 @using TwenteBranding.Repository.Helpers 281 @using TwenteBranding.Models.Constants 282 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 283 @Description("View model template for an event article") 284 285 @{ 286 var pService = new Dynamicweb.Content.PageService(); 287 var iService = new Dynamicweb.Content.ItemService(); 288 var pageView = Dynamicweb.Frontend.PageView.Current(); 289 var culture = pageView.GlobalTags.GetTagByName("Global:Area.LongLang").Value; 290 var itemPageId = pageView.ID; 291 var sidebar = pService.GetPageByNavigationTag(Model.Area.ID, StringConstants.NavigationTags.EventArticleSidebar); 292 293 var item = ItemHelper.GetTwenteBrandingItemForPage(Model.ItemId, itemPageId.ToString(), culture, pService, iService); 294 if (item != null) 295 { 296 var hashtag = item.MainHashtag.IsNotNullOrEmpty() ? string.Format("#{0}", item.MainHashtag) : string.Format("#{0}", item.MainHashtagEnglish); 297 298 var goalName = item.GoalName; 299 var background = goalName.FixNameForClass(); 300 var goalType = item.GoalType; 301 var gradientCss = item.GoalGradientCss; 302 var goalIconHeader = item.GoalIconHeader; 303 304 var title = Model.Item.GetString("Title"); 305 var introduction = Model.Item.GetString("Text"); 306 307 var headerImage = ""; 308 309 if (Model.Item.Fields.Where(x => x.SystemName.Contains("Image")).Count() > 0) 310 { 311 headerImage = Model.Item.GetFile("ImageLarge").Path; 312 if (string.IsNullOrWhiteSpace(headerImage)) 313 { 314 headerImage = Model.Item.GetFile("ImageWide").Path; 315 if (string.IsNullOrWhiteSpace(headerImage)) 316 { 317 headerImage = Model.Item.GetString("Image"); 318 } 319 } 320 headerImage = $"/Admin/Public/GetImage.ashx?Image={headerImage}&Format=webp&Width=700&Height=-1&Quality=100&Crop=0&t=2"; 321 } 322 323 var fontColor = item.HeaderFontColor; 324 var eventWhen = item.EventPeriodDatesOnly; 325 var eventTime = item.EventPeriodTimesOnly; 326 var eventOrganizer = item.EventOrganizer; 327 var eventLocation = item.EventLocation; 328 329 <div class="main-container"> 330 <div class="page-title article-title background--@background"> 331 <div class="container"> 332 <div class="grid header-grid"> 333 <div class="title"> 334 <h1 class="font-color--white">@title</h1> 335 @if (!string.IsNullOrWhiteSpace(introduction)) 336 { 337 <div class="sub-header">@introduction</div> 338 } 339 <div class="read-full-article font-color--white">@Translate("EventArticle_Read_Entire_Article", "Lees hieronder meer")<div class="icon--arrow-down">&nbsp;</div></div> 340 341 </div> 342 <div class="image"><img alt="global goal icon" src="@goalIconHeader" /></div> 343 </div> 344 </div> 345 </div> 346 <div class="page-content container"> 347 <div class="grid detail-grid-container"> 348 <div class="content"> 349 <div class="top"> 350 @if (!string.IsNullOrWhiteSpace(headerImage)) 351 { 352 <div class="header-image" style="background: url(@headerImage)"> 353 <div class="@gradientCss"></div> 354 </div> 355 } 356 357 <div class="event-article-details"> 358 <h3 class="event-details-title info">@Translate("EventArticle_Title", "Event details")</h3> 359 <div class="grid cols-2 event-details-content"> 360 <div class="left"> 361 <div> 362 @Translate("EventArticle_When", "Wanneer"): 363 </div> 364 <div>@eventWhen</div> 365 <div> 366 @Translate("EventArticle_Time", "Tijd"): 367 </div> 368 <div>@eventTime</div> 369 <div> 370 @Translate("EventArticle_Organizer", "Organisator"): 371 </div> 372 <div>@eventOrganizer</div> 373 </div> 374 <div class="right"> 375 <div> 376 @Translate("EventArticle_Location", "Locatie"): 377 </div> 378 <div>@eventLocation.NewlineToBr()</div> 379 </div> 380 </div> 381 </div> 382 </div> 383 @Model.Placeholder("Content") 384 385 </div> 386 387 @{ 388 if (sidebar != null) 389 { 390 <div class="sidebar"> 391 @RenderPageContent(sidebar.ID) 392 </div> 393 } 394 } 395 396 @if (Model.Placeholder("Bottom").Any()) 397 { 398 <div class="bottom"> 399 @Model.Placeholder("Bottom") 400 </div> 401 } 402 403 </div> 404 </div> 405 </div> 406 } 407 else 408 { 409 <div>No-Item</div> 410 } 411 } 412 </main> 413 @using Dynamicweb.Frontend 414 @using TwenteBranding.Models.Constants 415 @using TwenteBranding.Repository.Helpers 416 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 417 418 @{ 419 var hashTags = AreaHelper.GetFooterHashTags(Model); 420 var hashTagsTitleField = Model.Area.Item.GetField(StringConstants.ItemInstanceType.FooterTagsTitle).GetValue(); 421 var hashTagsTitle = hashTagsTitleField == null ? "" : hashTagsTitleField.ToString(); 422 if (hashTags.Count > 0) 423 { 424 <div class="background--gray-1"> 425 426 <div class="hashtags-container container"> 427 @{ 428 if (!string.IsNullOrEmpty(hashTagsTitle)) 429 { 430 <div class="title"> 431 @hashTagsTitle 432 </div> 433 } 434 } 435 <div class="hashtags font-color--twente-red"> 436 @foreach (var tag in hashTags) 437 { 438 <a href="@SearchEngineFriendlyURLs.GetFriendlyUrl(tag.ID)">#@tag.MenuText</a> 439 } 440 </div> 441 </div> 442 </div> 443 } 444 } 445 446 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 447 <footer class="background--twente-red"> 448 <div class="container"> 449 <div class="social-media-icon-container"> 450 @using TwenteBranding.Repository.Helpers 451 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 452 453 @if (Model.Area.Item != null) 454 { 455 <ul> 456 @foreach (var field in Model.Area.Item.Fields.Where(f => f.SystemName.StartsWith("Sm_"))) 457 { 458 if (!string.IsNullOrEmpty(field.GetString())) 459 { 460 <li> 461 <a rel="noopener" aria-label="@field.Name.JsEncode()" href="@field.GetString()" title="@field.Name.JsEncode()" target="_blank"> 462 <div class="social-media-icon icon--@field.SystemName.ToLower() icon-size--x2"></div> 463 </a> 464 </li> 465 } 466 } 467 </ul> 468 } 469 </div> 470 <div class="footer-link-container"> 471 @{ 472 List<Dynamicweb.Content.Page> footerNavigationPages = null; 473 int footerNavigationFolderId = GetPageIdByNavigationTag(TwenteBranding.Models.Constants.StringConstants.NavigationTags.FooterNavigation); 474 if (footerNavigationFolderId > 0) 475 { 476 var pageService = new Dynamicweb.Content.PageService(); 477 var footerNavigationPageList = pageService.GetPagesByParentID(footerNavigationFolderId); 478 if (footerNavigationPageList != null && footerNavigationPageList.Any()) 479 { 480 footerNavigationPages = footerNavigationPageList.Where(p => p.Active).ToList(); 481 if (footerNavigationPages != null && footerNavigationPages.Any()) 482 { 483 var footerLinkCounter = 1; 484 foreach (var footerNavigationPage in footerNavigationPages) 485 { 486 var footerNavigationPageName = footerNavigationPage.GetDisplayName(); 487 var footerNavigationPageTitle = string.Format("{0}: {1}", Translate("LinkTitlePrefix", "Navigeer naar"), footerNavigationPageName).JsEncode(); 488 var footerNavigationPageLink = string.Format("/Default.aspx?ID={0}", footerNavigationPage.ID); 489 490 if (footerNavigationPages.Count() == footerLinkCounter) 491 { 492 var copyRight = string.Format(Translate("Footer_CopyRight", "&copy; {0} Twente Branding"), DateTime.Now.Year); 493 494 <div class="footer-link-wrapper"> 495 <div class="footer-link"> 496 <a href="@footerNavigationPageLink" title="@footerNavigationPageTitle">@footerNavigationPageName</a> 497 </div> 498 <div class="footer-link"><span>@copyRight</span></div> 499 </div> 500 } 501 else 502 { 503 <div class="footer-link"> 504 <a href="@footerNavigationPageLink" title="@footerNavigationPageTitle">@footerNavigationPageName</a> 505 </div> 506 } 507 footerLinkCounter++; 508 } 509 } 510 } 511 } 512 } 513 </div> 514 </div> 515 </footer> 516 517 </main> 518 <aside> 519 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 520 @using Dynamicweb.Core 521 @using TwenteBranding.Repository.Helpers 522 @using System.Linq; 523 @using TwenteBranding.Models.ViewModels 524 525 @{ 526 var newsletterSubscriptionModalPageId = GetPageIdByNavigationTag("NewsletterSubscriptionModal"); 527 var jobAlertSubscriptionModalPageId = GetPageIdByNavigationTag("JobAlertSubscriptionModal"); 528 var jobOffersPageId = GetPageIdByNavigationTag("JobOffers"); 529 var jobOfferParentPageId = Dynamicweb.Frontend.PageView.Current().Page.ParentPageId; 530 var utmCampaign = System.Web.HttpContext.Current.Request.QueryString.Get("utm_campaign"); 531 var mainHashtagModal = ""; 532 533 // Specific pages which must not show a subscription modal (jobalert/newsletter) 534 var twenteLeeftPageId = GetPageIdByNavigationTag("MOT_TwenteLeeft"); 535 var pageIdsWithoutModal = new List<int> { twenteLeeftPageId }; 536 537 // Get the item for the current page 538 TwenteBrandingItemModel pItem = null; 539 if (Model.ItemId != "1") //Item with ID 1 gives error 540 { 541 pItem = ItemHelper.GetTwenteBrandingItemForPage( 542 Model.ItemId, 543 Dynamicweb.Frontend.PageView.Current().ID.ToString(), 544 Dynamicweb.Frontend.PageView.Current().GlobalTags.GetTagByName("Global:Area.LongLang").Value 545 ); 546 } 547 548 if (pItem != null) 549 { 550 // Get main hashtag of the current page item 551 var mainHashtagId = pItem.MainHashtagIds.FirstOrDefault(); 552 if (!string.IsNullOrEmpty(mainHashtagId)) 553 { 554 var hashtagItem = Dynamicweb.Content.Items.Item.GetItemById(TwenteBranding.Models.Constants.StringConstants.ItemInstanceType.Hashtag, mainHashtagId); 555 mainHashtagModal = $"{ItemHelper.GetItemValue<string>(hashtagItem, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.BaseArticle.Title)}"; 556 } 557 } 558 559 // Dont show a modal on the following pages 560 if (pageIdsWithoutModal.Contains(Model.ID) || mainHashtagModal == "talent") 561 { 562 //do noting 563 } 564 else 565 { 566 // Show modal with link to vacancysubscription page on vacancy page and pages with #talent hashtag 567 if ((Model.ID == jobOffersPageId || jobOfferParentPageId == jobOffersPageId) 568 && jobAlertSubscriptionModalPageId > 0) 569 { 570 @RenderPageContent(jobAlertSubscriptionModalPageId) 571 } 572 // If the jobalert modal pageId has a value and utmCampaing matches the specified value 573 else if (jobAlertSubscriptionModalPageId > 0 && utmCampaign == "Remarketing vacaturebank") 574 { 575 @RenderPageContent(jobAlertSubscriptionModalPageId) 576 } 577 // Else if the newsletter pageId has a value, show the newsletter subscription modal 578 else if (newsletterSubscriptionModalPageId > 0) 579 { 580 @RenderPageContent(newsletterSubscriptionModalPageId) 581 } 582 } 583 } 584 </aside> 585 <script rel="prefetch" src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> 586 <script acync rel="prefetch" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js"></script> 587 <script rel="prefetch" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js"></script> 588 <script rel="prefetch" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js"></script> 589 590 <script src="@appJs"></script> 591 @RenderSnippet("JavascriptBottom") 592 </body> 593 </html> 594 }