facebook twitter hatena line email

「Javascript/vue/vuepress」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(やり方)
(やり方)
行64: 行64:
 
}
 
}
 
</pre>
 
</pre>
既にmodule.exports/themeConfig構成がある場合は、そこに混ぜないと、上書きしてしまう。
+
#既にmodule.exports/themeConfig構成がある場合は、そこに混ぜないと、上書きしてしまうので注意。
 +
#しばらくすると検索に全文検索結果が出てくるはず。
  
 
==参考==
 
==参考==
 
https://qiita.com/dojineko/items/aae7e6d13479e08d49fd
 
https://qiita.com/dojineko/items/aae7e6d13479e08d49fd

2019年7月9日 (火) 12:09時点における版

vuepressとは

Markdownのドキュメントジェネレーター

サイトデザインなど変更

設定ファイル

.vuepress/config.js

カスタム変数用意

.vuepress/scripts/string.js

const string = {
    example: {
        mail: "hoge@example.com"
    }
}
export default {
    computed: {
        $string () {
            return string
        }
    }
}

.vuepress/enhanceApp.js

import strings from "./scripts/string"
export default ({
      Vue,
      options,
      router,
      siteData
}) => {
      Vue.mixin(strings);
}


example1.md

ver:{{$string.example.mail}}'

全文検索API

Algolia DocSearch申請

https://community.algolia.com/docsearch/#join-docsearch-program

こんな感じの結果が1日で来る

apiKey: 'bb637hogehogegehohogehogegehohogehogegehoge',
indexName: 'gehogehoge',
https://github.com/algolia/docsearch-configs/blob/master/configs/hogehoge.json


参考:https://kitigai.hatenablog.com/entry/2019/04/04/133432

やり方

.vuepress/config.js

module.exports = {
  themeConfig: {
    algolia: {
      apiKey: '<API_KEY>',
      indexName: '<INDEX_NAME>'
    }
  }
}
  1. 既にmodule.exports/themeConfig構成がある場合は、そこに混ぜないと、上書きしてしまうので注意。
  2. しばらくすると検索に全文検索結果が出てくるはず。

参考

https://qiita.com/dojineko/items/aae7e6d13479e08d49fd