Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
news-listing.vtl 3.26 KiB

## news pull
#if($pagination.contains('true'))
	#set($newsListing = $dotcontent.pullPerPage("
		+contentType:Article
		## $host.identifier or set host in widget
		+(conhost: )
						   ## page variable
		$!{relationship}$!{content.identifier}
		",$!{page},10,"modDate desc"
	))
#else
	#set($newsListing = $dotcontent.pull("
		+contentType:Article
		## $host.identifier or set host in widget
		+(conhost: )
						   ## page variable
		$!{relationship}$!{content.identifier}
		",$!{page},10,"modDate desc"
	))
#end

<section itemscope itemtype="http://schema.org/Article">
#if ($UtilMethods.isSet($headline))
  #if (!$UtilMethods.isSet($headlineFontSize))
    #set ($headlineFontSize = '1')
  #end
  <h$!{headlineFontSize}>
  	#if($UtilMethods.isSet($newsHomepageUrl))
  		<a href="${newssHomepageUrl}">
  	#end
  	$!{headline}
  	#if($UtilMethods.isSet($newsHomepageUrl))
  		</a>
  	#end
  </h$!{headlineFontSize}>
#end
#if($newsListing.size() > 0)
	<ul class="">
		#foreach($news in $newsListing)
			<li class="">
				#editContentlet($news.inode)
				#if($fieldsToDisplay.contains('image') && $UtilMethods.isSet($news.image))
					<a itemprop="url" href="$news.urlTitle">
						<img itemprop="image" class="" alt="$news.imageDescription" src="">
					</a>
					#if($fieldsToDisplay.contains('imageCaption') && $UtilMethods.isSet($news.caption))
						<p class="" itemprop="caption">$news.caption</p>
					#end
				#end

				#set($newsTitleSize = $headlineFontSize - 1)
				<h$!{newsTitleSize} itemprop="name"><a itemprop="url" href="$news.urlTitle">$news.title</a></h$!{newsTitleSize}>

				#if($fieldsToDisplay.contains('date'))
					#if($UtilMethods.isSet($news.publishDate))
						<p itemprop="datePublished" class="">$date.format('MMMM d, yyyy', $news.publishDate)
					#else
						<p itemprop="dateModified" class="">$date.format('MMMM d, yyyy', $news.modDate)</p>
					#end
				#end

				###########
				## author
				###########
				#if($fieldsToDisplay.contains('author'))
				#set($related-authors = $dotcontent.pullRelated("Author-Article","$news.identifier",true,10,"person.lastName asc"))
					#if($related-authors.size() > 0)
						#foreach($author in $related-authors)
							#if($foreach.count==1)
								<p itemprop="author" class=""> 
							#end
							<a href="$author.urlTitle">$author.givenName $author.familyName</a>#if($foreach.hasNext), #end
							#if(!$foreach.hasNext)
								</p>
							#end
						#end
					#elseif($news.authorText.length() > 0)
						<p itemprop="author" class="">$news.authorText</p>
					#end
				#end


				#if($fieldsToDisplay.contains('summary') && $UtilMethods.isSet($news.description))
					<p itemprop="description">$news.description</p>
				#end
			</li>
		#end
	</ul>
	#if($pagination.contains('true') && $newsListing.totalPages > 1)
		<ul class="pagination">
			#if($newsListing.previousPage)
				<li><a href="$!{VTLSERVLET_URI}?page=$!{math.sub($page, 1)}">&laquo;</a></li>
			#end
			#foreach($i in [1..$newsListing.totalPages])
				<li #if($page == $velocityCount)class="active"#end><a href="$!{VTLSERVLET_URI}?page=${velocityCount}">$velocityCount</a></li>
			#end
			#if($newsListing.nextPage)
				<li><a href="$!{VTLSERVLET_URI}?page=$!{math.add($page, 1)}">&raquo;</a></li>
			#end
		</ul>
	#end
#else
  <p>There are no news stories at this time.</p>
#end
</section>