{"id":5778,"date":"2022-07-16T21:54:12","date_gmt":"2022-07-16T13:54:12","guid":{"rendered":"http:\/\/switch.linesno.com\/?p=5778"},"modified":"2022-07-16T22:11:33","modified_gmt":"2022-07-16T14:11:33","slug":"vuepress2-x%e6%96%87%e6%a1%a3%e5%92%8c%e9%9b%86%e6%88%90algolia%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/switch.linesno.com\/?p=5778","title":{"rendered":"vuepress2.x\u6587\u6863\u548c\u96c6\u6210algolia\u914d\u7f6e\u8fc7\u7a0b"},"content":{"rendered":"\n<p><em>\u6b64\u4e3a\u5347\u7ea7\u7ecf\u9a8c\u8f93\u51fa\uff0c\u4e3b\u8981\u9488\u5bf9\u4e8evuepress2.x\u96c6\u6210algolia\u7684\u8fc7\u7a0b<\/em>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u80cc\u666f<\/h2>\n\n\n\n<p>\u6587\u6863\u548c\u5b98\u7f51\u662facp\u8f93\u51fa\u80fd\u529b\u7684\u4f53\u73b0\u4e4b\u4e00\uff0c\u539f\u57fa\u4e8evuepress\u7248\u672c\u4e3a0.x\u7248\u672c\uff0c\u4e2d\u95f4\u505a\u4e86\u90e8\u5206\u5347\u7ea7\uff0c\u4e5f\u8d70\u4e86\u4e00\u4e9b\u95ee\u9898\u70b9\uff0c\u8fd9\u91cc\u540c\u6b65\u505a\u4e2a\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p>\u96c6\u6210\u627e\u5230\u8d44\u6599\u6bd4\u8f83\u591a\u7684\u65b9\u5f0f\u662f\u6309vuepress\u5b98\u7f51\u63d0\u7684\u4f7f\u7528\u90ae\u4ef6\u53d1\u9001\uff0c\u7136\u540e\u56de\u590d\uff0c\u4f46\u662f\u7ecf\u8fc7\u51e0\u6b21\u4e4b\u540e\uff0c\u53d1\u73b0\u5468\u671f\u6162\uff0c\u800c\u4e14\u8c8c\u4f3c\u6700\u540e\u4e5f\u6ca1\u6709\u89c1key\u548cindex\u53d1\u5230\u90ae\u7bb1\u91cc\u9762\u3002<\/p>\n\n\n\n<p>\u8003\u8651\u5de6\u53f3\uff0c\u4f7f\u7528api\u6587\u6863\u4e0a\u4f20\u7684\u65b9\u5f0f\uff0c\u4f46\u662fvuepress\u96c6\u6210\u7684\u65f6\u5019\uff0calgolia\u63d0\u4f9b\u4e86\u76f8\u5e94\u7684\u914d\u7f6e\uff0c\u540c\u65f6\u53ef\u4ee5\u96c6\u6210github action\u8fdb\u884c\u63d0\u4ea4\uff0c\u96c6\u6210\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/FireShot-Capture-057-ACP\u6570\u5b57\u4e2d\u53f0-\u4f01\u4e1a\u7ea7ACP\u6570\u5b57\u4e2d\u53f0-alinesno-platform.linesno.com_.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2006\" height=\"1151\" src=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/FireShot-Capture-057-ACP\u6570\u5b57\u4e2d\u53f0-\u4f01\u4e1a\u7ea7ACP\u6570\u5b57\u4e2d\u53f0-alinesno-platform.linesno.com_.png\" alt=\"\" class=\"wp-image-5782\"\/><\/a><\/figure>\n\n\n\n<p>\u5347\u7ea7\u96c6\u6210\u7684\u4ed3\u5e93\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/alinesno-cloud\/alinesno-cloud-platform-press<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u96c6\u6210\u601d\u8def<\/h2>\n\n\n\n<p>\u8fd9\u91cc\u81ea\u5df1\u4e09\u79cd\u65b9\u5f0f\u96c6\u6210\uff0c\u8fd9\u91cc\u505a\u4e00\u4e0b\u8bb0\u5f55\uff0c\u4e3b\u8981\u662f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>shell\u811a\u672c\u96c6\u6210<\/li><li>github action\u96c6\u6210<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Shell\u811a\u672c\u96c6\u6210<\/h3>\n\n\n\n<p>shell\u811a\u672c\u96c6\u6210\u662f\u6bd4\u8f83\u5feb\u901f\u7684\uff0c\u8fd9\u91cc\u4e3b\u8981\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6ce8\u518c\u5b98\u7f51\uff0c\u83b7\u53d6\u5230key\u548cappid<\/li><li>\u83b7\u53d6docsearch\uff0c\u914d\u7f6econfig.json<\/li><li>vuepress\u96c6\u6210\u9a8c\u8bc1<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u6ce8\u518c\u5b98\u7f51<\/h4>\n\n\n\n<p>\u5b98\u7f51\u5730\u5740\u662f\uff1ahttps:\/\/www.algolia.com\/ref\/docsearch \u6309\u7740\u6b65\u9aa4\u6ce8\u518c\u5373\u53ef\uff0c\u540c\u65f6\u751f\u6210\u5e94\u7528\u548c\u83b7\u53d6apikey\uff0c\u5b98\u7f51\u64cd\u4f5c\u76f8\u5bf9\u6bd4\u8f83\u7b80\u5355\uff0c\u8fd9\u91cc\u5c31\u4e0d\u8fc7\u591a\u9610\u8ff0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1679\" height=\"631\" src=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/image.png\" alt=\"\" class=\"wp-image-5784\"\/><\/a><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u4e00\u70b9\u662f\uff0cindex\u4f1a\u81ea\u52a8\u751f\u6210\uff0c\u6240\u4ee5\u53ea\u9700\u8981key\u5c31\u53ef\u4ee5\uff08\u6ce8\u610f\u662fadmin-key\uff09<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u83b7\u53d6docsearch\u914d\u7f6e<\/h4>\n\n\n\n<p>\u8fd9\u91cc\u4e3b\u8981\u5728linux\u4e0a\u64cd\u4f5c\u53ef\u80fd\u4f1a\u6bd4\u8f83\u7b80\u5355\uff0c\u6211\u8fd9\u91cc\u662fmac\u7cfb\u7edf\uff0cwindows\u7684\u53ef\u4ee5\u4f7f\u7528github action\u96c6\u6210\u9a8c\u8bc1\uff0c\u8fd9\u91cc\u662fdocsearch\u7684\u4e0b\u8f7d\u5730\u5740\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/algolia\/docsearch-scraper<\/code><\/pre>\n\n\n\n<p>\u4e0b\u8f7d\u4e4b\u540e\uff0c\u751f\u6210config.json\u6587\u4ef6\uff0c\u6ce8\u610f\u65b0\u624b\u5c3d\u91cf\u4f7f\u7528\u4e0b\u9762\u7684config.json\u914d\u7f6e\uff0c\u4e4b\u524d\u4e5f\u662f\u9a8c\u8bc1\u4e86\u51e0\u4e2a\u65b9\u5f0f\u90fd\u4e0d\u592a\u987a\u5229\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"index_name\": \"acp_linesno\",\n  \"start_urls\": &#91;\n    {\n      \"url\": \"http:\/\/alinesno-platform.linesno.com\/\",\n      \"selectors_key\": \"v2\",\n      \"tags\": &#91;\n        \"v2\"\n      ]\n    }\n  ],\n  \"stop_urls\": &#91;],\n  \"selectors\": {\n    \"v2\": {\n      \"lvl0\": {\n        \"selector\": \".sidebar-heading.active\",\n        \"global\": true,\n        \"default_value\": \"Documentation\"\n      },\n      \"lvl1\": \".theme-default-content h1\",\n      \"lvl2\": \".theme-default-content h2\",\n      \"lvl3\": \".theme-default-content h3\",\n      \"lvl4\": \".theme-default-content h4\",\n      \"lvl5\": \".theme-default-content h5\",\n      \"text\": \".theme-default-content p, .theme-default-content li\",\n      \"lang\": {\n        \"selector\": \"\/html\/@lang\",\n        \"type\": \"xpath\",\n        \"global\": true\n      }\n    }\n  },\n  \"scrape_start_urls\": false,\n  \"strip_chars\": \" .,;:#\",\n  \"custom_settings\": {\n    \"attributesForFaceting\": &#91;\n      \"lang\",\n      \"tags\"\n    ]\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u5176\u5b9ealgolia\u5b98\u7f51\u4e5f\u6709\u914d\u7f6e\u53c2\u8003\uff0c\u4e0a\u9762\u662f\u9488\u5bf9\u4e8ev2\u7248\u672c\u505a\u8fc7\u8c03\u6574\uff0c\u53c2\u8003\u7684config\u4ed3\u5e93\u662f\u8fd9\u4e2a:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/algolia\/docsearch-configs<\/code><\/pre>\n\n\n\n<p>\u83b7\u53d6\u5230\u914d\u7f6e\u4e4b\u540e\uff0c\u8fd0\u884cdocsearch\u6587\u4ef6\uff0c\u7b2c\u4e00\u6b21\u8fd0\u884c\u7684\u65f6\u5019\uff0c\u4f1a\u63d0\u4ea4\u8ba9\u4f60\u586b\u5199appid\u548ckey\uff0c\u4e3b\u8981\u4fdd\u5b58\u5728.env\u6587\u4ef6\u91cc\u9762\uff0c\u7136\u540e\u63d0\u4ea4\u5b98\u7f51\u7d22\u5f15\uff0c\u751f\u6210\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/docsearch run .\/config.json<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/1BAC06D1-94F3-47BF-8816-9CD9AE25A429.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2956\" height=\"1674\" src=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/1BAC06D1-94F3-47BF-8816-9CD9AE25A429.png\" alt=\"\" class=\"wp-image-5783\"\/><\/a><\/figure>\n\n\n\n<p>\u751f\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u5728\u5b98\u7f51\u7684\u5730\u5740\u67e5\u770b\u751f\u6210\u7684\u7d22\u5f15\u60c5\u51b5\uff0c\u6ce8\u610f\u4e0a\u9762\u7684\u5e94\u7528\u9009\u62e9\u548c\u7d22\u5f15\u9009\u62e9\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/FireShot-Capture-058-Index-Algolia-www.algolia.com_.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2006\" height=\"1151\" src=\"http:\/\/switch.linesno.com\/wp-content\/uploads\/2022\/07\/FireShot-Capture-058-Index-Algolia-www.algolia.com_.png\" alt=\"\" class=\"wp-image-5785\"\/><\/a><\/figure>\n\n\n\n<p>\u5b98\u7f51\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6d4b\u8bd5\u7684\u529e\u6cd5\uff0c\u8fdb\u884c\u9a8c\u8bc1\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/docsearch playground .\/config.jso<\/code><\/pre>\n\n\n\n<p>\u4f1a\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u6d4b\u8bd5\u754c\u9762\uff0c\u8fd9\u91cc\u5c31\u4e0d\u8fc7\u591a\u7684\u7c98\u8d34\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">vuepress\u96c6\u6210\u9a8c\u8bc1<\/h4>\n\n\n\n<p>\u8fd9\u91cc\u96c6\u6210\u4e3b\u8981\u53c2\u8003\u5b98\u7f51\u7684\u94fe\u63a5\u5c31\u53ef\uff0c\u5177\u4f53\u94fe\u63a5\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;v2.vuepress.vuejs.org\/zh\/reference\/plugin\/docsearch.html<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u597dapiid\u548ckey\uff0c\u4e0b\u9762\u662f\u6211\u7684\u914d\u7f6e\uff0c\u4e5f\u662f\u53c2\u8003vuepress2\u5b98\u65b9\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>appId: 'HAT6A1ER66',\napiKey: '1c5e0970f29dd7423d668b1fd245a7e2',\nindexName: 'acp_linesno',\nsearchParameters: {\n  facetFilters: &#91;'tags:v2'],  # \u6ce8\u610f\u8fd9\u4e2a\u5730\u65b9\n},<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">github action\u96c6\u6210<\/h3>\n\n\n\n<p>\u8fd9\u91cc\u4e3b\u8981\u53c2\u8003\u57fa\u7ebf\u7684\u4ee3\u7801\uff0c\u8fd9\u91cc\u5c31\u4e0d\u505a\u8fc7\u591a\u7684\u9610\u8ff0\uff0c\u4e3b\u8981\u96c6\u6210\u7684workflow.yaml\u6587\u4ef6\u53ef\u4ee5\u4ece\u8fd9\u91cc\u83b7\u53d6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/alinesno-cloud\/alinesno-cloud-platform-press\/blob\/2.1.0\/.github\/workflows\/docIndex.yaml<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e00\u70b9\u662f\uff0c\u4e0a\u9762\u662f\u521b\u5efa\u4e86\u4e00\u4e2a.algolia\u6587\u4ef6\u6765\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5176\u5b83<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u5373\u96c6\u6210algolia\u7684\u6559\u7a0b\uff0c\u4e3b\u8981\u53c2\u8003\u7684\u8d44\u6599\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6587\u4ef6\u914d\u7f6e\uff1ahttps:\/\/github.com\/algolia\/docsearch-configs<\/li><li>\u751f\u6210\u7d22\u5f15\uff1ahttps:\/\/github.com\/algolia\/docsearch-scraper<\/li><li>\u6587\u6863\u914d\u7f6e\uff1ahttps:\/\/docsearch.algolia.com\/docs\/legacy\/run-your-own\/<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6b64\u4e3a\u5347\u7ea7\u7ecf\u9a8c\u8f93\u51fa\uff0c\u4e3b\u8981\u9488\u5bf9\u4e8evuepress2.x\u96c6\u6210algolia\u7684\u8fc7\u7a0b\u3002 \u80cc\u666f \u6587\u6863\u548c\u5b98\u7f51\u662facp\u8f93\u51fa\u80fd\u529b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-5778","post","type-post","status-publish","format-standard","hentry","category-day"],"_links":{"self":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/5778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5778"}],"version-history":[{"count":6,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/5778\/revisions"}],"predecessor-version":[{"id":5789,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/5778\/revisions\/5789"}],"wp:attachment":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5778"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}