From 2b498f2188a16b5d7b738f5597f4bb8623e602d5 Mon Sep 17 00:00:00 2001 From: ppoffice Date: Fri, 10 Apr 2020 22:35:57 -0400 Subject: [PATCH] feat(doc): add zh-CN & en search plugin doc --- .travis.yml | 1 + _config.yml | 6 +- package.json | 2 +- source/_posts/demo/search/Algolia.md | 13 ++ source/_posts/demo/search/Google-CSE.md | 14 +++ source/_posts/en/Search-Plugins.md | 160 ++++++++++++++++++++++++ source/_posts/en/Share-Buttons.md | 2 +- source/_posts/search/Baidu.md | 13 -- source/_posts/search/Google-CSE.md | 17 --- source/_posts/search/Insight.md | 19 --- source/_posts/zh-CN/Comment-Plugins.md | 2 +- source/_posts/zh-CN/Search-Plugins.md | 155 +++++++++++++++++++++++ themes/icarus | 2 +- 13 files changed, 350 insertions(+), 56 deletions(-) create mode 100644 source/_posts/demo/search/Algolia.md create mode 100644 source/_posts/demo/search/Google-CSE.md create mode 100644 source/_posts/en/Search-Plugins.md delete mode 100644 source/_posts/search/Baidu.md delete mode 100644 source/_posts/search/Google-CSE.md delete mode 100644 source/_posts/search/Insight.md create mode 100644 source/_posts/zh-CN/Search-Plugins.md diff --git a/.travis.yml b/.travis.yml index 56b381c..013a27a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ jobs: - cp _config.theme.yml themes/icarus/_config.yml - ([[ -e _config.page.yml ]] && cp _config.page.yml themes/icarus/) || true - ([[ -e _config.post.yml ]] && cp _config.post.yml themes/icarus/) || true + - hexo algolia - hexo g deploy: provider: pages diff --git a/_config.yml b/_config.yml index 782642e..2d591b8 100644 --- a/_config.yml +++ b/_config.yml @@ -94,6 +94,6 @@ githubEmojis: className: not-gallery-item algolia: - applicationID: RYILPF5LG6 - apiKey: c358c55d21fca7cf3e935baced47bc28 - indexName: icarus + applicationID: T0CJF4ZB1O + apiKey: 84268949a677b7651a9f3db7da9f6952 + indexName: hexo-icarus diff --git a/package.json b/package.json index e87034e..6a3feae 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "bulma-stylus": "0.8.0", "hexo": "^4.0.0", "hexo-algolia": "^1.3.1", - "hexo-component-inferno": "^0.2.0", + "hexo-component-inferno": "^0.2.3", "hexo-deployer-git": "^2.0.0", "hexo-filter-github-emojis": "^2.1.0", "hexo-generator-archive": "^1.0.0", diff --git a/source/_posts/demo/search/Algolia.md b/source/_posts/demo/search/Algolia.md new file mode 100644 index 0000000..59360f5 --- /dev/null +++ b/source/_posts/demo/search/Algolia.md @@ -0,0 +1,13 @@ +title: Algolia Search Plugin +date: 2013-01-01 +tags: +- Demo +search: + type: algolia +--- + +
+This is for demonstration only. +Please report your issues with this plugin to +ppoffice/hexo-component-inferno. +
diff --git a/source/_posts/demo/search/Google-CSE.md b/source/_posts/demo/search/Google-CSE.md new file mode 100644 index 0000000..14f9985 --- /dev/null +++ b/source/_posts/demo/search/Google-CSE.md @@ -0,0 +1,14 @@ +title: Google CSE Search Plugin +date: 2013-01-01 +tags: +- Demo +search: + type: google_cse + cx: 006888261376761189075:qxqdcvqzio0 +--- + +
+This is for demonstration only. +Please report your issues with this plugin to +ppoffice/hexo-component-inferno. +
diff --git a/source/_posts/en/Search-Plugins.md b/source/_posts/en/Search-Plugins.md new file mode 100644 index 0000000..83985f1 --- /dev/null +++ b/source/_posts/en/Search-Plugins.md @@ -0,0 +1,160 @@ +title: Icarus User Guide - Search Plugin +date: 2017-01-31 +categories: +- Plugins +- Search +tags: +- Icarus User Guide +language: en +toc: true +--- + +
+This article is also available in: 简体中文. +
+ +This article covers some search plugins supported by Icarus 3. + + + + + +## Algolia + +
+Installation Guide +Preview +
+ +1. Install the [hexo-algolia](https://github.com/oncletom/hexo-algolia) plugin under the root directory of your + Hexo site. + +2. Register and log into [Algolia](https://www.algolia.com/). + Click "Create Index" button on the dashboard when you log in for the first time. + Then, enter the name of Index (Index name) and click the "Create" button to complete index creation. + +3. Next, click "API Keys" on the left navigation bar, copy "Application ID" and "Search-Only API Key" on the page. + Open site configuration file `_config.yml` under the root directory of your Hexo site and fill in the above + information to the hexo-algolia plugin configurations. + For example, the following Aloglia index information + + {% codeblock "Algolia Index Information" %} + Algolia Index Name: My-Hexo-Site + Application ID: ABCDEFGHIJKL + Search-Only API Key: 7b08fca7d42412cee901a25643124221 + {% endcodeblock %} + + can be mapped to the following plugin configuration + + {% codeblock _config.yml lang:yaml %} + algolia: + applicationID: My-Hexo-Site + indexName: ABCDEFGHIJKL + apiKey: 7b08fca7d42412cee901a25643124221 + {% endcodeblock %} + +4. Go back to the "API Keys" page from the Algolia dashboard and switch to the "All API Keys" tab. + Click the "New API Key" button. + On the popup "Create API Key" dialog, select the index your created in the last step in "Indices" select box. + Then, type the domain name of your site to the "HTTP Referers" field and add `addObject`, `deleteObject`, + `listIndexes`, `deleteIndex` to the "ACL" field. + Click the "Create" button to finish key creation. + Copy the API key you just created, e.g., `727fbd8c998fe419318fa350db6793ca`. + +5. Open a Windows Command Prompt (CMD) or Linux/macOS terminal and change the working directory to the root + directory of your Hexo site. + Set the environment variable used by the hexo-algolia plugin when upload the indices to Algolia to the + API key you created in the last step. + + On Windows + + {% codeblock "Windows Command Prompt (CMD)" lang:cmd %} + C:\Users\you> cd path/to/your/hexo/site + C:\Users\you> set HEXO_ALGOLIA_INDEXING_KEY="727fbd8c998fe419318fa350db6793ca" + {% endcodeblock %} + + On Linux/macOS + + {% codeblock "Linux/macOS Terminal" lang:shell %} + $ cd path/to/your/hexo/site + $ export HEXO_ALGOLIA_INDEXING_KEY="727fbd8c998fe419318fa350db6793ca" + {% endcodeblock %} + + Then, run the following commands to clean up your site and upload indices to Algolia + + {% codeblock "Windows Command Prompt or Linux/macOS Terminal" lang:shell %} + $ hexo clean + $ hexo algolia + {% endcodeblock %} + +6. Finally, open theme configuration file and set the search engine to Algolia + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: algolia + {% endcodeblock %} + + +## Baidu Search + +**Installation Guide** + +1. Open theme configuration file and set the set the search engine to Baidu + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: baidu + {% endcodeblock %} + + +## Google Custom Search Engine (CSE) + +
+Installation Guide +Preview +
+ +1. Log into your Google account and visit [Google CSE](https://cse.google.com/cse/create/new) to create a CSE. + Type in the domain name of your site in the "Sites to Search" field, select correct language from the "Language" + select box, and fill in the "Name of the search engine". Click the "Create" button to finish engine creation. + +2. Then, click the "Get code" button on the right side of "Add it to your site". Copy the value of `cx` to the + search settings in your theme's configuration file. + For example, the following HTML code + + {% codeblock "Google CSE HTML code" lang:html %} + + + {% endcodeblock %} + + can be mapped to the following theme configuration + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: google_cse + cx: 012345601234560123456:abcdefghijklmn + {% endcodeblock %} + + +## Insight + +**Installation Guide** + +1. Insight is the default search engine of this site. + You can enable it using the following theme configuration + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: insight + {% endcodeblock %} + + +
+Something wrong with this article? Click here to submit your revision. +
diff --git a/source/_posts/en/Share-Buttons.md b/source/_posts/en/Share-Buttons.md index a2eb4f0..b8abef6 100644 --- a/source/_posts/en/Share-Buttons.md +++ b/source/_posts/en/Share-Buttons.md @@ -218,5 +218,5 @@ Please use to other services as alternatives.
-Something wrong with this article? Click here to submit your revision. +Something wrong with this article? Click here to submit your revision.
diff --git a/source/_posts/search/Baidu.md b/source/_posts/search/Baidu.md deleted file mode 100644 index 06de3de..0000000 --- a/source/_posts/search/Baidu.md +++ /dev/null @@ -1,13 +0,0 @@ -title: Baidu Search Plugin -date: 2013-01-01 00:00:03 -categories: -- Plugins -- Search -search: - type: baidu ---- - -{% codeblock lang:yaml _config.yml %} -search: - type: baidu -{% endcodeblock%} diff --git a/source/_posts/search/Google-CSE.md b/source/_posts/search/Google-CSE.md deleted file mode 100644 index 8aeb944..0000000 --- a/source/_posts/search/Google-CSE.md +++ /dev/null @@ -1,17 +0,0 @@ -title: Google CSE Plugin -date: 2013-01-01 00:00:02 -categories: -- Plugins -- Search -search: - type: google_cse - cx: 006888261376761189075:qxqdcvqzio0 ---- - -[Installation instructions](https://cse.google.com/cse/create/new) - -{% codeblock lang:yaml _config.yml %} -search: - type: google-cse - cx: xxxxxxxxxxxxxxxxx # (required) -{% endcodeblock%} diff --git a/source/_posts/search/Insight.md b/source/_posts/search/Insight.md deleted file mode 100644 index d63e59c..0000000 --- a/source/_posts/search/Insight.md +++ /dev/null @@ -1,19 +0,0 @@ -title: Insight Search Plugin -date: 2013-01-01 00:00:01 -categories: -- Plugins -- Search -tags: -- Getting Started -search: - type: insight ---- - -{% quote %} -From Icarus 2.0.0, you no longer need to install hexo-generator-json-content to use the insight search plugin. -{% endquote %} - -{% codeblock lang:yaml _config.yml %} -search: - type: insight -{% endcodeblock%} \ No newline at end of file diff --git a/source/_posts/zh-CN/Comment-Plugins.md b/source/_posts/zh-CN/Comment-Plugins.md index 39b423c..be1c777 100644 --- a/source/_posts/zh-CN/Comment-Plugins.md +++ b/source/_posts/zh-CN/Comment-Plugins.md @@ -1,4 +1,4 @@ -title: Icarus用户指南 - 评论系统 +title: Icarus用户指南 - 用户评论插件 date: 2017-01-31 categories: - Plugins diff --git a/source/_posts/zh-CN/Search-Plugins.md b/source/_posts/zh-CN/Search-Plugins.md new file mode 100644 index 0000000..a149bdf --- /dev/null +++ b/source/_posts/zh-CN/Search-Plugins.md @@ -0,0 +1,155 @@ +title: Icarus用户指南 - 站内搜索插件 +date: 2017-01-31 +categories: +- Plugins +- Search +tags: +- Icarus用户指南 +language: zh-CN +toc: true +--- + +
+本文同时提供以下语言的翻译:English。 +
+ +本文介绍Icarus 3支持的一些站内搜索插件的安装配置。 + + + + + + + +## Algolia + +
+安装指南 +在线预览 +
+ +1. 在Hexo站点的根目录安装[hexo-algolia](https://github.com/oncletom/hexo-algolia)插件。 + +2. 注册并登录[Algolia](https://www.algolia.com/)。首次登录控制面板(Dashboard)时点击页面上的“创建索引”(Create Index)按钮并 + 输入任意索引名称(Index name)。最后点击“创建”(Create)完成索引创建。 + +3. 下一步,点击右侧导航栏上的API Keys,复制页面上的“应用ID”(Application ID)和“仅限搜索的API Key”(Search-Only API Key)。打开 + Hexo站点根目录下的站点配置文件`_config.yml`,填入上面复制的信息到hexo-algolia插件的配置中。 + 例如,对于下面的Algolia索引信息 + + {% codeblock "Algolia索引信息" %} + Algolia索引名称: My-Hexo-Site + Application ID: ABCDEFGHIJKL + Search-Only API Key: 7b08fca7d42412cee901a25643124221 + {% endcodeblock %} + + 对应的站点配置为 + + {% codeblock _config.yml lang:yaml %} + algolia: + applicationID: My-Hexo-Site + indexName: ABCDEFGHIJKL + apiKey: 7b08fca7d42412cee901a25643124221 + {% endcodeblock %} + +4. 回到Algolia控制面板的API Keys页面,切换到同一页面上的“所有API Keys”(All API Keys)标签页,点击“新建API Key”(New API Key)。 + 在弹出的“创建API Key”(Create API Key)对话框中选择“索引”(Indices)为上一步中创建的索引,“HTTP Referers”填入Hexo站点的 + 域名,“ACL”中填入`addObject`,`deleteObject`,`listIndexes`, `deleteIndex`四项。点击“创建”(Create)完成创建。 + 复制刚刚创建的API Key,例如`727fbd8c998fe419318fa350db6793ca`。 + +5. 打开一个命令行终端(Windows命令行(CMD)或Linux/macOS终端),切换当前目录到你的Hexo站点的根目录并设置hexo-algolia + 插件上传网站索引用到的环境变量为上一步中创建的API Key。 + + Windows下 + + {% codeblock "Windows命令行(CMD)" lang:cmd %} + C:\Users\you> cd path/to/your/hexo/site + C:\Users\you> set HEXO_ALGOLIA_INDEXING_KEY="727fbd8c998fe419318fa350db6793ca" + {% endcodeblock %} + + Linux/macOS下 + + {% codeblock "Linux/macOS终端" lang:shell %} + $ cd path/to/your/hexo/site + $ export HEXO_ALGOLIA_INDEXING_KEY="727fbd8c998fe419318fa350db6793ca" + {% endcodeblock %} + + 然后运行下面的命令来清理并上传网站索引到Algolia + + {% codeblock "Windows命令行(CMD)或Linux/macOS终端" lang:shell %} + $ hexo clean + $ hexo algolia + {% endcodeblock %} + +6. 最后,打开主题配置文件并设置搜索为Algolia + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: algolia + {% endcodeblock %} + + +## 百度搜索 + +**安装指南** + +1. 打开主题配置文件并设置搜索为百度搜索 + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: baidu + {% endcodeblock %} + + +## 谷歌自定义搜索 + +
+安装指南 +在线预览 +
+ +1. 登录谷歌并访问[Google CSE](https://cse.google.com/cse/create/new)来创建自定义搜索。在“需要搜索的站点”(Sites to Search) + 中填入你的Hexo站点域名,“语言”(Language)选择需要的语言,并填写自定义“搜索引擎名称”(Name of the search engine)。点击“创建” + (Create)。 + +2. 然后,点击页面上的“添加到你的站点”(Add it to your site)右侧的“获取代码”(Get code)按钮,然后从HTML代码中复制`cx`的值填入到对应 + 主题配置项中。例如下面的HTML代码 + + {% codeblock "Google CSE HTML代码" lang:html %} + + + {% endcodeblock %} + + 对应的主题配置为 + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: google_cse + cx: 012345601234560123456:abcdefghijklmn + {% endcodeblock %} + + +## Insight + +**安装指南** + +1. Insight为本站默认的站内搜索引擎。你可以通过下面的主题配置设置搜索为Insight + + {% codeblock themes/icarus/_config.yml lang:yaml %} + search: + type: insight + {% endcodeblock %} + + +
+文章内容有误?请点击此处提交修改。 +
diff --git a/themes/icarus b/themes/icarus index e538fa8..077780c 160000 --- a/themes/icarus +++ b/themes/icarus @@ -1 +1 @@ -Subproject commit e538fa8c316f4411c8059a538122e0d04be9d84d +Subproject commit 077780c993c67434a4c2817477806d92be998f01