Recent searches
No recent searches
Excluding text from search, is it possible?
Posted Mar 14, 2024
At the bottom/end of each article I have a document versioning table where writers can add notes for what changed over time. My style sheet hides the table (display:none), but the text is included in search. I am looking for a way to exclude hidden text from search.
My style sheet:
/* Document Versions Table allows writers to document article changes that are not visible in published articles*/
div.DocumentVersion {
width: 100%;
text-align: left;
display: none; }
/* END Document Versions Table */
Table in articles:
<div class="DocumentVersion">
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr>
<td style="width: 22.6191%;">
<strong>Document Version</strong>
</td>
<td style="width: 15.7618%;">
<strong>Date</strong>
</td>
<td style="width: 61.619%;">
<strong>Description of Change</strong>
</td>
</tr>
<tr>
<td style="width: 22.6191%;"></td>
<td style="width: 15.7618%;"></td>
<td style="width: 61.619%;"></td>
</tr>
</tbody>
</table>
</div>
<p> </p>
0
1 comment
Jakub
Hello Lorrie McConnell
You can manipulate the search results on the client side using JavaScript to remove the unwanted text programmatically after the search results are displayed. This approach involves writing a script that runs after the search results are loaded and then searches for and removes the text related to the document versioning table.
Here's a conceptual example of how you might do this with JavaScript:
As you can see on this screenshot, even though I search for Document version this string is not visible in the search results. This is only "visual" removal of that element, but still the results including this text will be returned:
0