Forum

Thread tagged as: Problem

Search Results - removing certain things from excerpt.

Hi, I've got a search form on my site which brings back results. However in the result I'm getting the full path of any links that are within the initial text on the page. In this case I have a button below the initial paragraph which links to a data sheet. So as a search result I'm getting the following:

P3231 Two Component Balance This is a unique system employing vertical and horizontal balance beams to provide independent measurements of lift and drag forces. admin resources p3231 issue 3 pdf no mechanics-of-fluids P3231 - Two Component Balance p3231 two component balance…

What I'd like to do is omit the button links from the search excerpt if that is possible

This is the code I have on my search result template

        <li class="<perch:content id="product-category"/>">
            <h2><a href="<perch:search id="result_url" />?s=<perch:content id="slug" type="slug" class="entry-title" />"><perch:search id="result_title" /></a></h2>
            <perch:if exists="result_excerpt"><p class="excerpt"><perch:search id="result_excerpt" encode="false" />…</p></perch:if>
            <p class="on-page"><span class="italic">On page:</span> <a href="<perch:search id="result_url" />">
                <perch:if exists="result_pageNavText">
                    <perch:search id="result_pageNavText" />
                <perch:else />
                    <perch:search id="result_url" />
                </perch:if>
                </a></p>
        </li>

And here is the template the results are pulled out of

<section class="content product">
    <article class="details">
        <h1 class="item_name"><span><perch:content id="product-code" type="text" label="Product Code (s)" textile="true" editor="markitup" required="false" title="true"/></span><perch:if exists="product-code"> - </perch:if><perch:content id="product-name" type="text" label="Product Name" textile="true" editor="markitup" required="true" title="true"/></h1>
        <p class="intro"><perch:content id="product-intro" type="textarea" label="Product Introductory Paragraph" textile="true" editor="markitup" required="true" striptags="true"/></p>

        <perch:if exists="bullets"><h2>Experimental Capabilities</h2>
                <ul>
                    <perch:repeater id="bullets" label="Bullet Points"><li><perch:content id="bullets" type="textarea" label="Product Bullet Points" textile="true" editor="markitup" required="false" striptags="true" /></li></perch:repeater>
                </ul>
        </perch:if>

        <perch:if exists="datasheet"><a href="<perch:content id="datasheet" type="file" label="Data Sheet" bucket="data-sheets"/>" class="download">Download Data Sheet</a></perch:if>

        <perch:if exists="product-description"><h3>Description</h3>
                <perch:content id="product-description" type="textarea" label="Product Description" textile="true" editor="markitup" required="false"/></perch:if>

    </article>

    <article class="images">
        <div class="main-image">
        <perch:if exists="product-image">
        <img src="<perch:content type="image" id="product-image" label="Image" width="259" crop="true"/>" class="custom" alt="placeholder">
        <perch:else /><img src="/images/placeholder.png" alt="No Image" style="border: 1px solid #ccc;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;" />
        </perch:if>
        </div>

    <ul class="thumbnails">
    <perch:if exists="product-image"><li><a href="<perch:content id="product-image" type="image" width="259" crop="true" label="Image One" required="true" help="Please choose an image with a minimum width of 350px and a minimum height of 400px otherwise featured images on the homepage will not display correctly"/>">
    <img src="<perch:content id="product-image" type="image" width="200" height="200" crop="true" label="Image One"/>" alt="Thumbnails"></a>
    </li></perch:if>

    <perch:if exists="image-two"><li><a href="<perch:content id="image-two" type="image" width="259" crop="true" label="Image Two" help="Please choose an image with a minimum width of 350px and a minimum height of 400px otherwise featured images on the homepage will not display correctly"/>">
        <img src="<perch:content id="image-two" type="image" width="200" height="200" crop="true" label="Image Two"/>" alt="Thumbnails"></a>
        </li></perch:if>

    <perch:if exists="image-three"><li><a href="<perch:content id="image-three" type="image" width="259"  crop="true" label="Image Three" help="Please choose an image with a minimum width of 350px and a minimum height of 400px otherwise featured images on the homepage will not display correctly"/>">
        <img src="<perch:content id="image-three" type="image" width="200" height="200" crop="true" label="Image Three"/>" alt="Thumbnails"></a>
        </li></perch:if>

</ul>

    </article>
</section>

It's the ID data sheet which ideally i'd like to exclude from search results if possible. Not sure how to achieve this.

Nik Gill

Nik Gill 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Add searchable="false" to the tag.

Thanks Drew, much appreciated.