Updated Helpers for the Unified Search Results Page

6 コメント

  • Brad Marshall

    This is missing some added attributes for {{results}}. The only one I know that is not documented is {{type}}.

    0
  • Ryan McGrew

    Thanks for reaching out Brad. Let me check with the team and see if we should be updating the documentation. Thanks!

    0
  • Ryan McGrew

    Hey Brad,

    I just re-checked this an type is the only property not currently in our documentation this is in the object itself. 

    I will get the docs updated. Thanks!

    0
  • Karen D Snyder

    Is it possible for code in script.js to access the {{results}} and {{results_count}} objects? I am asking because we do not want to show articles with 'Forms' in the title in the search results, as those are not real knowledge base articles; they contain HTML to display form icons on the category pages.

    0
  • Bogdan Andrei Sturzoiu

    Hi Karen,

    we don't provide direct access to the objects, but you can manipulate the HTML that is generated at runtime - something along the lines of document.querySelectorAll('.results-list-item') and then extract the content and check if it contains "Forms".

    Wouldn't it be easier though to hide these articles behind a user segment that nobody is a part of? Then they would not surface into the search results in the first place.

    0
  • Karen D Snyder

    Hi Bogdan,

    I am manipulating the HTML at runtime with $('.results-column .results-list .results-list-item a.results-list-item-link:contains("Forms")'), which does work when the results fit on one page. But when the results are more than one page long, there are strange effect because Ii script.js I have access only to the current page of results, For instance, if there are 20 total results (two pages), and 10 results on the first page contain Forms, then the first result page has no results, while the second result page has 10 results, which is confusing to the user. I would also have no way of being sure that I can correctly manipulate the overall total at the top of the page, as there could be more than one result page that contains results with 'Forms'.

    As for hiding these articles behind a user segment that nobody is part of, that would make the articles inaccessible and then the form icons would not display.

    0

ログインしてコメントを残してください。

Powered by Zendesk