Promoted article - Adding a Timestamp

Respondida

7 Comentarios

  • Nicole Saunders
    Zendesk Community Manager

    Hey Stefano -

    You would need to apply some custom code to your theme in order to accomplish this. I've pinged some of our customization experts to see if they could advise you on this.

    0
  • Sebastiaan Wijchers

    Hey Stefano,

    When you go to 'Customize design' and click the 'Edit code' button of your theme. Look for the file: 'home_page.hbs'

    Starting at line 39 you'll find something like this:

        {{#if promoted_articles}}
    <section class="articles">
    <h3>{{t 'promoted_articles'}}</h3>
    <ul class="article-list promoted-articles">
    {{#each promoted_articles}}
    <li class="promoted-articles-item">
    <a href="{{url}}">
    {{title}}
    </a>
    </li>
    {{/each}}
    </ul>
    </section>
    {{/if}}

    Now you can edit the line with {{title}} to something like this:

    {{title}} - <i>{{date edited_at}}</i>

    To get this result:

    You can also use something like {{date edited_at timeago=true}} so it will display '10 minutes ago' and you probably want to make it look better. Maybe on a new line and with a smaller font or so.

     

    0
  • Stefano Nguma

    Hey Sebasttian! Exactly what I'm looking for! I give it a shot and get if I have any problems but it looks pretty straight-forward.

    Thanks again!

    0
  • Stefano Nguma

    Sorry for misspelling your name ... Sebastiaan

    0
  • Sebastiaan Wijchers

    You're welcome, and don't worry!

    If you want to know more about the date helper and formatting etc, you can have a look at the documentation:

    https://developer.zendesk.com/apps/docs/help-center-templates/helpers#date-helper

    0
  • YUYA YAMAGUCHI

    hello there,

    I would like to change the notation of the home_page.hbs timestamp.

    I tried to describe it using [date helper] as a reference, but it didn't show up as I expected.

    {{#if promoted_articles}}
    <section class="articles">
    <h2>{{t 'promoted_articles'}}</h2>
    <ul class="article-list promoted-articles">
    {{#each promoted_articles}}
    <li class="promoted-articles-item">
    <a href="{{url}}">
    {{title}} - <i>{{date article.created_at class='metadata' format='short'}}
    </i>

     

    0
  • Cheeny Aban
    Zendesk Customer Care

    Hi Yuya Yamaguchi!

    Thank you for sending a post on our Community.

    Can you elaborate further on the change that you are trying to do on the homep_page.hbs?

    All the best 

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk