# netlify-plugin-opensearch

> Automatically generate opensearch search.xml file postBuild on Netlify deploy

Latest version **1.0.4** (published 2020-06-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install netlify-plugin-opensearch
pnpm add netlify-plugin-opensearch
yarn add netlify-plugin-opensearch
bun add netlify-plugin-opensearch
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-06-24 |
| First published | 2020-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luke Oliff |
| Maintainers | lukeoliff |
| Keywords | netlify, netlify-plugin, search, opensearch, serverless |

## Links

- npm: https://www.npmjs.com/package/netlify-plugin-opensearch
- Repository: https://github.com/lukeocodes/netlify-plugin-opensearch
- Homepage: https://github.com/lukeocodes/netlify-plugin-opensearch#readme
- Issues: https://github.com/lukeocodes/netlify-plugin-opensearch/issues
- npm.io page: https://npm.io/package/netlify-plugin-opensearch

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-06-24
- 1.0.2 — 2020-05-29
- 1.0.1 — 2020-05-29
- 1.0.0 — 2020-05-29

## README

![](https://img.shields.io/badge/main-not%20master-green)
![](https://img.shields.io/badge/made%20with-%E2%9D%A4-red)
![](https://img.shields.io/npm/v/netlify-plugin-opensearch)
![](https://img.shields.io/github/contributors/lukeocodes/netlify-plugin-opensearch)
![](https://img.shields.io/github/issues/lukeocodes/netlify-plugin-opensearch)

# Netlify Opensearch Plugin

Automatically generate [OpenSearch](http://a9.com/-/spec/opensearch/1.1/) search.xml file postBuild on Netlify deploy.

## What is this?

Ever wondered why when you type a URL and the browser says "press TAB to search"? That's opensearch! In Chrome or Chromium, the URL bar (or Omnibox) offers the ability to search a site without navigating to the sites homepage. Once Chromium has determined it can search a site, any time the user types the URL of the site the user is reminded they can "press TAB to search". 

Once the user presses TAB, they can type in a string and presses the enter. This automatically sents the user to the URL of the site search, along with their search terms, where the search is performed and results shown.

Type in the URL of the search demo site and see! [https://netlify-plugin-algolia-index.netlify.app](https://netlify-plugin-algolia-index.netlify.app)

![Screenshot 2020-06-24 at 08 58 25](https://user-images.githubusercontent.com/956290/85519211-0e529a00-b5f9-11ea-8909-b8fb2024d6f5.png)

Then press TAB and you can search the demo site directly!

![Screenshot 2020-06-24 at 08 58 30](https://user-images.githubusercontent.com/956290/85519208-0d216d00-b5f9-11ea-9dfd-705d5384e4e3.png)

## Usage

To install, add the plugin in your `netlify.toml`. No config is required.

```toml
[[plugins]]
  package = "netlify-plugin-opensearch"
```

Default config will generate the following file at `https://your-site-name.netlify.app/search.xml`

```xml
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>Search</ShortName>
  <Url type="text/html" template="https://your-site-name.netlify.app/search?q={searchTerms}"/>
</OpenSearchDescription>
```

## Options

The available options.

| plugins.inputs  | type  | required  | default  | description  |
|---|---|---|---|---|
| searchUrl | String | false | `<env.URL>/search?q=` | The URL of the search query, remembering that the search parameters are concatenated to the end as `{searchTerms}` |
| searchFile | String | false | `search.xml` | The name of the file to be saved to. You'll need to configure your metadata to point to this file. |
| siteShortName | String | false | Search | A short name of the site to search. **It must be 16 or fewer characters** |
| siteDescription | String|null | false | null | A description of the site to search. **It must be 1024 or fewer characters** |
| siteTags | String|null | false | null | Comma separated list of keywords and strings |
| siteContact | String|null | false | null | Email address to contact the site |

### Options Applied

How to use these options:

```toml
[[plugins]]
  package = "netlify-plugin-opensearch"
    [plugins.inputs]
      searchUrl = "https://different-website.com/search?q="
      searchFile = "opensearch.xml"
      siteShortName = "My Site"
      siteDescription = "Search cool content from my site"
      siteTags = "my site"
      siteContact = "me@my-site.com"
```

Which will produce the following file at `https://your-site-name.netlify.app/opensearch.xml`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>My Site</ShortName>
  <Url type="text/html" template="https://different-website.com/search?q={searchTerms}"/>
  <Description>Search cool content from my site</Description>
  <Tags>my site</Tags>
  <Contact>me@my-site.com</Contact>
</OpenSearchDescription>
```

### Options On the Demo Site

For more context, this is how the demo site is configured:

```toml
[[plugins]]
  package = "netlify-plugin-opensearch"
    [plugins.inputs]
      siteShortName = "Demo Site"
      siteDescription = "Find stuff on the demo site"
      siteTags = "demos"
      siteContact = "luke@lukeoliff.com"
```

Which produced the following file as you can [see here](https://netlify-plugin-algolia-index.netlify.app/search.xml)

```xml
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>Demo Site</ShortName>
  <Url type="text/html" template="https://netlify-plugin-algolia-index.netlify.app/search?q={searchTerms}"/>
  <Description>Find stuff on the demo site</Description>
  <Tags>demos</Tags>
  <Contact>luke@lukeoliff.com</Contact>
</OpenSearchDescription>
```

## Install on your website

Now, a search metatag to the head of your site, changing `search.xml` to match your configuration above.

```html
<link rel="search" href="search.xml" type="application/opensearchdescription+xml" title="Your Site Name" />
```

## To do

- Better support for the OpenSearch specification [as documented here](http://a9.com/-/spec/opensearch/1.1/) and [here](https://developer.mozilla.org/en-US/docs/Web/OpenSearch).

## Contributing

Make pull-requests, but follow [code of conduct](CODE_OF_CONDUCT.md) please.

---
_Source: https://npm.io/package/netlify-plugin-opensearch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
