Búsquedas recientes


No hay búsquedas recientes

C.L.'s Avatar

C.L.

Incorporación 16 abr 2021

·

Última actividad 09 ene 2024

Seguimientos

0

Seguidores

0

Actividad total

7

Votos

0

Suscripciones

2

RESUMEN DE LA ACTIVIDAD

Última actividad de C.L.

C.L. hizo un comentario,

Comentario de la comunidad Q&A - Help center and community

Hi all, 

I finally implemented my solution that shows a list of Related Article if articles share the same label. Thanks for starter code and examples, Trapta and Katerina.

I put this in article_page.hbs-

and then this in my script.js, make ajax call and do formatting work (also exclude the currently loaded article)-

//Show related links in right pane
//related links are articles that share one or more labels
function insertRelLinks(){
var template_start = `

    `;
    var template_end = `
`;
var template = ``;
var jqxhr = $.ajax( showRelatedLinks() )
.done(function( data ) {
if( data.count > 0 ){
$('#rellinks-section').html((template_start + template + template_end));
$.each( data.results, function( k, v ){
var vID = $(v.id);
if(vID[0]!==articleId) //don't show link to currently loaded article
{
template += `

  • ${v.name}
  • `;
    }
    } );
    $('.related-articles').show();
    $('#rellinks-section').html((template_start + template + template_end));
    }
    });
    }
    insertRelLinks();

    It looks like-

    Ver comentario · Publicado 06 sept 2019 · C.L.

    0

    Seguidores

    0

    Votos

    0

    Comentarios


    C.L. hizo un comentario,

    Comentario de la comunidad Q&A - Help center and community

    Hi @Diziana, 

    Thanks much for the detailed code. I'm a total newbie to Curlybars and appreciate the example of accessing in-page properties. 

    I'll post back here with a screenshot when I get a chance to implement this. 

    Ver comentario · Publicado 07 may 2019 · C.L.

    0

    Seguidores

    0

    Votos

    0

    Comentarios


    C.L. hizo un comentario,

    Comentario de la comunidad Q&A - Help center and community

    Angeli,

    It seems you would have to write a function that called the ZD APIs twice- once to get the labels of the current article, and the second time to search for all articles containing the same labels (if if getting a list of articles that share labels is what you were looking to do).

    I had a hard time trying to figure out how to get the labels of the article currently loaded but I think I would do it like-

    var currentArticleID = location.href  (insert a bunch of js work to parse out the id)

    then api/v2/help_center/en-us/articles/.json would get you the current article from which you can get the label_names property. 

    then /api/v2/help_center/articles/search.json?label_names= would give you list of "related" articles

     

    Ver comentario · Publicado 07 may 2019 · C.L.

    0

    Seguidores

    0

    Votos

    0

    Comentarios


    C.L. hizo un comentario,

    Comentario de la comunidad Q&A - Help center and community

    Katerina,

    Thanks much for the code sample and explanations. I will try and adapt this to a right-had pane we have. I wonder if .js files can be added as assets, and referenced like asset png etc? It would be nice to isolate custom code from Zendesk's.templates. 

    Your site looks very nice, well done. 

    Ver comentario · Publicado 14 mar 2019 · C.L.

    0

    Seguidores

    0

    Votos

    0

    Comentarios


    C.L. hizo un comentario,

    Comentario de la comunidad Q&A - Help center and community

    Katerina, were you ever able to adapt your code to a page template? I'm interested in doing the same thing. 

    Ver comentario · Publicado 13 mar 2019 · C.L.

    0

    Seguidores

    0

    Votos

    0

    Comentarios