Forum Discussion

etisson's avatar
7 months ago

show last edited date on TKB articles

Hi all,

I have been struggling with a requirement we have for our TKB.

OOO, Khoros shows the creation date for TKB articles. We regularly update our TKB articles and as such we want to show last edited date on TKB articles.

Has anyone done the same and can guide me in the right direction? 

I have been trying to update the theme-lib.utility-macros to show the last_post_time but that does not seem to work.

Any ideas would be appreciated.

Thanks,.

Erik

  • HariniVuppala suggestion is one way to achieve this, but maybe you want some more control over the output and/or you are not interested in displaying the original post date but only want the last edit date etc., so another option that I'm using sometimes for stuff like this is to @override the OOB post_date component which is commonly used to display dates. As this component is used not only for TKB's but for other content types as well, you'd have to scope it to only do that when it's used to display on a TKB Article which you would do with something like this:

    <#if page.interactionStyle == 'tkb' && page.name == 'TkbArticlePage'>
        <#assign query = "SELECT current_revision.last_edit_time FROM messages WHERE id = '${page.context.thread.topicMessage.id}'" />
        <#assign res = (liql(query).data.items[0])!{} />
        <#-- You might wanna transform that ISO date to something more readable when displaying it, freemarker has some built ins for that purpose -->
        <time datetime="${res.current_revision.last_edit_time}">${res.current_revision.last_edit_time}</time>
    <#else>
        <@delegate /> <#-- displays original component content -->
    </#if>
  • etisson You can use the 'TKB Article Details and Options' component, provided by Khoros, in the TKB article page header quilt. This component allows you to view information such as the article's creation and modification dates along with user details.

  • HariniVuppala , luk , thank you both for your replies. I will try these and see what works best for me. 

    Do any of you have a similar way of showing the last edit date for TKB articles in the activity feeds? 

    • luk's avatar
      luk
      Boss
      Do any of you have a similar way of showing the last edit date for TKB articles in the activity feeds?

      etisson That might get more ugly if you are using the out of the box component, because yes, you can use the @override approach, but you would most likely have to regex the heck out of the HTML (which I would only do as a very very last resort option) to catch the right dates...So probably for an activity feed it might be easier to just re-do it with a custom component and then you can simply use the proper date from the get-go.