Making the Site Searchable
User Guide → Making the Site SearchableMarkBind comes with an in-built site search facility with the option to use third-party search services as well.
All markdown and html headings of levels 1-3 are captured in the search index by default. You can change this setting using the headingIndexLevel
property of the site.json
.
If you do not wish to use MarkBind's searchbar (e.g. you have an external service provider), it may be helpful to include the option enableSearch: false
in your site.json
. This stops MarkBind from indexing search headings and speeds up building.
You can add a search bar component to your website to allow users to search the site.
regress regression testing
You can also specify additional keywords to be indexed under a heading by tagging the words with the keyword
class. Those keywords will be linked to the heading immediately above it. If you want to index a keyword without rendering it in the page, add d-none
as a class.
Example
#### Developer Testing
<span class="keyword d-none">regress</span>
<span class="keyword d-none">regression testing</span>
This is good for catching <span class="keyword">regressions</span>.
Developer Testing
This is good for catching regressions.
You can also set additional keywords to be indexed for an entire page using the keywords
attribute inside the <frontmatter>
of that page.
Example
<frontmatter>
keywords: regress, regression testing, regressions
</frontmatter>
...
<span class="keyword d-none">regress</span>
You can specify headings which are to be included or excluded from the index built by MarkBind's built-in search feature using the .always-index
or .no-index
classes.
If you wish to index a specific heading outside the specified headingIndexLevel
, you may add the .always-index
attribute to the heading. Similarly, if you wish for a specific heading inside the specified headingIndexLevel
not to be indexed, you may add the .no-index
attribute to the heading.
Example
###### Heading outside heading index level that will be indexed {.always-index}
# Heading inside heading index level that will not be indexed {.no-index}
Equivalently,
<h6 class="always-index"> Heading outside heading index level that will be indexed </h6>
<h1 class="no-index"> Heading inside heading index level that will not be indexed </h1>
MarkBind sites can use Algolia Doc Search services easily via the Algolia plugin. Unlike the built-in search, Algolia provides full-text search. See the panel below for more info.