Articles from search bar opened in a new tab/window

Répondu

10 Commentaires

  • Phil Williams
    Community Moderator

    Have you tried editing the template search_results.hbs so that where the search results links to the articles you add target="_blank" to the href element?

    So in my search_results.hbs template, I would change:

    <a href="{{url}}" class="results-list-item-link">{{title}}</a>

    to:

    <a href="{{url}}" class="results-list-item-link" target="_blank">{{title}}</a>

    This might vary for you as the link might not look exactly like the above but the principle will be the same.

    1
  • Phil Williams
    Community Moderator

    Ah, are you referring to the results that appear directly below the search field and change dependent on the text being searched for?

    1
  • Phil Williams
    Community Moderator

    OK understood. I'll have to dig into the code but I don't think its possible.

    1
  • Renato Milan dos Santos

    Hello, Phil Williams! Thanks for your message!

    Yes, I have tried it, but this changed the behaviour of my search results page, I mean, the one returned by this URL: https://MySubdomain.zendesk.com/hc/es/search?utf8=&query=.

    I would like to have the same behaviour implemented when an article suggested by the search bar field on home page is chosen. Any guess how to achieve that?

    Regards,

    Renato

    0
  • Renato Milan dos Santos

    Exactly this one!

    0
  • Renato Milan dos Santos

    Hi, Phil Williams! Thanks for your reply!

    Unfortunately I haven't got such technical knowledge to move myself forward through this way.

    Do you think this is the case to leave a Feedback on Guide to make that possible without having "to dig into the code"?

    Regards,

    Renato

    0
  • Phil Williams
    Community Moderator

    It certainly wouldn't hurt to suggest it.

    If I find some time I'll see if I can put together an example tutorial.

    You could also look towards one of the Zendesk partners to do some custom work for you?

    0
  • Renato Milan dos Santos

    Hi, Phil Williams!

    I'll check this out! Meanwhile, I try to move forward with the results_page. I was able to add something like that:

    <a href="{{url}}"{{#isnt name 'MyHelpCenterName'}} target="_blank"{{/isnt}}>{{name}}</a>

    But not the following:

    <a href="{{url}}"{{#isnt name help_center.name}} target="_blank"{{/isnt}}>{{name}}</a>

    Based on the available properties from search results page, I should be able to get the {{help_center}} object, shouldn't be?

    Regards,

    Renato

    0
  • Phil Williams
    Community Moderator

    Yes, you can get that through the Help Centres Filter property:

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

     

    0
  • Phil Williams
    Community Moderator

    OK it doesn't look like this is going to be easily changed.

    When the instant search is triggered it makes an internal API call to here: https://yourdesk.zendesk.com/hc/api/internal/instant_search.json?query=searchterm&locale=en-gb which then generates the dynamic result.

    I think the only way you're going to be able to change the link behaviour is to reverse engineer this function. It's possible to do but will take a little work.

    You effectively will have to build your own dynamic search to query your help centre articles using the API:

    https://developer.zendesk.com/rest_api/docs/help_center/search

    The form itself could do the job using jquery:

    https://www.sitepoint.com/14-jquery-live-search-plugins/

    It's going to be down to you to be a little creative I'm afraid! ;)

     

    -1

Vous devez vous connecter pour laisser un commentaire.

Réalisé par Zendesk