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_3b05997ad0f14160be4e67861d2de3f8.Execute() in D:\inetpub\wwwroot\www.twente.com\Files\Templates\Designs\TwenteBranding\_parsed\EventArticle.parsed.cshtml:line 353
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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