Error executing template "Designs/Swift/Paragraph/Swift_ArticleHeader.cshtml"
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
   at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
   at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
   at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor`1 visitor)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable`1 references)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context)
   at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
   at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, 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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   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.ParagraphViewModel> 2 3 @{ 4 var pageItem = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page).Item; 5 var parms = new Dictionary<string, object>(); 6 parms.Add("cssClass", "h-100 w-100"); 7 parms.Add("columns", Model.GridRowColumnCount); 8 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 9 string layout = Model.Item.GetRawValueString("Layout", "CardCenterBottom"); 10 bool hideCoverImage = Model.Item?.GetBoolean("HideCoverImage") ?? false; 11 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 12 bool hideSummary = Model.Item?.GetBoolean("HideSummary") ?? false; 13 bool hidePublishedDate = Model.Item?.GetBoolean("HidePublishedDate") ?? false; 14 bool hideAuthor = Model.Item?.GetBoolean("HideAuthor") ?? false; 15 var pageTitle = !string.IsNullOrEmpty(pageItem.GetString("Title")) && !hideTitle ? pageItem.GetString("Title") : string.Empty; 16 var pageSummary = !string.IsNullOrEmpty(pageItem.GetString("Summary")) && !hideSummary ? pageItem.GetString("Summary") : string.Empty; 17 var pageCoverImage = pageItem.GetFile("CoverImage") is object && !hideCoverImage ? pageItem.GetFile("CoverImage") : null; 18 var pageAuthor = pageItem?.GetUsers("Author")?.FirstOrDefault() ?? null; 19 var pagePublishedDate = !string.IsNullOrEmpty(pageItem.GetString("PublishedDate")) && !hidePublishedDate ? pageItem.GetDateTime("PublishedDate").ToShortDateString() : string.Empty; 20 var pagePublishedDateDatetime = !string.IsNullOrEmpty(pagePublishedDate) ? pageItem.GetDateTime("PublishedDate").ToString("yyyy-MM-dd") : string.Empty; 21 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 22 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 23 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 24 string authorImagePath = pageAuthor is object && pageAuthor?.Image is object ? $"/Admin/Public/GetImage.ashx?image={pageAuthor?.Image}&width=48&height=48&Crop=0&format=webp" : string.Empty; 25 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 26 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} m-0\" itemprop=\"headline\">"; 27 string headingLevelStop = $"</{headingLevel}>"; 28 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 29 string order = layout == "InfoTopAlignedLeftImageBottom" || layout == "InfoTopAlignedCenterImageBottom" ? " order-first" : string.Empty; 30 string textAlignment = layout == "InfoTopAlignedCenterImageBottom" ? " text-center" : string.Empty; 31 string wrapperAlignment = layout == "InfoTopAlignedCenterImageBottom" || layout == "InfoCardAboveImageAlignedBottom" ? " justify-content-center" : string.Empty; 32 string infoCardBackground = string.IsNullOrEmpty(theme) ? "background-color:var(--swift-background-color); " : string.Empty; 33 34 switch (contentPadding){ 35 case "none": 36 contentPadding = string.Empty; 37 break; 38 case "small": 39 contentPadding = " p-3"; 40 break; 41 case "large": 42 contentPadding = " p-5"; 43 break; 44 } 45 } 46 47 @switch(layout){ 48 case "InfoAboveImageAlignedCenter": 49 if ((pageCoverImage != null || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)) || (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate))) 50 { 51 <div class="item_@(Model.Item.SystemName.ToLower())"> 52 @{ 53 if (pageCoverImage != null || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)){ 54 <div class="position-relative@(theme)" style="aspect-ratio: 32/9"> 55 @if (pageCoverImage != null){ 56 <div style="aspect-ratio: 32/9"> 57 @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) 58 </div> 59 } 60 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)) 61 { 62 <div class="container-xl d-flex flex-column gap-3 align-items-center justify-content-center text-center position-absolute top-0 bottom-0 end-0 start-0@(contentPadding)"> 63 @{ <text>@{RenderArticleTitle(pageItem, hideTitle, pageTitle, titleFontSize, headingLevel, headingLevelStart, headingLevelStop);}</text> } 64 @{ <text>@{RenderArticleSummary(pageItem, hideSummary, pageSummary, subtitleFontSize);}</text> } 65 </div> 66 } 67 </div> 68 } 69 if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 70 <div class="d-flex align-items-center justify-content-center gap-3@(theme)@(contentPadding)"> 71 @if (pageAuthor != null && !hideAuthor) 72 { 73 <div class="d-flex align-items-center gap-3"> 74 @{ <text>@{RenderArticleAuthor(pageItem, pageAuthor, hideAuthor, authorImagePath, iconPath);}</text> } 75 @{ <text>@{RenderArticlePublishedDate(pageItem, hidePublishedDate, pagePublishedDate, pagePublishedDateDatetime);}</text> } 76 </div> 77 } 78 </div> 79 } 80 } 81 </div> 82 } 83 break; 84 case "InfoCardAboveImageAlignedBottom": 85 if (pageCoverImage != null || (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate))) 86 { 87 <div class="item_@(Model.Item.SystemName.ToLower())"> 88 @{ 89 if (pageCoverImage != null) 90 { 91 <div class="mb-n5" style="aspect-ratio: 32/9"> 92 @{ @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) } 93 </div> 94 } 95 if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 96 <div class="position-relative d-flex flex-column align-items-center mx-3"> 97 <div class="d-flex flex-column gap-3 shadow text-center w-100@(theme)" style="@(infoCardBackground)max-width:40rem;"> 98 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 99 { 100 <div class="grid grid-1@(textAlignment)@(contentPadding)"> 101 @{ <text>@{RenderArticleTitle(pageItem, hideTitle, pageTitle, titleFontSize, headingLevel, headingLevelStart, headingLevelStop);}</text> } 102 @{ <text>@{RenderArticleSummary(pageItem, hideSummary, pageSummary, subtitleFontSize);}</text> } 103 @if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 104 <div class="d-flex align-items-center gap-3@(wrapperAlignment)"> 105 <text>@{RenderArticleAuthor(pageItem, pageAuthor, hideAuthor, authorImagePath, iconPath);}</text> 106 <text>@{RenderArticlePublishedDate(pageItem, hidePublishedDate, pagePublishedDate, pagePublishedDateDatetime);}</text> 107 </div> 108 } 109 </div> 110 } 111 </div> 112 </div> 113 } 114 } 115 </div> 116 } 117 break; 118 case "InfoBottomAlignedLeftImageTop": 119 case "InfoTopAlignedLeftImageBottom": 120 case "InfoTopAlignedCenterImageBottom": 121 if (pageCoverImage != null && !hideCoverImage || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 122 <div class="grid grid-1 gap-0@(theme) item_@(Model.Item.SystemName.ToLower())"> 123 @if (pageCoverImage != null) 124 { 125 <div style="aspect-ratio: 32/9"> 126 @{ @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) } 127 </div> 128 } 129 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 130 { 131 <div class="grid grid-1@(order)@(textAlignment)@(contentPadding)"> 132 @{ <text>@{RenderArticleTitle(pageItem, hideTitle, pageTitle, titleFontSize, headingLevel, headingLevelStart, headingLevelStop);}</text> } 133 @{ <text>@{RenderArticleSummary(pageItem, hideSummary, pageSummary, subtitleFontSize);}</text> } 134 @if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 135 { 136 <div class="d-flex align-items-center gap-3@(wrapperAlignment)"> 137 @{ <text>@{RenderArticleAuthor(pageItem, pageAuthor, hideAuthor, authorImagePath, iconPath);}</text> } 138 @{ <text>@{RenderArticlePublishedDate(pageItem, hidePublishedDate, pagePublishedDate, pagePublishedDateDatetime);}</text> } 139 </div> 140 } 141 </div> 142 } 143 </div> 144 } 145 break; 146 } 147 148 149 @if (Pageview.IsVisualEditorMode && hideCoverImage && hideTitle && hideSummary && hideAuthor && hidePublishedDate) { 150 <div class="alert alert-info mt-3" role="alert"> 151 <span>@Translate("Article header: Edit this column to configure")</span> 152 </div> 153 } 154 155 @functions { 156 void RenderArticleTitle(Dynamicweb.Frontend.ItemViewModel pageItem, bool hideTitle, string pageTitle, string titleFontSize, string headingLevel, string headingLevelStart, string headingLevelStop){ 157 if (!string.IsNullOrEmpty(pageTitle)){ 158 @headingLevelStart 159 @pageTitle 160 @headingLevelStop 161 } 162 } 163 } 164 165 @functions { 166 void RenderArticleSummary(Dynamicweb.Frontend.ItemViewModel pageItem, bool hideSummary, string pageSummary, string subtitleFontSize){ 167 if (!string.IsNullOrEmpty(pageSummary)){ 168 <h5 class="@subtitleFontSize m-0">@pageSummary</h5> 169 } 170 } 171 } 172 173 @functions { 174 void RenderArticleAuthor(Dynamicweb.Frontend.ItemViewModel pageItem, Dynamicweb.Frontend.UserViewModel pageAuthor, bool hideAuthor, string authorImagePath, string iconPath){ 175 if (pageAuthor != null && !hideAuthor){ 176 <div class="d-flex align-items-center gap-2"> 177 @if (!string.IsNullOrEmpty(pageAuthor.Image)){ 178 <img class="img-fluid rounded-circle" src="@authorImagePath" loading="lazy" width="32" height="32"> 179 } 180 else{ 181 <div class="rounded-circle icon-1 p-2" style="background-color: var(--swift-foreground-color);color:var(--swift-background-color)"> 182 @ReadFile(iconPath + "user.svg") 183 </div> 184 } 185 @if (!string.IsNullOrEmpty(pageAuthor.Name)){ 186 <div class="fs-7 opacity-85" itemprop="author">@pageAuthor.Name</div> 187 } 188 </div> 189 } 190 } 191 } 192 193 @functions { 194 void RenderArticlePublishedDate(Dynamicweb.Frontend.ItemViewModel pageItem, bool hidePublishedDate, string pagePublishedDate, string pagePublishedDateDatetime){ 195 if (!string.IsNullOrEmpty(pagePublishedDate)){ 196 <time class="fs-7 opacity-85" datetime="@pagePublishedDateDatetime" itemprop="datePublished">@pagePublishedDate</time> 197 } 198 } 199 } 200
New 15km bike park in the heart of Pines forrest

This is a classic Black Mountain trail and was featured in Freehub Magazine's Pisgah Photo Book: Issue 6. There is an optional drop 1/2 way down. The trails all run parallel to the Fountain Place paved road so they can be shuttled by car. Flow trail is a bit tight at the top, but gets really fast as you transition to the lower Rush. The climb up from Marlette Lake trail is pretty tough, but relatively short. This new trail flows well and has multiple banked berms and small jumps that wind down the mountainside. You can find everyone out here having fun from people in body armor and downhill bikes to families testing their kids limits to xc racer types riding intervals. From the young (or not so young) beginner, to the downhill pro, a flow trail delivers smiles for riders of all ages and skill level. Do not ride when wet and not if you are not a skilled rider.

Drop in off a shallow rock slab and then whip through a few tight berms. This created a reroute of the single track. A few wet spots, but almost non-existent mud. It packs in a lot of excitement in a short amount of time. You'll need somebody to drop you off at the start and pick you up at the end. This is the third downhill only trail on the north side trail network. Two wheel drifting is likely if you have speed but are not riding the top few inches of the berms. Some wet/muddy creek crossings, but otherwise dry. You'll need somebody to drop you off at the start and pick you up at the end.

Error executing template "Designs/Swift/Paragraph/Swift_Poster.cshtml"
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
   at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
   at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
   at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor`1 visitor)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable`1 references)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context)
   at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
   at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, 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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   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.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 bool movePageBehind = false; 6 bool isFirstPoster = false; 7 string movePageBehindClass = string.Empty; 8 9 if (Pageview.Page.PropertyItem != null) 10 { 11 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 12 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 13 if (movePageBehind) 14 { 15 movePageBehindClass = " poster-behind"; 16 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 17 { 18 isFirstPoster = true; 19 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 20 } 21 } 22 } 23 24 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 25 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 26 27 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 28 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 29 string alignment = string.Empty; 30 31 string posterPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 32 string posterPaddingClass = string.Empty; 33 34 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "large"); 35 string posterSizeBase = posterHeight.Contains("%") || posterHeight.Contains("0") ? "aspect-ratio" : "height"; 36 string posterHeightClass = string.Empty; 37 38 switch(posterPadding) 39 { 40 case "none": 41 posterPaddingClass = " p-3 px-xl-3 py-xl-4"; 42 break; 43 case "small": 44 posterPaddingClass = " p-3 p-xl-4"; 45 break; 46 case "large": 47 posterPaddingClass = " p-4 p-xl-5"; 48 break; 49 } 50 51 switch (layout) 52 { 53 case "align-top-left-text-left": 54 alignment = " text-start justify-content-start align-items-start"; 55 break; 56 case "align-top-center-text-center": 57 alignment = " text-center justify-content-start align-items-center"; 58 break; 59 case "align-top-right-text-right": 60 alignment = " text-end justify-content-start align-items-end"; 61 break; 62 case "align-middle-left-text-left": 63 alignment = " text-start justify-content-center align-items-start"; 64 break; 65 case "align-middle-center-text-center": 66 alignment = " text-center justify-content-center align-items-center"; 67 break; 68 case "align-middle-right-text-right": 69 alignment = " text-end justify-content-center align-items-end"; 70 break; 71 case "align-bottom-left-text-left": 72 alignment = " text-start justify-content-end align-items-start"; 73 break; 74 case "align-bottom-center-text-center": 75 alignment = " text-center justify-content-end align-items-center"; 76 break; 77 case "align-bottom-right-text-right": 78 alignment = " text-end justify-content-end align-items-end"; 79 break; 80 } 81 82 switch (posterHeight) 83 { 84 case "small": 85 posterHeightClass = " min-vh-25 min-vh-md-50"; 86 break; 87 case "medium": 88 posterHeightClass = " min-vh-50 min-vh-md-75"; 89 break; 90 case "large": 91 posterHeightClass = " min-vh-75 min-vh-md-100"; 92 break; 93 } 94 } 95 96 <div class="position-relative@(theme)@(movePageBehindClass) item_@Model.Item.SystemName.ToLower()"> 97 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 98 99 @if (posterSizeBase == "height") 100 { 101 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 102 { 103 {<text>@{RenderImage(posterSizeBase);}</text>} 104 } 105 106 if ( 107 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 108 Model.Item?.GetBoolean("HideTitle") == false || 109 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 110 link != null && !string.IsNullOrEmpty(link.Url) || 111 link2 != null && !string.IsNullOrEmpty(link2.Url)) 112 { 113 <div class="container-xl h-100 px-0"> 114 <div class="h-100 position-relative d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 115 @{ 116 <text>@{RenderTitle();}</text> 117 <text>@{RenderText();}</text> 118 <text>@{RenderButtons(link, link2);}</text> 119 } 120 </div> 121 </div> 122 } 123 } 124 125 @if (posterSizeBase == "aspect-ratio") 126 { 127 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 128 { 129 {<text>@{RenderImage(posterSizeBase);}</text>} 130 } 131 132 if ( 133 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 134 Model.Item?.GetBoolean("HideTitle") == false || 135 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 136 link != null && !string.IsNullOrEmpty(link.Url) || 137 link2 != null && !string.IsNullOrEmpty(link2.Url)) 138 { 139 if (string.IsNullOrEmpty(Model.Item.GetString("Image"))) 140 { 141 string ratio = Model.Item.GetRawValueString("PosterHeight", string.Empty); 142 ratio = ratio != "0" ? ratio : ""; 143 string ratioCssClass = ratio != "" ? "ratio" : ""; 144 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 145 146 <div class="container-xl px-0 @ratioCssClass" @ratioVariable> 147 <div class="h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 148 @{ 149 <text>@{RenderTitle();}</text> 150 <text>@{RenderText();}</text> 151 <text>@{RenderButtons(link, link2);}</text> 152 } 153 </div> 154 </div> 155 } 156 else 157 { 158 <div class="position-absolute top-0 bottom-0 end-0 start-0"> 159 <div class="container-xl h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 160 @{ 161 <text>@{RenderTitle();}</text> 162 <text>@{RenderText();}</text> 163 <text>@{RenderButtons(link, link2);}</text> 164 } 165 </div> 166 </div> 167 } 168 } 169 } 170 171 </div> 172 173 @functions { 174 void RenderImage(string posterSizeBase) 175 { 176 string image = Model.Item.GetString("Image", string.Empty); 177 string imgAltText = Model.Item.GetString("PosterAltText", string.Empty); 178 179 if (!string.IsNullOrEmpty(image)) 180 { 181 string imageFilter = Model.Item.GetRawValueString("ImageFilter", string.Empty) == "filter" ? " image-filter" : string.Empty; 182 183 string ratio = Model.Item.GetRawValueString("PosterHeight").Contains("%") || Model.Item.GetRawValueString("PosterHeight").Contains("0") ? Model.Item.GetRawValueString("PosterHeight") : string.Empty; 184 185 ratio = ratio != "0" ? ratio : ""; 186 string ratioCssClass = ratio != "" ? " ratio" : ""; 187 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 188 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 189 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 190 191 var parms = new Dictionary<string, object>(); 192 parms.Add("columns", Model.GridRowColumnCount); 193 parms.Add("alt", imgAltText); 194 parms.Add("quality", 90); 195 196 if (posterSizeBase == "height") 197 { 198 parms.Add("cssClass", "h-100 w-100"); 199 200 <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> 201 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 202 </div> 203 } 204 205 if (posterSizeBase == "aspect-ratio") 206 { 207 if (ratio == string.Empty) 208 { 209 parms.Add("cssClass", "mh-100 mw-100"); 210 parms.Add("fullwidth", true); 211 } 212 213 <figure class="m-0@(imageFilter)@(ratioCssClass)" @ratioVariable> 214 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 215 </figure> 216 } 217 } 218 } 219 } 220 221 @functions { 222 void RenderTitle() 223 { 224 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 225 string title = !hideTitle ? Model.Item.GetString("Title", string.Empty) : string.Empty; 226 227 if (!string.IsNullOrEmpty(title)) 228 { 229 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 230 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 231 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 232 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 233 234 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 235 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} mb-0\">"; 236 string headingLevelStop = $"</{headingLevel}>"; 237 238 @headingLevelStart 239 <span class="@maxWidth">@title</span> 240 @headingLevelStop 241 } 242 } 243 } 244 245 @functions { 246 void RenderText() 247 { 248 if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 249 { 250 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 251 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 252 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 253 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 254 255 <p class="@subtitleFontSize @(subtitleColor) @(subtitleOpacity) lead mb-0"> 256 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 257 </p> 258 } 259 } 260 } 261 262 @functions { 263 void RenderButtons(Dynamicweb.Frontend.LinkViewModel link, Dynamicweb.Frontend.LinkViewModel link2) 264 { 265 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 266 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 267 268 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 269 { 270 link = Model.Item.GetLink("ButtonLink"); 271 } 272 273 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 274 { 275 link2 = Model.Item.GetLink("ButtonLink2"); 276 } 277 278 if (linkType == "product-group") 279 { 280 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 281 IList<string> groupIds = new List<string> { }; 282 283 if (selectedGroups != null) 284 { 285 foreach (var fromGroup in selectedGroups) 286 { 287 groupIds.Add(fromGroup.Id); 288 } 289 } 290 291 link = new Dynamicweb.Frontend.LinkViewModel() 292 { 293 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 294 IsExternal = false 295 }; 296 } 297 298 if (linkType2 == "product-group2") 299 { 300 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 301 IList<string> groupIds = new List<string> { }; 302 303 if (selectedGroups != null) 304 { 305 foreach (var fromGroup in selectedGroups) 306 { 307 groupIds.Add(fromGroup.Id); 308 } 309 } 310 311 link2 = new Dynamicweb.Frontend.LinkViewModel() 312 { 313 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 314 IsExternal = false 315 }; 316 } 317 318 if (linkType == "product") 319 { 320 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 321 IList<string> productIds = new List<string> { }; 322 323 if (products != null && products.Products.Any()) 324 { 325 foreach (var product in products.Products) 326 { 327 productIds.Add(product.Id); 328 } 329 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 330 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 331 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 332 333 link = new Dynamicweb.Frontend.LinkViewModel() 334 { 335 Url = productLink, 336 IsExternal = false 337 }; 338 } 339 340 341 } 342 343 if (linkType == "product2") 344 { 345 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 346 IList<string> productIds = new List<string> { }; 347 348 if (products != null && products.Products.Any()) 349 { 350 foreach (var product in products.Products) 351 { 352 productIds.Add(product.Id); 353 } 354 355 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 356 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 357 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 358 359 link2 = new Dynamicweb.Frontend.LinkViewModel() 360 { 361 Url = productLink, 362 IsExternal = false 363 }; 364 } 365 366 367 } 368 369 if (link != null && !string.IsNullOrEmpty(link.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 370 { 371 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 372 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 373 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 374 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 375 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", "secondary"); 376 buttonStyle2 = buttonStyle2 == "primary" ? " btn-primary" : buttonStyle2; 377 buttonStyle2 = buttonStyle2 == "secondary" ? " btn-secondary" : buttonStyle2; 378 buttonStyle2 = buttonStyle2 == "link" ? " btn-link" : buttonStyle2; 379 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : string.Empty; 380 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : string.Empty; 381 string buttonLabel = Model.Item.GetString("ButtonLabel", string.Empty); 382 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 383 string stretchedLink = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 384 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 385 string stretchedLinkClass = stretchedLink == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel2) ? " stretched-link" : string.Empty; 386 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link.Url) && string.IsNullOrEmpty(buttonLabel) ? " stretched-link" : string.Empty; 387 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 388 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 389 buttonSize = buttonSize == "regular" ? string.Empty : buttonSize; 390 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 391 string alignmentClass = string.Empty; 392 393 switch (Model.Item.GetString("Layout")) 394 { 395 case "align-top-left-text-left": 396 alignmentClass = " justify-content-start"; 397 break; 398 case "align-top-center-text-center": 399 alignmentClass = " justify-content-center"; 400 break; 401 case "align-top-right-text-right": 402 alignmentClass = " justify-content-end"; 403 break; 404 case "align-middle-left-text-left": 405 alignmentClass = " justify-content-start"; 406 break; 407 case "align-middle-center-text-center": 408 alignmentClass = " justify-content-center"; 409 break; 410 case "align-middle-right-text-right": 411 alignmentClass = " justify-content-end"; 412 break; 413 case "align-bottom-left-text-left": 414 alignmentClass = " justify-content-start"; 415 break; 416 case "align-bottom-center-text-center": 417 alignmentClass = " justify-content-center"; 418 break; 419 case "align-bottom-right-text-right": 420 alignmentClass = " justify-content-end"; 421 break; 422 } 423 424 string buttonsWrapperStart = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? $"<div class=\"d-flex flex-wrap gap-3{alignmentClass}\">" : string.Empty; 425 string buttonsWrapperEnd = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? "</div>" : string.Empty; 426 427 @buttonsWrapperStart 428 429 if (link != null && !string.IsNullOrEmpty(link.Url)) 430 { 431 if (!string.IsNullOrEmpty(buttonLabel)) 432 { 433 <a href="@link.Url" @target @rel class="text-nowrap btn@(buttonStyle)@(buttonSize)@(stretchedLinkClass)">@buttonLabel</a> 434 } 435 else 436 { 437 <a href="@link.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass)"> 438 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 439 </a> 440 } 441 } 442 443 if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 444 { 445 if (!string.IsNullOrEmpty(buttonLabel2)) 446 { 447 <a href="@link2.Url" @target @rel class="text-nowrap btn@(buttonStyle2)@(buttonSize)@(stretchedLinkClass2)">@buttonLabel2</a> 448 } 449 else 450 { 451 <a href="@link2.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass2) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass2)"> 452 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 453 </a> 454 } 455 } 456 457 @buttonsWrapperEnd 458 } 459 } 460 } 461 462 @if (movePageBehind && isFirstPoster) 463 { 464 <script> 465 ['resize', 'load'].forEach(function (e) { 466 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 467 }); 468 </script> 469 } 470
Error executing template "Designs/Swift/Paragraph/Swift_Poster.cshtml"
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
   at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
   at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
   at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor`1 visitor)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable`1 references)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context)
   at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
   at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, 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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   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.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 bool movePageBehind = false; 6 bool isFirstPoster = false; 7 string movePageBehindClass = string.Empty; 8 9 if (Pageview.Page.PropertyItem != null) 10 { 11 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 12 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 13 if (movePageBehind) 14 { 15 movePageBehindClass = " poster-behind"; 16 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 17 { 18 isFirstPoster = true; 19 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 20 } 21 } 22 } 23 24 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 25 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 26 27 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 28 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 29 string alignment = string.Empty; 30 31 string posterPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 32 string posterPaddingClass = string.Empty; 33 34 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "large"); 35 string posterSizeBase = posterHeight.Contains("%") || posterHeight.Contains("0") ? "aspect-ratio" : "height"; 36 string posterHeightClass = string.Empty; 37 38 switch(posterPadding) 39 { 40 case "none": 41 posterPaddingClass = " p-3 px-xl-3 py-xl-4"; 42 break; 43 case "small": 44 posterPaddingClass = " p-3 p-xl-4"; 45 break; 46 case "large": 47 posterPaddingClass = " p-4 p-xl-5"; 48 break; 49 } 50 51 switch (layout) 52 { 53 case "align-top-left-text-left": 54 alignment = " text-start justify-content-start align-items-start"; 55 break; 56 case "align-top-center-text-center": 57 alignment = " text-center justify-content-start align-items-center"; 58 break; 59 case "align-top-right-text-right": 60 alignment = " text-end justify-content-start align-items-end"; 61 break; 62 case "align-middle-left-text-left": 63 alignment = " text-start justify-content-center align-items-start"; 64 break; 65 case "align-middle-center-text-center": 66 alignment = " text-center justify-content-center align-items-center"; 67 break; 68 case "align-middle-right-text-right": 69 alignment = " text-end justify-content-center align-items-end"; 70 break; 71 case "align-bottom-left-text-left": 72 alignment = " text-start justify-content-end align-items-start"; 73 break; 74 case "align-bottom-center-text-center": 75 alignment = " text-center justify-content-end align-items-center"; 76 break; 77 case "align-bottom-right-text-right": 78 alignment = " text-end justify-content-end align-items-end"; 79 break; 80 } 81 82 switch (posterHeight) 83 { 84 case "small": 85 posterHeightClass = " min-vh-25 min-vh-md-50"; 86 break; 87 case "medium": 88 posterHeightClass = " min-vh-50 min-vh-md-75"; 89 break; 90 case "large": 91 posterHeightClass = " min-vh-75 min-vh-md-100"; 92 break; 93 } 94 } 95 96 <div class="position-relative@(theme)@(movePageBehindClass) item_@Model.Item.SystemName.ToLower()"> 97 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 98 99 @if (posterSizeBase == "height") 100 { 101 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 102 { 103 {<text>@{RenderImage(posterSizeBase);}</text>} 104 } 105 106 if ( 107 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 108 Model.Item?.GetBoolean("HideTitle") == false || 109 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 110 link != null && !string.IsNullOrEmpty(link.Url) || 111 link2 != null && !string.IsNullOrEmpty(link2.Url)) 112 { 113 <div class="container-xl h-100 px-0"> 114 <div class="h-100 position-relative d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 115 @{ 116 <text>@{RenderTitle();}</text> 117 <text>@{RenderText();}</text> 118 <text>@{RenderButtons(link, link2);}</text> 119 } 120 </div> 121 </div> 122 } 123 } 124 125 @if (posterSizeBase == "aspect-ratio") 126 { 127 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 128 { 129 {<text>@{RenderImage(posterSizeBase);}</text>} 130 } 131 132 if ( 133 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 134 Model.Item?.GetBoolean("HideTitle") == false || 135 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 136 link != null && !string.IsNullOrEmpty(link.Url) || 137 link2 != null && !string.IsNullOrEmpty(link2.Url)) 138 { 139 if (string.IsNullOrEmpty(Model.Item.GetString("Image"))) 140 { 141 string ratio = Model.Item.GetRawValueString("PosterHeight", string.Empty); 142 ratio = ratio != "0" ? ratio : ""; 143 string ratioCssClass = ratio != "" ? "ratio" : ""; 144 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 145 146 <div class="container-xl px-0 @ratioCssClass" @ratioVariable> 147 <div class="h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 148 @{ 149 <text>@{RenderTitle();}</text> 150 <text>@{RenderText();}</text> 151 <text>@{RenderButtons(link, link2);}</text> 152 } 153 </div> 154 </div> 155 } 156 else 157 { 158 <div class="position-absolute top-0 bottom-0 end-0 start-0"> 159 <div class="container-xl h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 160 @{ 161 <text>@{RenderTitle();}</text> 162 <text>@{RenderText();}</text> 163 <text>@{RenderButtons(link, link2);}</text> 164 } 165 </div> 166 </div> 167 } 168 } 169 } 170 171 </div> 172 173 @functions { 174 void RenderImage(string posterSizeBase) 175 { 176 string image = Model.Item.GetString("Image", string.Empty); 177 string imgAltText = Model.Item.GetString("PosterAltText", string.Empty); 178 179 if (!string.IsNullOrEmpty(image)) 180 { 181 string imageFilter = Model.Item.GetRawValueString("ImageFilter", string.Empty) == "filter" ? " image-filter" : string.Empty; 182 183 string ratio = Model.Item.GetRawValueString("PosterHeight").Contains("%") || Model.Item.GetRawValueString("PosterHeight").Contains("0") ? Model.Item.GetRawValueString("PosterHeight") : string.Empty; 184 185 ratio = ratio != "0" ? ratio : ""; 186 string ratioCssClass = ratio != "" ? " ratio" : ""; 187 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 188 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 189 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 190 191 var parms = new Dictionary<string, object>(); 192 parms.Add("columns", Model.GridRowColumnCount); 193 parms.Add("alt", imgAltText); 194 parms.Add("quality", 90); 195 196 if (posterSizeBase == "height") 197 { 198 parms.Add("cssClass", "h-100 w-100"); 199 200 <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> 201 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 202 </div> 203 } 204 205 if (posterSizeBase == "aspect-ratio") 206 { 207 if (ratio == string.Empty) 208 { 209 parms.Add("cssClass", "mh-100 mw-100"); 210 parms.Add("fullwidth", true); 211 } 212 213 <figure class="m-0@(imageFilter)@(ratioCssClass)" @ratioVariable> 214 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 215 </figure> 216 } 217 } 218 } 219 } 220 221 @functions { 222 void RenderTitle() 223 { 224 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 225 string title = !hideTitle ? Model.Item.GetString("Title", string.Empty) : string.Empty; 226 227 if (!string.IsNullOrEmpty(title)) 228 { 229 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 230 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 231 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 232 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 233 234 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 235 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} mb-0\">"; 236 string headingLevelStop = $"</{headingLevel}>"; 237 238 @headingLevelStart 239 <span class="@maxWidth">@title</span> 240 @headingLevelStop 241 } 242 } 243 } 244 245 @functions { 246 void RenderText() 247 { 248 if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 249 { 250 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 251 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 252 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 253 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 254 255 <p class="@subtitleFontSize @(subtitleColor) @(subtitleOpacity) lead mb-0"> 256 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 257 </p> 258 } 259 } 260 } 261 262 @functions { 263 void RenderButtons(Dynamicweb.Frontend.LinkViewModel link, Dynamicweb.Frontend.LinkViewModel link2) 264 { 265 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 266 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 267 268 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 269 { 270 link = Model.Item.GetLink("ButtonLink"); 271 } 272 273 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 274 { 275 link2 = Model.Item.GetLink("ButtonLink2"); 276 } 277 278 if (linkType == "product-group") 279 { 280 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 281 IList<string> groupIds = new List<string> { }; 282 283 if (selectedGroups != null) 284 { 285 foreach (var fromGroup in selectedGroups) 286 { 287 groupIds.Add(fromGroup.Id); 288 } 289 } 290 291 link = new Dynamicweb.Frontend.LinkViewModel() 292 { 293 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 294 IsExternal = false 295 }; 296 } 297 298 if (linkType2 == "product-group2") 299 { 300 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 301 IList<string> groupIds = new List<string> { }; 302 303 if (selectedGroups != null) 304 { 305 foreach (var fromGroup in selectedGroups) 306 { 307 groupIds.Add(fromGroup.Id); 308 } 309 } 310 311 link2 = new Dynamicweb.Frontend.LinkViewModel() 312 { 313 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 314 IsExternal = false 315 }; 316 } 317 318 if (linkType == "product") 319 { 320 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 321 IList<string> productIds = new List<string> { }; 322 323 if (products != null && products.Products.Any()) 324 { 325 foreach (var product in products.Products) 326 { 327 productIds.Add(product.Id); 328 } 329 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 330 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 331 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 332 333 link = new Dynamicweb.Frontend.LinkViewModel() 334 { 335 Url = productLink, 336 IsExternal = false 337 }; 338 } 339 340 341 } 342 343 if (linkType == "product2") 344 { 345 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 346 IList<string> productIds = new List<string> { }; 347 348 if (products != null && products.Products.Any()) 349 { 350 foreach (var product in products.Products) 351 { 352 productIds.Add(product.Id); 353 } 354 355 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 356 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 357 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 358 359 link2 = new Dynamicweb.Frontend.LinkViewModel() 360 { 361 Url = productLink, 362 IsExternal = false 363 }; 364 } 365 366 367 } 368 369 if (link != null && !string.IsNullOrEmpty(link.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 370 { 371 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 372 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 373 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 374 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 375 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", "secondary"); 376 buttonStyle2 = buttonStyle2 == "primary" ? " btn-primary" : buttonStyle2; 377 buttonStyle2 = buttonStyle2 == "secondary" ? " btn-secondary" : buttonStyle2; 378 buttonStyle2 = buttonStyle2 == "link" ? " btn-link" : buttonStyle2; 379 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : string.Empty; 380 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : string.Empty; 381 string buttonLabel = Model.Item.GetString("ButtonLabel", string.Empty); 382 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 383 string stretchedLink = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 384 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 385 string stretchedLinkClass = stretchedLink == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel2) ? " stretched-link" : string.Empty; 386 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link.Url) && string.IsNullOrEmpty(buttonLabel) ? " stretched-link" : string.Empty; 387 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 388 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 389 buttonSize = buttonSize == "regular" ? string.Empty : buttonSize; 390 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 391 string alignmentClass = string.Empty; 392 393 switch (Model.Item.GetString("Layout")) 394 { 395 case "align-top-left-text-left": 396 alignmentClass = " justify-content-start"; 397 break; 398 case "align-top-center-text-center": 399 alignmentClass = " justify-content-center"; 400 break; 401 case "align-top-right-text-right": 402 alignmentClass = " justify-content-end"; 403 break; 404 case "align-middle-left-text-left": 405 alignmentClass = " justify-content-start"; 406 break; 407 case "align-middle-center-text-center": 408 alignmentClass = " justify-content-center"; 409 break; 410 case "align-middle-right-text-right": 411 alignmentClass = " justify-content-end"; 412 break; 413 case "align-bottom-left-text-left": 414 alignmentClass = " justify-content-start"; 415 break; 416 case "align-bottom-center-text-center": 417 alignmentClass = " justify-content-center"; 418 break; 419 case "align-bottom-right-text-right": 420 alignmentClass = " justify-content-end"; 421 break; 422 } 423 424 string buttonsWrapperStart = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? $"<div class=\"d-flex flex-wrap gap-3{alignmentClass}\">" : string.Empty; 425 string buttonsWrapperEnd = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? "</div>" : string.Empty; 426 427 @buttonsWrapperStart 428 429 if (link != null && !string.IsNullOrEmpty(link.Url)) 430 { 431 if (!string.IsNullOrEmpty(buttonLabel)) 432 { 433 <a href="@link.Url" @target @rel class="text-nowrap btn@(buttonStyle)@(buttonSize)@(stretchedLinkClass)">@buttonLabel</a> 434 } 435 else 436 { 437 <a href="@link.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass)"> 438 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 439 </a> 440 } 441 } 442 443 if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 444 { 445 if (!string.IsNullOrEmpty(buttonLabel2)) 446 { 447 <a href="@link2.Url" @target @rel class="text-nowrap btn@(buttonStyle2)@(buttonSize)@(stretchedLinkClass2)">@buttonLabel2</a> 448 } 449 else 450 { 451 <a href="@link2.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass2) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass2)"> 452 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 453 </a> 454 } 455 } 456 457 @buttonsWrapperEnd 458 } 459 } 460 } 461 462 @if (movePageBehind && isFirstPoster) 463 { 464 <script> 465 ['resize', 'load'].forEach(function (e) { 466 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 467 }); 468 </script> 469 } 470
Error executing template "Designs/Swift/Paragraph/Swift_Poster.cshtml"
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
   at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
   at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
   at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor`1 visitor)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable`1 references)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context)
   at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
   at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, 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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   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.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 bool movePageBehind = false; 6 bool isFirstPoster = false; 7 string movePageBehindClass = string.Empty; 8 9 if (Pageview.Page.PropertyItem != null) 10 { 11 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 12 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 13 if (movePageBehind) 14 { 15 movePageBehindClass = " poster-behind"; 16 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 17 { 18 isFirstPoster = true; 19 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 20 } 21 } 22 } 23 24 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 25 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 26 27 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 28 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 29 string alignment = string.Empty; 30 31 string posterPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 32 string posterPaddingClass = string.Empty; 33 34 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "large"); 35 string posterSizeBase = posterHeight.Contains("%") || posterHeight.Contains("0") ? "aspect-ratio" : "height"; 36 string posterHeightClass = string.Empty; 37 38 switch(posterPadding) 39 { 40 case "none": 41 posterPaddingClass = " p-3 px-xl-3 py-xl-4"; 42 break; 43 case "small": 44 posterPaddingClass = " p-3 p-xl-4"; 45 break; 46 case "large": 47 posterPaddingClass = " p-4 p-xl-5"; 48 break; 49 } 50 51 switch (layout) 52 { 53 case "align-top-left-text-left": 54 alignment = " text-start justify-content-start align-items-start"; 55 break; 56 case "align-top-center-text-center": 57 alignment = " text-center justify-content-start align-items-center"; 58 break; 59 case "align-top-right-text-right": 60 alignment = " text-end justify-content-start align-items-end"; 61 break; 62 case "align-middle-left-text-left": 63 alignment = " text-start justify-content-center align-items-start"; 64 break; 65 case "align-middle-center-text-center": 66 alignment = " text-center justify-content-center align-items-center"; 67 break; 68 case "align-middle-right-text-right": 69 alignment = " text-end justify-content-center align-items-end"; 70 break; 71 case "align-bottom-left-text-left": 72 alignment = " text-start justify-content-end align-items-start"; 73 break; 74 case "align-bottom-center-text-center": 75 alignment = " text-center justify-content-end align-items-center"; 76 break; 77 case "align-bottom-right-text-right": 78 alignment = " text-end justify-content-end align-items-end"; 79 break; 80 } 81 82 switch (posterHeight) 83 { 84 case "small": 85 posterHeightClass = " min-vh-25 min-vh-md-50"; 86 break; 87 case "medium": 88 posterHeightClass = " min-vh-50 min-vh-md-75"; 89 break; 90 case "large": 91 posterHeightClass = " min-vh-75 min-vh-md-100"; 92 break; 93 } 94 } 95 96 <div class="position-relative@(theme)@(movePageBehindClass) item_@Model.Item.SystemName.ToLower()"> 97 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 98 99 @if (posterSizeBase == "height") 100 { 101 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 102 { 103 {<text>@{RenderImage(posterSizeBase);}</text>} 104 } 105 106 if ( 107 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 108 Model.Item?.GetBoolean("HideTitle") == false || 109 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 110 link != null && !string.IsNullOrEmpty(link.Url) || 111 link2 != null && !string.IsNullOrEmpty(link2.Url)) 112 { 113 <div class="container-xl h-100 px-0"> 114 <div class="h-100 position-relative d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 115 @{ 116 <text>@{RenderTitle();}</text> 117 <text>@{RenderText();}</text> 118 <text>@{RenderButtons(link, link2);}</text> 119 } 120 </div> 121 </div> 122 } 123 } 124 125 @if (posterSizeBase == "aspect-ratio") 126 { 127 if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 128 { 129 {<text>@{RenderImage(posterSizeBase);}</text>} 130 } 131 132 if ( 133 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 134 Model.Item?.GetBoolean("HideTitle") == false || 135 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 136 link != null && !string.IsNullOrEmpty(link.Url) || 137 link2 != null && !string.IsNullOrEmpty(link2.Url)) 138 { 139 if (string.IsNullOrEmpty(Model.Item.GetString("Image"))) 140 { 141 string ratio = Model.Item.GetRawValueString("PosterHeight", string.Empty); 142 ratio = ratio != "0" ? ratio : ""; 143 string ratioCssClass = ratio != "" ? "ratio" : ""; 144 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 145 146 <div class="container-xl px-0 @ratioCssClass" @ratioVariable> 147 <div class="h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 148 @{ 149 <text>@{RenderTitle();}</text> 150 <text>@{RenderText();}</text> 151 <text>@{RenderButtons(link, link2);}</text> 152 } 153 </div> 154 </div> 155 } 156 else 157 { 158 <div class="position-absolute top-0 bottom-0 end-0 start-0"> 159 <div class="container-xl h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass)" id="Poster_@Pageview.CurrentParagraph.ID"> 160 @{ 161 <text>@{RenderTitle();}</text> 162 <text>@{RenderText();}</text> 163 <text>@{RenderButtons(link, link2);}</text> 164 } 165 </div> 166 </div> 167 } 168 } 169 } 170 171 </div> 172 173 @functions { 174 void RenderImage(string posterSizeBase) 175 { 176 string image = Model.Item.GetString("Image", string.Empty); 177 string imgAltText = Model.Item.GetString("PosterAltText", string.Empty); 178 179 if (!string.IsNullOrEmpty(image)) 180 { 181 string imageFilter = Model.Item.GetRawValueString("ImageFilter", string.Empty) == "filter" ? " image-filter" : string.Empty; 182 183 string ratio = Model.Item.GetRawValueString("PosterHeight").Contains("%") || Model.Item.GetRawValueString("PosterHeight").Contains("0") ? Model.Item.GetRawValueString("PosterHeight") : string.Empty; 184 185 ratio = ratio != "0" ? ratio : ""; 186 string ratioCssClass = ratio != "" ? " ratio" : ""; 187 string ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 188 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 189 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 190 191 var parms = new Dictionary<string, object>(); 192 parms.Add("columns", Model.GridRowColumnCount); 193 parms.Add("alt", imgAltText); 194 parms.Add("quality", 90); 195 196 if (posterSizeBase == "height") 197 { 198 parms.Add("cssClass", "h-100 w-100"); 199 200 <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> 201 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 202 </div> 203 } 204 205 if (posterSizeBase == "aspect-ratio") 206 { 207 if (ratio == string.Empty) 208 { 209 parms.Add("cssClass", "mh-100 mw-100"); 210 parms.Add("fullwidth", true); 211 } 212 213 <figure class="m-0@(imageFilter)@(ratioCssClass)" @ratioVariable> 214 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 215 </figure> 216 } 217 } 218 } 219 } 220 221 @functions { 222 void RenderTitle() 223 { 224 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 225 string title = !hideTitle ? Model.Item.GetString("Title", string.Empty) : string.Empty; 226 227 if (!string.IsNullOrEmpty(title)) 228 { 229 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 230 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 231 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 232 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 233 234 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 235 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} mb-0\">"; 236 string headingLevelStop = $"</{headingLevel}>"; 237 238 @headingLevelStart 239 <span class="@maxWidth">@title</span> 240 @headingLevelStop 241 } 242 } 243 } 244 245 @functions { 246 void RenderText() 247 { 248 if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 249 { 250 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 251 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 252 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 253 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 254 255 <p class="@subtitleFontSize @(subtitleColor) @(subtitleOpacity) lead mb-0"> 256 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 257 </p> 258 } 259 } 260 } 261 262 @functions { 263 void RenderButtons(Dynamicweb.Frontend.LinkViewModel link, Dynamicweb.Frontend.LinkViewModel link2) 264 { 265 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 266 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 267 268 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 269 { 270 link = Model.Item.GetLink("ButtonLink"); 271 } 272 273 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 274 { 275 link2 = Model.Item.GetLink("ButtonLink2"); 276 } 277 278 if (linkType == "product-group") 279 { 280 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 281 IList<string> groupIds = new List<string> { }; 282 283 if (selectedGroups != null) 284 { 285 foreach (var fromGroup in selectedGroups) 286 { 287 groupIds.Add(fromGroup.Id); 288 } 289 } 290 291 link = new Dynamicweb.Frontend.LinkViewModel() 292 { 293 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 294 IsExternal = false 295 }; 296 } 297 298 if (linkType2 == "product-group2") 299 { 300 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 301 IList<string> groupIds = new List<string> { }; 302 303 if (selectedGroups != null) 304 { 305 foreach (var fromGroup in selectedGroups) 306 { 307 groupIds.Add(fromGroup.Id); 308 } 309 } 310 311 link2 = new Dynamicweb.Frontend.LinkViewModel() 312 { 313 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 314 IsExternal = false 315 }; 316 } 317 318 if (linkType == "product") 319 { 320 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 321 IList<string> productIds = new List<string> { }; 322 323 if (products != null && products.Products.Any()) 324 { 325 foreach (var product in products.Products) 326 { 327 productIds.Add(product.Id); 328 } 329 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 330 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 331 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 332 333 link = new Dynamicweb.Frontend.LinkViewModel() 334 { 335 Url = productLink, 336 IsExternal = false 337 }; 338 } 339 340 341 } 342 343 if (linkType == "product2") 344 { 345 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 346 IList<string> productIds = new List<string> { }; 347 348 if (products != null && products.Products.Any()) 349 { 350 foreach (var product in products.Products) 351 { 352 productIds.Add(product.Id); 353 } 354 355 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 356 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 357 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 358 359 link2 = new Dynamicweb.Frontend.LinkViewModel() 360 { 361 Url = productLink, 362 IsExternal = false 363 }; 364 } 365 366 367 } 368 369 if (link != null && !string.IsNullOrEmpty(link.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 370 { 371 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 372 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 373 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 374 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 375 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", "secondary"); 376 buttonStyle2 = buttonStyle2 == "primary" ? " btn-primary" : buttonStyle2; 377 buttonStyle2 = buttonStyle2 == "secondary" ? " btn-secondary" : buttonStyle2; 378 buttonStyle2 = buttonStyle2 == "link" ? " btn-link" : buttonStyle2; 379 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : string.Empty; 380 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : string.Empty; 381 string buttonLabel = Model.Item.GetString("ButtonLabel", string.Empty); 382 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 383 string stretchedLink = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 384 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 385 string stretchedLinkClass = stretchedLink == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel2) ? " stretched-link" : string.Empty; 386 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link.Url) && string.IsNullOrEmpty(buttonLabel) ? " stretched-link" : string.Empty; 387 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 388 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 389 buttonSize = buttonSize == "regular" ? string.Empty : buttonSize; 390 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 391 string alignmentClass = string.Empty; 392 393 switch (Model.Item.GetString("Layout")) 394 { 395 case "align-top-left-text-left": 396 alignmentClass = " justify-content-start"; 397 break; 398 case "align-top-center-text-center": 399 alignmentClass = " justify-content-center"; 400 break; 401 case "align-top-right-text-right": 402 alignmentClass = " justify-content-end"; 403 break; 404 case "align-middle-left-text-left": 405 alignmentClass = " justify-content-start"; 406 break; 407 case "align-middle-center-text-center": 408 alignmentClass = " justify-content-center"; 409 break; 410 case "align-middle-right-text-right": 411 alignmentClass = " justify-content-end"; 412 break; 413 case "align-bottom-left-text-left": 414 alignmentClass = " justify-content-start"; 415 break; 416 case "align-bottom-center-text-center": 417 alignmentClass = " justify-content-center"; 418 break; 419 case "align-bottom-right-text-right": 420 alignmentClass = " justify-content-end"; 421 break; 422 } 423 424 string buttonsWrapperStart = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? $"<div class=\"d-flex flex-wrap gap-3{alignmentClass}\">" : string.Empty; 425 string buttonsWrapperEnd = (link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url)) ? "</div>" : string.Empty; 426 427 @buttonsWrapperStart 428 429 if (link != null && !string.IsNullOrEmpty(link.Url)) 430 { 431 if (!string.IsNullOrEmpty(buttonLabel)) 432 { 433 <a href="@link.Url" @target @rel class="text-nowrap btn@(buttonStyle)@(buttonSize)@(stretchedLinkClass)">@buttonLabel</a> 434 } 435 else 436 { 437 <a href="@link.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass)"> 438 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 439 </a> 440 } 441 } 442 443 if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 444 { 445 if (!string.IsNullOrEmpty(buttonLabel2)) 446 { 447 <a href="@link2.Url" @target @rel class="text-nowrap btn@(buttonStyle2)@(buttonSize)@(stretchedLinkClass2)">@buttonLabel2</a> 448 } 449 else 450 { 451 <a href="@link2.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass2) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass2)"> 452 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 453 </a> 454 } 455 } 456 457 @buttonsWrapperEnd 458 } 459 } 460 } 461 462 @if (movePageBehind && isFirstPoster) 463 { 464 <script> 465 ['resize', 'load'].forEach(function (e) { 466 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 467 }); 468 </script> 469 } 470

The climb to the top ends with a beautiful vista of Twin Lakes and the surrounding area. Ride to the top and then down and link it directly into Ridegeline (with some double track). Rocks for texture, obstacles for fun and some short fast downhils in this 2. The new state course removed any of the wooden features that were present on the original 16 mile trail and replaced the skinny singletrack with a machine cut ~4' wide track down the mountain. Plenty of kick ups, jumps, drops, and huge berms. Logs are gone! I need to learn how to jump! This trail is the cherry on top when riding Porcupine rim! It is typically maintained at a high level due to its popularity and use.

Technically you can go both directions but everyone typically starts from Guardsman and either drops down Desolation or continues to Mill Canyon or Ridgeline Connector. Other features include rock garden (that is rutted on the outer edges because XC peeps avoid it), skinny with twists and some other short elevated bridges. Few sniper rocks on the trail. Gnarly trail. You'll need somebody to drop you off at the start and pick you up at the end. So be careful with your carbon frames! The flowiest trails of the mountain! Logs are gone! The trail has good flow with some spicy sections.

Error executing template "Designs/Swift/ItemPublisher/List/List.cshtml"
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
   at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
   at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
   at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor`1 visitor)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable`1 references)
   at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context)
   at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
   at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, 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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System.IO @functions { private List<string> GetTags(LoopItem item) { var tags = new List<string>(); foreach (var tag in item.GetLoop("ItemPublisher:Item.Tags.Options")) { if (tag.GetBoolean("ItemPublisher:Item.Tags.Option.IsSelected")) { tags.Add(tag.GetString("ItemPublisher:Item.Tags.Option.Label")); } } return tags; } private string CreateCategory(string label, string theme) { var border = string.IsNullOrEmpty(theme) ? "--swift-border-color: rgba(var(--swift-foreground-color-rgb), .2);" : null; var sticker = $"<span class=\"badge {theme}\" style=\"color: var(--swift-foreground-color); background-color: rgba(var(--swift-background-color-rgb), 1); {border} \">{label}</span>"; return sticker; } private string CreateSticker(string label) { string shape = Pageview.CurrentParagraph.Item["ArticleItemShape"] != null ? Pageview.CurrentParagraph.Item["ArticleItemShape"].ToString() : "boxed"; var sticker = $"<span class=\"badge fw-normal shadow-none\" style=\"border: 1px solid rgba(var(--swift-foreground-color-rgb), 0.2);\">{label}</span>"; return sticker; } private string GetTagStickers(LoopItem item) { var stickers = string.Empty; if (item.GetString("ItemPublisher:Item.SystemName") == "Swift_Article") { var showTags = Pageview.CurrentParagraph.Item["ShowTags"] != null ? (Boolean)Pageview.CurrentParagraph.Item["ShowTags"] : false; if (showTags && GetTags(item).Count >= 1) { stickers += "<div class=\"d-inline-flex flex-wrap gap-1\">"; foreach (var tag in GetTags(item)) { stickers += CreateSticker(tag); } stickers += "</div>"; } } return stickers; } private string GetCategorySticker(LoopItem item) { var sticker = string.Empty; if (item.GetString("ItemPublisher:Item.SystemName") == "Swift_Article") { var showListCategory = Pageview.CurrentParagraph.Item["ShowListCategory"] != null ? (Boolean)Pageview.CurrentParagraph.Item["ShowListCategory"] : false; if (showListCategory) { sticker += "<div class=\"d-inline-flex flex-wrap gap-1\">"; sticker += CreateCategorySticker(GetCategory(Dynamicweb.Content.Services.Pages.GetPage(item.GetInteger("ItemPublisher:Item.Field.PageId")).ParentPageId), GetCategoryTheme(GetCategory(Dynamicweb.Content.Services.Pages.GetPage(item.GetInteger("ItemPublisher:Item.Field.PageId")).ParentPageId))); sticker += "</div>"; } } return sticker; } private Dynamicweb.Frontend.PageInfoViewModel GetCategory(int categoryId) { var categoryParagraph = categoryId != 0 ? Dynamicweb.Content.Services.Pages.GetPage(categoryId) : null; var category = categoryParagraph != null ? Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(categoryParagraph) : null; return category; } private string CreateCategorySticker(Dynamicweb.Frontend.PageInfoViewModel category, string theme) { var sticker = category != null ? CreateCategory(category.Item?.GetString("Title"), theme) : null; return sticker; } private string GetCategoryTheme(Dynamicweb.Frontend.PageInfoViewModel category) { var theme = category != null ? category.Item?.GetRawValueString("CoverTheme") : null; return theme; } private string LiftOnHover() { bool liftOnHover = Pageview.CurrentParagraph.Item["LiftOnHover"] != null ? (Boolean)Pageview.CurrentParagraph.Item["LiftOnHover"] : false; var lift = liftOnHover ? "lift" : null; return lift; } private string ShadowOnHover() { bool shadowOnHover = Pageview.CurrentParagraph.Item["ShadowOnHover"] != null ? (Boolean)Pageview.CurrentParagraph.Item["ShadowOnHover"] : false; var shadow = shadowOnHover ? "shadow-hover" : null; return shadow; } private string GetPadding(string theme) { var padding = !string.IsNullOrEmpty(theme) ? "p-3" : null; return padding; } private string GetGap(string theme) { var padding = string.IsNullOrEmpty(theme) ? "gap-3" : null; return padding; } } @{ bool showLoadMore = Pageview.CurrentParagraph.Item["ShowLoadMore"] != null ? (Boolean)Pageview.CurrentParagraph.Item["ShowLoadMore"] : false; 2 int maxItemsInList = !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["MaxItemsInList"].ToString()) ? Dynamicweb.Core.Converter.ToInt32(Pageview.CurrentParagraph.Item["MaxItemsInList"]) : 10; 3 var totalItems = GetInteger("ItemPublisher:Items.TotalCount"); 4 var count = GetInteger("ItemPublisher:Items.Count"); 5 var percent = count > 0 ? Convert.ToInt32(Math.Round(((double)count / totalItems) * 100, 0)) : 0; 6 var disableLoadMoreButton = count == totalItems ? true : false; 7 var loadMore = !disableLoadMoreButton ? $"onclick=\"document.querySelector('#PageSize_{Pageview.CurrentParagraph.ID}').value='{count + maxItemsInList}'; this.dispatchEvent(new window.Event('change', {{ bubbles: true }}))\"" : null; 8 var disabled = disableLoadMoreButton ? "disabled" : null; 9 var hasItems = GetBoolean("ItemPublisher:Items.Any"); string articleListLayout = Pageview.CurrentParagraph.Item["ArticleListLayout"] != null ? Pageview.CurrentParagraph.Item["ArticleListLayout"].ToString() : "grid"; string articleItemLayout = Pageview.CurrentParagraph.Item["ArticleItemLayout"] != null ? Pageview.CurrentParagraph.Item["ArticleItemLayout"].ToString() : string.Empty; string orderReverseClass = articleItemLayout == "image-right" ? " order-first order-lg-last" : string.Empty; string articleItemLayoutClass = string.Empty; string titleFontSize = Pageview.CurrentParagraph.Item["TitleFontSize"] != null ? Pageview.CurrentParagraph.Item["TitleFontSize"].ToString() : string.Empty; string gridSettings = Pageview.CurrentParagraph.Item["GridSettings"] != null ? Pageview.CurrentParagraph.Item["GridSettings"].ToString() : "4"; string carouselSettings = Pageview.CurrentParagraph.Item["CarouselSettings"] != null ? Pageview.CurrentParagraph.Item["CarouselSettings"].ToString() : "4"; bool showButton = Pageview.CurrentParagraph.Item["ShowButton"] != null ? (Boolean)Pageview.CurrentParagraph.Item["ShowButton"] : false; string ratio = Pageview.CurrentParagraph.Item["ImageAspectRatio"] != null ? Pageview.CurrentParagraph.Item["ImageAspectRatio"].ToString() : string.Empty; ratio = ratio != "0" ? ratio : string.Empty; string ratioCssClass = ratio != string.Empty ? " ratio" : string.Empty; string ratioVariable = ratio != string.Empty ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : string.Empty; string articleItemTheme = Pageview.CurrentParagraph.Item["ArticleItemTheme"] != null ? Pageview.CurrentParagraph.Item["ArticleItemTheme"].ToString() : string.Empty; string articleItemShape = Pageview.CurrentParagraph.Item["ArticleItemShape"] != null ? Pageview.CurrentParagraph.Item["ArticleItemShape"].ToString() : "boxed"; string shapeClass = " rounded-0"; if (articleItemShape == "rounded") { shapeClass = " rounded-4"; } string settingsClassGrid = string.Empty; switch (gridSettings) { case "2": settingsClassGrid = " grid-md-2"; break; case "3": settingsClassGrid = " grid-md-3"; break; case "4": settingsClassGrid = " grid-md-2 grid-lg-3 grid-xl-4"; break; case "5": settingsClassGrid = " grid-md-2 grid-lg-3 grid-xl-5"; break; } string gridWrapperStart = articleListLayout == "grid" ? $"<div class=\"article-list grid gap-4 grid-1{settingsClassGrid}\">" : null; string gridWrapperEnd = articleListLayout == "grid" ? "</div>" : null; 10 11 bool hasListContext = Pageview.CurrentParagraph.Item["ListContext"] is object; } @if (hasItems || count > 0) { @(gridWrapperStart) foreach (LoopItem item in GetLoop("ItemPublisher:Items.List")) { string title = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Title")) && !item.GetBoolean("ItemPublisher:Item.HideTitle") ? item.GetString("ItemPublisher:Item.Title") : string.Empty; string coverTitle = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.CoverTitle")) ? item.GetString("ItemPublisher:Item.CoverTitle") : string.Empty; string coverImagePath = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.CoverImage")) ? item.GetString("ItemPublisher:Item.CoverImage") : string.Empty; bool hasFocalPoint = item.GetBoolean("ItemPublisher:Item.CoverImage.ImageHasFocalPoint"); int focalX = hasFocalPoint ? item.GetInteger("ItemPublisher:Item.CoverImage.FocalX") : 0; int focalY = hasFocalPoint ? item.GetInteger("ItemPublisher:Item.CoverImage.FocalY") : 0; int xPos = 100 - ((100 - focalX) / 2); int yPos = ((100 - focalY) / 2); string cssPosition = $"{xPos}% {yPos}%"; string summary = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Summary")) ? item.GetString("ItemPublisher:Item.Summary") : string.Empty; string publishedDate = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.PublishedDate")) && !item.GetBoolean("ItemPublisher:Item.HidePublishedDate") ? item.GetDate("ItemPublisher:Item.PublishedDate").ToShortDateString() : string.Empty; string link = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.Url")) ? item.GetString("ItemPublisher:Item.Url") : string.Empty; string buttonLabel = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.ButtonLabel")) ? item.GetString("ItemPublisher:Item.ButtonLabel") : string.Empty; string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; bool renderContentWrapper = true; bool renderArticleInfoWrapper = true; if (string.IsNullOrEmpty(title) && string.IsNullOrEmpty(summary) && string.IsNullOrEmpty(publishedDate) && item.GetInteger("ItemPublisher:Item.Author") == 0 && !showButton) { renderContentWrapper = false; } if (string.IsNullOrEmpty(publishedDate) && item.GetInteger("ItemPublisher:Item.Author") == 0) { renderArticleInfoWrapper = false; } switch (articleItemLayout) { case "image-left": case "image-right": articleItemLayoutClass = !string.IsNullOrEmpty(coverImagePath) && renderContentWrapper ? "flex-lg-row" : articleItemLayoutClass; break; } string imageObjectFit = ratio != string.Empty ? "object-fit: cover;" : "object-fit: contain;"; string coverTheme = !string.IsNullOrEmpty(item.GetString("ItemPublisher:Item.CoverTheme")) ? item.GetString("ItemPublisher:Item.CoverTheme") : string.Empty; string themeClass = string.Empty; string coverImageWrapperClass = string.Empty; if (!string.IsNullOrEmpty(coverTheme)) { articleItemTheme = coverTheme; } if (articleItemTheme != string.Empty) { themeClass = " theme " + articleItemTheme; } 12 13 // Exclude self from list - if list has context (Tags) and if is on same page 14 bool excludeSelf = item.GetInteger("ItemPublisher:Item.Field.PageId") == item.GetInteger("ItemPublisher:Global.PageId"); 15 bool renderItem = true; renderItem = hasListContext && excludeSelf ? renderItem = false : !hasListContext && !excludeSelf ? renderItem : renderItem; if (renderItem) 16 { <article class="card border-0 @(string.IsNullOrEmpty(themeClass) ? "gap-3" : null) @articleItemLayoutClass@(themeClass)@(shapeClass) overflow-hidden @LiftOnHover() @ShadowOnHover()" itemscope itemtype="https://schema.org/CreativeWork" style="background-color: var(--swift-background-color)"> @if (!string.IsNullOrEmpty(coverImagePath)) { if (Path.GetExtension(coverImagePath).ToLower() == ".svg") { if (!renderContentWrapper) { coverImageWrapperClass = "d-flex justify-content-center align-items-center h-100 w-100 "; } else { coverImageWrapperClass = "w-100 "; } <a class="@(coverImageWrapperClass)@(orderReverseClass)" title="@title" href="@link" tabindex="-1"> <div class="d-flex justify-content-center align-items-center overflow-hidden@(ratioCssClass)" @ratioVariable> @ReadFile(coverImagePath) </div> </a> } else { if (articleItemLayout == "image-top") { <a class="position-relative" title="@title" href="@link" tabindex="-1"> <figure class="overflow-hidden m-0 mx-auto@(ratioCssClass)" @ratioVariable> <text>@{RenderImage(coverImagePath, title, cssPosition, articleItemLayout, imageObjectFit, gridSettings, carouselSettings);}</text> </figure> </a> } else { if (renderContentWrapper) { coverImageWrapperClass = "col-lg-5"; } <a class="col @(coverImageWrapperClass)@(orderReverseClass)" title="@title" href="@link" tabindex="-1"> <figure class="h-lg-100 overflow-hidden m-0 mx-auto ratio ratio-16x9"> <text>@{RenderImage(coverImagePath, title, cssPosition, articleItemLayout, imageObjectFit, gridSettings, carouselSettings);}</text> </figure> </a> } } } @if (renderContentWrapper) { <div class="col d-flex flex-column @GetPadding(themeClass)"> <div class="card-body p-0 d-flex flex-column gap-2"> @*Show tag stickers*@ @GetCategorySticker(item) @if (!string.IsNullOrEmpty(title)) { <a class="text-decoration-none text-decoration-underline-hover" href="@link"> <h3 class="@titleFontSize mb-0" itemprop="headline">@title</h3> </a> } @if (!string.IsNullOrEmpty(summary)) { <p class="m-0 opacity-75">@summary</p> } @*Show tag stickers*@ @GetTagStickers(item) @if (showButton) { <div class="mt-auto"> @if (!string.IsNullOrEmpty(buttonLabel)) { <a href="@link" class="text-start btn btn-link p-0"> @buttonLabel <span class="icon-auto"> @ReadFile(iconPath + "arrow-right.svg") </span> </a> } else { <a href="@link" class="btn btn-link p-0 lh-1 text-start"> <span class="icon-auto"> @ReadFile(iconPath + "arrow-right.svg") </span> </a> } </div> } </div> @if (renderArticleInfoWrapper) { <div class="card-footer p-0 pt-3 border-top-0"> <div class="d-flex align-items-center justify-content-between gap-3"> @if (item.GetInteger("ItemPublisher:Item.Author") != 0) { int authorID = item.GetInteger("ItemPublisher:Item.Author"); var author = Dynamicweb.Security.UserManagement.User.GetUserByID(authorID); string authorImage = !string.IsNullOrEmpty(author.Image) ? author.Image : string.Empty; string authorImagePath = !string.IsNullOrEmpty(author.Image) ? $"/Admin/Public/GetImage.ashx?image={author.Image}&width=24&height=24&Crop=0&format=webp" : string.Empty; string authorName = !string.IsNullOrEmpty(author.Name) ? authorName = author.Name : string.Empty; string authorJobTitle = !string.IsNullOrEmpty(author.JobTitle) ? authorJobTitle = author.JobTitle : string.Empty; <div class="d-flex align-items-center gap-2 fs-8 opacity-75"> @if (!string.IsNullOrEmpty(authorImage)) { <img class="img-fluid rounded-circle" src="@authorImagePath" loading="lazy" alt="@authorName" width="24" height="24"> } else { <div class="d-flex align-items-center justify-content-center rounded-circle" style="background-color: rgba(var(--swift-foreground-color-rgb),.25)"> <div class="icon-2 p-1"> @ReadFile(iconPath + "user.svg") </div> </div> } <div class="d-flex flex-column lh-1"> @if (!string.IsNullOrEmpty(authorName)) { <span itemprop="author">@authorName</span> } @if (!string.IsNullOrEmpty(authorJobTitle)) { <span class="opacity-75">@authorJobTitle</span> } </div> </div> } @if (!string.IsNullOrEmpty(publishedDate)) { string articleDateTime = item.GetDate("ItemPublisher:Item.PublishedDate").Year + "-" + item.GetDate("ItemPublisher:Item.PublishedDate").Month + "-" + item.GetDate("ItemPublisher:Item.PublishedDate").Day; <div class="d-flex align-items-center gap-1 fs-8 opacity-75"> <div class="icon-1"> @ReadFile(iconPath + "calendar.svg") </div> <time datetime="@articleDateTime" itemprop="datePublished">@publishedDate</time> </div> } </div> </div> } </div> } </article> 17 } 18 } @* Placeholders (skeleton) *@ for (int i = 0; i < count; i++) 19 { string imageWrapper = string.Empty; string ratioString = ratioCssClass; 20 switch (articleItemLayout) 21 { 22 case "image-left": 23 case "image-right": 24 articleItemLayoutClass = " flex-lg-row"; 25 imageWrapper = "col col-lg-5"; ratioString = string.Empty; 26 break; 27 } <div class="htmx-indicator" aria-hidden="true" aria-disabled="true" aria-label="loading"> <div class="card placeholder-glow@(shapeClass) overflow-hidden@(articleItemLayoutClass)" style="background-color: var(--swift-background-color); border: 1px solid rgba(var(--swift-foreground-color-rgb), 0.2);"> <div class="@(imageWrapper) placeholder@(orderReverseClass)"> <div class="@(ratioString)" @ratioVariable></div> </div> <div class="col d-flex flex-column"> <div class="card-body"> <div class="mb-2"> <span class="placeholder col-2"></span> </div> <div class="h5 card-title"> <span class="placeholder col-6"></span> <span class="placeholder col-2"></span> </div> <p class="card-text"> <span class="placeholder placeholder-sm col-2"></span> <span class="placeholder placeholder-sm col-4"></span> <span class="placeholder placeholder-sm col-4"></span> <span class="placeholder placeholder-sm col-3"></span> <span class="placeholder placeholder-sm col-6"></span> <span class="placeholder placeholder-sm col-3"></span> </p> </div> <div class="card-footer"> <div class="d-flex justify-content-between"> <span class="placeholder placeholder-sm col-2"></span> <span class="placeholder placeholder-sm col-2"></span> </div> </div> </div> </div> </div> 28 } @(gridWrapperEnd) @* Load more *@ if (Pageview.Page.Item.SystemName == "Swift_ArticleListPage" && showLoadMore && articleListLayout == "grid") { <div class="text-center pt-5"> <p class="fs-7 mb-3 opacity-75">@Translate("Showing") <span>@count</span> of <span>@totalItems</span> @Translate("items")</p> <div class="progress mb-4 mx-auto" style="height:3px;max-width:300px; background-color:rgba(var(--swift-foreground-color-rgb), 0.2);"> <div class="progress-bar" role="progressbar" aria-label="Showing" style="width:@(percent)%;background-color:rgba(var(--swift-foreground-color-rgb), 1);" aria-valuenow="@(percent)" aria-valuemin="0" aria-valuemax="100"></div> </div> @if (!disableLoadMoreButton) { <div> <input type="hidden" id="PageSize_@(Pageview.CurrentParagraph.ID)" name="PageSize" /> <label class="btn btn-primary @disabled" for="PageSize_@(Pageview.CurrentParagraph.ID)" @loadMore>@Translate("Load more")</label> </div> } </div> } } @if(!hasItems || count == 0) { 29 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; <div class="grid grid-1" style="place-items: center;"> <span class="icon-7"> @ReadFile(iconPath + "filter.svg") </span> <h3 class="m-0">@Translate("No items found")</h3> <p class="m-0 fs-7 text-center">@Translate("Sorry, that filter combination has no results.") <br> @Translate("Please try different criteria")</p> <button type="button" aria-label="Clear filters" onclick="clearFilters(event)" class="mt-2 btn btn-secondary btn-sm d-flex align-items-center"> @Translate("Clear filters") <span class="icon-2 ms-2"> @ReadFile(iconPath + "refresh-ccw.svg") </span> </button> </div> <script> var clearFilters = (event) => { const form = event.target.closest('form'); form.reset(); let elements = form.elements; 30 for (var i = 0, element; element = elements[i++];) { 31 switch (element.type) { 32 case "textarea": 33 case "hidden": 34 element.value = ''; 35 break; 36 case "radio": 37 case "checkbox": 38 if (element.checked) { 39 element.checked = false; 40 } 41 break; 42 case "select-one": 43 element.selectedIndex = -1; 44 break; 45 default: 46 break; 47 } 48 } 49 form.dispatchEvent(new window.Event('change', { bubbles: true })) } </script> } @functions { 50 void RenderImage(string coverImagePath, string title, string cssPosition, string articleItemLayout, string imageObjectFit, string gridSettings, string carouselSettings) { coverImagePath = Dynamicweb.Context.Current.Server.UrlEncode(coverImagePath); if (articleItemLayout != "image-top") { imageObjectFit = "object-fit: cover"; } string imgSizeSelector = "50vw"; if (gridSettings == "1" || carouselSettings == "1") { imgSizeSelector = "100vw"; } else if (gridSettings == "2" || carouselSettings == "2") { imgSizeSelector = "50vw"; } else if (gridSettings == "3" || carouselSettings == "3") { imgSizeSelector = "33vw"; } else if (gridSettings == "4" || carouselSettings == "4") { imgSizeSelector = "25vw"; } else if (gridSettings == "5" || carouselSettings == "5") { imgSizeSelector = "17vw"; } string coverImagePathM = $"/Admin/Public/GetImage.ashx?image={coverImagePath}&width=640&format=webp"; string coverImagePathL = $"/Admin/Public/GetImage.ashx?image={coverImagePath}&width=960&format=webp"; string imagePathFallBack = coverImagePathM; <img srcset=" @coverImagePathM 640w, @coverImagePathL 960w" src="@imagePathFallBack" sizes="(min-width: 992px) @imgSizeSelector, 100vw" loading="lazy" decoding="async" class="img-fluid image-zoom-lg-1-hover" style="@imageObjectFit; object-position: @cssPosition;" alt="@title"> } 51 }
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing