Прескочи към главното съдържание

Can I show details for the most recent edit to a Knowledgebase article? (Old) - База знание / Developer & Reporting / Portal Customization - Deskpro Support

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

Списък с автори



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?


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 %}
{% endif %}

displays the article's revision history like this:

Полезен Не беше полезно

29 от 61 души смятат тази страница за полезна

Добави коментар

Моля, логнете се или се регистрирайте, за да оставите коментар.

Подсещане за парола?