0

I have a list of knowledge articles are are displayed on my Force.com site. Is there a way to display these articles in the order of created date? Display the latest on top?

I am very new to this and any help will be appreciated.

Here is my code of visualforce Page:

<head>
 <title>{!pageTitle}</title>
 <apex:outputText rendered="{!searchExecuted}">
   <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW" />
</apex:outputText>
 <meta name="apple-mobile-web-app-capable" content="yes"></meta>
  <meta name="google-site-verification" content="5RGxzbeLEuzShgu4D8M-FOJp-Od16pOtEhd7dDkJdKI" />
  <meta name="google-site-verification" content="UlsZy8bKchrjHlXGMjkMMmK0dpF6Nh7cX8I92tANbEs" />
 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1" />
 <meta name="apple-mobile-web-app-capable" content="yes" />
 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
   <link rel="icon" type="image/vnd.microsoft.ico" href="http://www.webcentral.com.au/favicon.ico" />
  <script src="{!$Resource.pkb_jquery_1_6_2}" type="text/javascript" />
   <script src="{!$Resource.pkb_jquery_simplemodal_1_4_1}" type="text/javascript" />
   <apex:outputText rendered="{!viewingArticle}">
    <apex:variable var="typeName" value="{!SUBSTITUTE(pkbCon.theKad.articleTypeName, pkbCon.kavExtension, '')}" />
    <apex:variable var="articleURL" value="{!pkbCon.currentSiteUrl}articles{!pkbCon.selectedLanguageURL}{!typeName}/{!pkbCon.theKad.urlName}" />
   <meta property="og:title" content="{!pkbCon.theKad.title}"/>
    <meta property="og:type" content="article"/>
    <meta property="og:url" content="{!articleURL}"/>
    <meta property="og:site_name" content="{!SUBSTITUTE(pkbCon.siteName,'_',' ')}" />
    <meta property="og:description" content="{!pkbCon.theKad.summary}"/>
    <meta property="description" content="{!pkbCon.theKad.summary}"/>
    <link rel="canonical" href="{!articleURL}"/>
  </apex:outputText>
  <apex:outputText rendered="{!NOT(viewingArticle)}">
   <meta property="description" content="Expert help and support articles for WebCentral products and services."/>
  </apex:outputText>
  <c:wc_pkb_css />
  <c:wc_css_bootstrap />
  <c:wc_css />
  <c:wc_pkb_js pkbCon="{!pkbCon}" />
 </head>

1 Answer 1

0

Assuming you are using PKB version 3, this is an unmanaged package. You can change the query in "PKB_Controller" and "PKB_Mobile_Controller" to add order by to the queries you are after.

You might find something like below

  String q = '';
q += 'select ' +join(kavFields, ',')+ ' from KnowledgeArticleVersion';
q += ' where PublishStatus = \'' +pkb_Controller.DEFAULT_PUBLISH_STATUS+ '\' and Language = \'' +lang+ '\' and KnowledgeArticleId in :aids order by LastPublishedDate desc';

That you can change to

 String q = '';
q += 'select ' +join(kavFields, ',')+ ' from KnowledgeArticleVersion';
q += ' where PublishStatus = \'' +pkb_Controller.DEFAULT_PUBLISH_STATUS+ '\' and Language = \'' +lang+ '\' and KnowledgeArticleId in :aids order by createddate desc';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .