More in this section
Forums / General Discussions / Show HTML content in search results

Show HTML content in search results

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Carina Olsson
    Carina Olsson avatar
    3 posts
    Registered:
    16 Apr 2010
    29 Mar 2011
    Link to this post
    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" />
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Apr 2011
    Link to this post
    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
2 posts, 0 answered