Show HTML content in search results - General Discussions - General Discussions - Progress Community
 General Discussions

Show HTML content in search results

  • Show HTML content in search results
  • Hi,

    I am building a FAQ and, in the absence of the list module, I've settled for the generic content module. I put the question in the title, and the answer in the content. I then let the front-end users use the search widget to find answers for their questions.

    I want the entire question and answer to show in the search result, without highlighting of the words that match the search string. And I've done all this, but the problem is that the HTML in the answer doesn't show. Have I done something wrong (like fetching the wrong data) or is there some condition in the search result widget that doesn't allow HTML?

    (And to clarify, it's the strong tags, the br tags, the h1 tags, etc. that are stripped, or not fetched, from the answers. Everything shows as plain text.)

    This is my search widget template:

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>

    <sfSearch:SearchBox ID="topSearchBox" runat="server" />

    <sitefinity:SitefinityLabel id="resultsStats" runat="server" WrapperTagName="p" CssClass="sfsearchResultStatistics" Text="<%$Resources:SearchResources, SearchResultsStatusMessage %>" />

    <asp:Repeater ID="resultsList" runat="server">
        <HeaderTemplate>
    <div class="toggle faq">
        </HeaderTemplate>
        <ItemTemplate>
            <div class="question"><%# Eval("Title") %></div>
    <div class="answer"><%# Eval("Content")%></div>
        </ItemTemplate>
        <FooterTemplate></div>
        </FooterTemplate>
    </asp:Repeater>
    <sitefinity:Pager ID="pager" runat="server" />
    <sfSearch:SearchBox ID="bottomSearchBox" runat="server" />
  • 260693_searchResultTest.zip
    Hi Carina,

    I am  not able to replicate the issue that you are reporting. I am sending you a short video and the template I use

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>

    <sfSearch:SearchBox ID="topSearchBox" runat="server" />

    <sitefinity:SitefinityLabel id="resultsStats" runat="server" WrapperTagName="p" CssClass="sfsearchResultStatistics" Text="<%$Resources:SearchResources, SearchResultsStatusMessage %>" />

    <asp:Repeater ID="resultsList" runat="server">
        <HeaderTemplate>
            <dl class="sfsearchResultsWrp sfsearchReultTitleSnippetUrl">
        </HeaderTemplate>
        <ItemTemplate>
            <dt class="sfsearchResultTitle"><a runat="server" href='<%# Eval("Link")%>'><%# Eval("Title") %></a></dt>  
            <dd class="sfsearchResultSnippet"><%# Eval("Summary")%></dd>
            <dd class="sfsearchResultUrl"><a runat="server"  href='<%# Eval("Link")%>'><%# Eval("Link")%></a></dd>
            <%# Eval("Content")%></dd>
            
            <dd class="sfsearchResultHighLighter"><%# Eval("HighLighterResult")%></dd>
        </ItemTemplate>
        <FooterTemplate>
            </dl>
        </FooterTemplate>
    </asp:Repeater>
    <sitefinity:Pager ID="pager" runat="server" />
    <sfSearch:SearchBox ID="bottomSearchBox" runat="server" />

    Regards,
    Ivan Dimitrov
    the Telerik team