Skip to main content

Notifications

Community site session details

Community site session details

Session Id : OAZv9EWnpNWSNepe1eWrbM
Power Pages - Power Apps Portals
Unanswered

Portal: search results page

Like (1) ShareShare
ReportReport
Posted on 16 Aug 2024 08:47:13 by 4
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
    983 Super User 2025 Season 1 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
    7,875 Super User 2025 Season 1 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Pages - Power Apps Portals

#1
Ajlan Profile Picture

Ajlan 6

#1
stampcoin Profile Picture

stampcoin 6

#3
CU21010422-0 Profile Picture

CU21010422-0 4

Overall leaderboard
Loading started