Exclude content from search results in Voog
Many website owners may have reasons for wanting to exclude certain parts of their content from search results. Whether it’s to protect sensitive information, prevent duplicate content, or improve the overall quality of search results, a variety of factors can influence this decision. In this article, we’ll explore some of the most common reasons people want to exclude content from search results and provide tips for effectively doing it.
Voog has a built-in solution to this wish; you can exclude a page, a section from a page, or just a tiny part of your content.
This is what Voog says about the search mechanism:
By default, Voog’s built-in search engine indexes all sites’ public content regularly. To improve the accuracy of search results, you can specify what parts of your pages can be indexed with special attributes.
Voog Documentation
So, let’s jump into code and learn how to exclude content from search results in Voog
// Use these in your tag as HTML attributes
data-search-indexing-allowed="false"
data-search-indexing-allowed="true"
How to exclude a part of content from search results in Voog
As I mentioned, Voog will index all the content on every page and show them in the search results. To exclude some parts of a page, like the header on your website, you can do something like this:
<header data-search-indexing-allowed="false" class="site-header">
...
</header>
Keep that in mind; it might take some time for Voog to update its indexed content and show you the exact result.
You might be wondering if you need to add this attribute to your content to be indexed, but no, Voog will index all your content without saying it to index a specific part of the page.
<main data-search-indexing-allowed="true" class="site-main">
...
</main>
This is precisely what we have below:
<main class="site-main">
...
</main>
How to exclude nested tags from search results in Voog
It does not matter if you add the data-search-indexing-allowed="true"
to any section that has no parent that has been excluded.
For example, you have a section on your page that you want to exclude from the search result, but there’s some content you wish to do the other way. Like this:
<div>
You want exclude this text.
<span>But you don't want to exclude this span</span>
</div>
In this example, if you add data-search-indexing-allowed="false"
to the div, it will exclude all content inside the div, but if you add data-search-indexing-allowed="true"
to the span inside the div, the content inside the span will be indexed and appear in the search results.
<div data-search-indexing-allowed="false">
You want exclude this text.
<span data-search-indexing-allowed="true">But you don't want to exclude this span</span>
</div>
Best practices for excluding content from search results in Voog
I recommend excluding some parts of your website on all pages to prevent inaccurate results, like your website header, sidebar, and footer. The reason is that if you have a link in your header and the user searches that word, Voog will show all your pages in the search result, and it’s not what the user is looking for. So make sure you exclude these parts.
Feel free to ask any questions in the comments.