LoginSignup
2
1

More than 5 years have passed since last update.

OpenSearch を有効活用しよう (1/3)

Last updated at Posted at 2018-08-06

⇒ OpenSearch を有効活用しよう (1/3)
  OpenSearch を有効活用しよう (2/3)
  OpenSearch を有効活用しよう (3/3)

#OpenSearch

OpenSearchはシンジケーションとアグリゲーションに適する形式で検索結果を発行することを可能にする技術群である。これはウェブサイトと検索エンジンが標準的でアクセス可能な形式で検索結果を発行する方法である。wiki

理解不能
しげちーの言うとおりさっぱり解かりませんが、とりあえずOpenSearchを始めてみましょう。

準備は簡単。用意するファイルは2つ

  • linkタグ
    htmlのヘッダ部に追加します。
    <link href="/opensearch.xml" rel="search" title="Qiita" type="application/opensearchdescription+xml">

  • opensearch.xml
    linkタグのhrefで指定したファイル名で保存します。
    ポイントはShortNameドメインUrl。他の検索エンジンと被らない短い名称を付けます。サブドメインで構わないので、他の検索エンジンと被らない名称を取得します。
    Urlはルートにします。https://qiita.com/honya/search?q={searchTerms}ではダメです。

opensearch.xml
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Qiita</ShortName>
<Description>Search Qiita</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" type="image/x-icon" width="16">/assets/favicons/public/production.ico</Image>
<Url method="get" template="https://qiita.com/search?q={searchTerms}" type="text/html"/>
<moz:SearchForm>https://qiita.com/search</moz:SearchForm>
</OpenSearchDescription>

1回目はここまで

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1