Skip to main content

Notifications

Power Pages - Power Apps Portals
Unanswered

Portal: search results page

Like (1) ShareShare
ReportReport
Posted on 16 Aug 2024 08:47:13 by 2
Hi there,
 
We currently have the search results page set up that the results are only listed with their KB-no, instead of the actual title of the knowledge base item.
 
 
If there are multiple results, this is not very user friendly and why we want to change it to contain also the title of the knowledge base item. I found the following in code:
<ul class='search-results'>
{% for result in searchindex.results %}
<li>
<h4>
<a title='{{ result.title | escape }}' href='{{ result.url | escape }}'>{{ result.title }}</a>
</h4>
<p class='fragment'>{{ result.fragment }}</p>
</li>
{% endfor %}
</ul>
 
But I have no idea what to fill in with <a title> so that it also contains the name of the KB item.
 
Any assistance? 
 
Thanks,
Robbert
Categories:
  • Suggested answer
    Inogic Profile Picture
    Inogic 861 on 27 Aug 2024 at 12:34:44
    Portal: search results page
    Hi,
     
    To enhance your search results page in Power Pages (formerly known as Power Apps Portals) by including the title of each Knowledge Base (KB) item alongside its number, you'll need to modify the page template or the code used to render the search results.

    If you're using Liquid templates to render the search results, you can modify the template to include both the KB number and title. Here’s how you might do it:

    {% if search_results %}
      <ul>
        {% for result in search_results %}
          <li>
            <a href="{{ result.url }}" title="{{ result.title }}">
              {{ result.kb_number }}: {{ result.title }}
            </a>
          </li>
        {% endfor %}
      </ul>
    {% else %}
      <p>No results found.</p>
    {% endif %}

    Make sure that the fields you’re referencing (url, title, kb_number) are available in your search results data.

    Hope this helps.
     
    Thanks!
    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Drop an email at crm@inogic.com 
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 
  • Suggested answer
    Fubar Profile Picture
    Fubar 7,643 on 21 Aug 2024 at 22:17:27
    Portal: search results page
    Not sure you will be able to do what you want, it is made more difficult as the results from search itself do not expose all fields on the underlying record and search often is configured to run over multiple record types, see the attributes/properties available
     
    to get additional information you may potentially need to get the Id and entity logical name out of the result and use them to know what table your result is for and then get the additional field data either from the entity object in the results object or to directly reference the underlying record using the id

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,769

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,466

Leaderboard
Loading started