Embed Code Options - Every data- Attribute

Theme, layout, filters and a first search, set in the embed code

Embed Code Options

The embed code works with just your index name. Every other option is a data- attribute you add to the div. Leave out any option you do not need: it keeps its default.

<div id="opensolr-search"
     data-index="YOUR_INDEX_NAME"
     data-topbar="off"
     data-q="return policy"
     data-ui-theme="dark"
     data-pagination-style="pages"></div>
<script src="https://search.opensolr.com/embed.js" async></script>

Every option

data-index

Required. The name of your Opensolr Index.

data-q

Any search, for example return policy.

The page opens with the results of this search. Handy when your site has its own search box: put what the visitor typed here.

data-in

web (default) or media.

media opens the Documents tab. It works when Show Documents Search is on (Web and Documents tabs).

data-topbar

off to hide. Shown by default.

off hides the top of the page: the search box, the tabs and the language and locale lists. A short line with the number of results, AI Hints, the sort list, Fresh and AI stays. Use it with data-q when your site has its own search box.

data-sidebar

on (default) or off.

The facet sidebar. It shows when at least one of your facets has data for the search; off hides it, and the sort list with it (Facet filters).

data-og

yes (default) or no.

The picture each page shares on social networks, shown next to its result. no gives text-only results.

data-fresh

no (default), yes, positive or negative.

yes keeps only recent results (by default the last 7 days), newest first. positive and negative keep only pages with a positive or a negative tone. A new search typed in the box shows every result again. This is a filter; the Fresh switch is not.

data-ai

yes or no. By default the switch follows your Search Mode.

Starts the page with AI on (words and meaning) or off (exact words). yes is ignored when the search runs on exact words only anyway (The AI switch).

data-lang

A language code, for example en or de.

Opens with only pages in that language. Visitors can change it in the language list.

data-locale

A locale in small letters, for example en_gb or de_de.

Opens with only that country version of your pages (Language and locale).

data-pagination-style

scroll (default) or pages.

scroll loads more results as the visitor scrolls. pages shows numbered pages.

data-ui-theme

light (default) or dark.

data-layout

default (default) or fullwidth.

fullwidth lets the results use the whole width of the frame.

Visitors can still switch the layout, the paging style and the theme for themselves, with the three buttons on the right of the number of results.

The same options on a link

Each option also works on the address of the hosted search page, without the data- and with an underscore instead of a dash. For example, data-ui-theme="dark" becomes:

https://search.opensolr.com/YOUR_INDEX_NAME?ui_theme=dark&q=return+policy

Hosted search page pages

Back to Enterprise Site Search