Ir al contenido principal

Can I show details for the most recent edit to a Knowledgebase article? (Old) - Base de conocimiento / Developer & Reporting / Portal Customization - Deskpro Support

Can I show details for the most recent edit to a Knowledgebase article? (Old)

Lista de autores

 

Question:

By default, when you're viewing a Knowledgebase article on the user portal, Deskpro shows the original date it was created on the article, not the date of the last edit. And it only shows the first author, not any later contributors. Can I change this?

Answer:

You can edit the portal templates to change this. In admin, go to Portal > Templates and select the Articles > article.html

Edit the code that shows the date the article was created:

To show the last modified date instead, replace the highlighted code with this:

{{ (article.revisions.last.date_created|default(article.date_created))|date('full') }}

Similarly, you can edit the code that shows the author -

{{article.person.display_name_user }}

- and replace it with:

{{ article.by_line }}

The article.by_line variable is a list of all the agents who have edited the article, separated by commas:

 


 

Alternatively, you could use some more advanced code to loop over the article revisions and display the details of each one.

For example, replacing the two whole of the two lines we edited above with this code:


{% if article.revisions|length > 1 %}
    <ul class="dp-post-info">
    {% for rev in article.revisions %}
        <li><i class="dp-icon-calendar"></i> Changes by {{ rev.person.display_name_user }} on {{ rev.date_created|date('full') }}<br/></li>
    {% endfor %}
    </ul>
{% endif %}

displays the article's revision history like this:

Útil Poco útil

34 de 74 personas considera que esta página es útil

Nuevo comentario

Por favor, ingresa o regístrate para enviar un comentario.

¿Necesitas que te recordemos la contraseña?