Blog Post List - excerpt of 0?

Former Member
Former Member

I'm using the Blog-Post List widget and I'd like to configure it so that there is NO excerpt. I try to set the Excerpt field as "0", and it just defaults back to "1". Is there no way to display a blog's title ONLY without an excerpt at all? 

Parents
  •  

    I had a similar situation, but I only wanted to display the blog image and excluding any text. We made the images call-to-action buttons and used custom images that included the text, you can see an example here: https://sugarclub.sugarcrm.com/learn/b/sugar-for-business-users

    To do so, in Widget Studio, I copied the out-of-the-box Blog-Post List widget and created one I called "Blog - Post List - Image only." Then, I removed the code that displays the text from "listitem.vm". (Pretty sure that's the only change I made, I don't see any others at quick glance.) 

    I don't see any reason the same couldn't be done to keep the title but not the excerpt and just use that new widget when you need it. 

    Here's how that file reads on my custom/edited version:

    ##
    ## Renders an individual blog post
    ## Expects in context: $post
    ##
    
    #set ($blog = $core_v2_blog.Get("%{ Id = $post.BlogId }"))
    #if ($blog && $blog.Id > 0)
    
    	#set ($postImage = '')
    	#if ($post.PostImageUrl && $post.PostImageUrl != '')
    		#set ($postImage = $post.PostImageUrl)
    	#elseif ($blog.DefaultPostImageUrl)
    		#set ($postImage = $blog.DefaultPostImageUrl)
    	#end
    
    	#set ($showthumbnail = false)
    	#if ($displayPostImage && $postImage && $postImage != '')
    		#set ($showthumbnail = true)
    	#end
    
    <li class="content-item ${viewLayout}" data-href="$core_v2_encoding.HtmlAttributeEncode($post.Url)">
    
    	<div class="content ${viewLayout} abbreviated">
    		#if ($showthumbnail)
    			<div class="avatar">
    				#if ($viewLayout == 'grid')
    					#set ($imageWidth = 512)
    					#set ($imageHeight = 256)
    				#else
    					#set ($imageWidth = 100)
    					#set ($imageHeight = 100)
    				#end
    				<a href="$core_v2_encoding.HtmlAttributeEncode($post.Url)">
    					$core_v2_ui.GetResizedImageHtml($postImage, $imageWidth, $imageHeight, "%{border='0px', alt=$post.Name, ResizeMethod = 'ZoomAndCrop' }")
    				</a>
    			</div>
    		#end
    
    		##<div class="summary">
    		##	<h2 class="name">
    		##		#if($blog && !$oneBlog)
    		##			<a class="internal-link view-application" href="$core_v2_encoding.HtmlAttributeEncode($blog.Url)">
    		##				$blog.Name:
    		##			</a>
    		##		#end
    		##		<a href="$core_v2_encoding.HtmlAttributeEncode($post.Url)">$post.Title</a>
    		##	</h2>
    			
    		##</div>
    
    		<div class="attributes">
    			<ul class="attribute-list">
    				<li class="attribute-item">
    					<span class="attribute-value">$core_v2_language.FormatDate($post.PublishedDate)</span>
    				</li>
    			</ul>
    		</div>
    
    	</div>
    
    </li>
    #end

    Use at your own risk and make a backup, but it works well for us! 

  • Former Member
    0 Former Member in reply to Alex Nassi

     , this is SO HELPFUL! I love what you've done with images only. Wow, what a difference to have that pesky text gone. I think I'm going to copy your image only idea (unless you charge royalties... :-) ). I will test this out next week. HUGE thanks!

Reply Children