From 486f12a80e558addb2b82376218e3fb4e6a6a1e8 Mon Sep 17 00:00:00 2001 From: Soitora Date: Thu, 30 Apr 2020 18:53:10 +0200 Subject: [PATCH] Switch to Algolia DocSearch (#85) * Add Algolia * Overhaul the search * Add sitemap.xml generator * Remove SCSS files * Eject components * Algolia styling * More styling x2 --- package-lock.json | 60 +++++- package.json | 3 +- src/.vuepress/config.js | 5 + src/.vuepress/config/plugins.js | 6 + src/.vuepress/public/assets/search-icon.svg | 70 +++++++ .../theme/components/AlgoliaSearchBox.vue | 182 ++++++++++++++++++ src/.vuepress/theme/components/Navbar.vue | 140 ++++++++++++++ 7 files changed, 463 insertions(+), 3 deletions(-) create mode 100644 src/.vuepress/public/assets/search-icon.svg create mode 100644 src/.vuepress/theme/components/AlgoliaSearchBox.vue create mode 100644 src/.vuepress/theme/components/Navbar.vue diff --git a/package-lock.json b/package-lock.json index 9191aa032..d9af56046 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9371,6 +9371,11 @@ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, + "lodash.chunk": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.chunk/-/lodash.chunk-4.2.0.tgz", + "integrity": "sha1-ZuXOH3btJ7QwPYxlEujRIW6BBrw=" + }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -9406,6 +9411,11 @@ "integrity": "sha1-5pfwTOXXhSL1TZM4syuBozk+TrM=", "dev": true }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=" + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -11635,8 +11645,7 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "pupa": { "version": "2.0.1", @@ -12536,6 +12545,17 @@ } } }, + "sitemap": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-3.2.2.tgz", + "integrity": "sha512-TModL/WU4m2q/mQcrDgNANn0P4LwprM9MMvG4hu5zP4c6IIKs2YLTu6nXXnNr8ODW/WFtxKggiJ1EGn2W0GNmg==", + "requires": { + "lodash.chunk": "^4.2.0", + "lodash.padstart": "^4.6.1", + "whatwg-url": "^7.0.0", + "xmlbuilder": "^13.0.0" + } + }, "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", @@ -13566,6 +13586,14 @@ "punycode": "^2.1.1" } }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "^2.1.0" + } + }, "trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", @@ -14327,6 +14355,14 @@ "markdown-it-container": "^2.0.0" } }, + "vuepress-plugin-sitemap": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/vuepress-plugin-sitemap/-/vuepress-plugin-sitemap-2.3.1.tgz", + "integrity": "sha512-n+8lbukhrKrsI9H/EX0EBgkE1pn85LAQFvQ5dIvrZP4Kz6JxPOPPNTQmZMhahQV1tXbLZQCEN7A1WZH4x+arJQ==", + "requires": { + "sitemap": "^3.0.0" + } + }, "vuepress-plugin-smooth-scroll": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/vuepress-plugin-smooth-scroll/-/vuepress-plugin-smooth-scroll-0.0.3.tgz", @@ -14356,6 +14392,11 @@ "minimalistic-assert": "^1.0.0" } }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, "webpack": { "version": "4.43.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.43.0.tgz", @@ -14852,6 +14893,16 @@ "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", "dev": true }, + "whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, "when": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/when/-/when-3.6.4.tgz", @@ -14998,6 +15049,11 @@ "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, + "xmlbuilder": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", + "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index fe200f5c6..d34f9c0ff 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "lodash.groupby": "^4.6.0", "lodash.sortby": "^4.7.0", "material-design-icons": "^3.0.1", - "vue-sweetalert2": "^3.0.3" + "vue-sweetalert2": "^3.0.3", + "vuepress-plugin-sitemap": "^2.3.1" } } diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js index 25b517f31..010cc2148 100644 --- a/src/.vuepress/config.js +++ b/src/.vuepress/config.js @@ -11,6 +11,11 @@ module.exports = { docsRepo: 'tachiyomiorg/website', docsDir: 'src', logo: '/assets/media/logo.svg', + algolia: { + apiKey: 'fc1c45b5a3835e1882cbbf0751dfe705', + indexName: 'tachiyomi' + }, + searchPlaceholder: 'Search...', editLinks: true, editLinkText: 'Help us improve this page', nav: require('./config/nav'), diff --git a/src/.vuepress/config/plugins.js b/src/.vuepress/config/plugins.js index 591a2b935..ee9c5052d 100644 --- a/src/.vuepress/config/plugins.js +++ b/src/.vuepress/config/plugins.js @@ -43,4 +43,10 @@ module.exports = [ defaultTitle: "" } ], + [ + "vuepress-plugin-sitemap", + { + hostname: "https://tachiyomi.org" + } + ] ]; diff --git a/src/.vuepress/public/assets/search-icon.svg b/src/.vuepress/public/assets/search-icon.svg new file mode 100644 index 000000000..b206aba78 --- /dev/null +++ b/src/.vuepress/public/assets/search-icon.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/.vuepress/theme/components/AlgoliaSearchBox.vue b/src/.vuepress/theme/components/AlgoliaSearchBox.vue new file mode 100644 index 000000000..b075d77a4 --- /dev/null +++ b/src/.vuepress/theme/components/AlgoliaSearchBox.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/src/.vuepress/theme/components/Navbar.vue b/src/.vuepress/theme/components/Navbar.vue new file mode 100644 index 000000000..4fdd6028c --- /dev/null +++ b/src/.vuepress/theme/components/Navbar.vue @@ -0,0 +1,140 @@ + + + + +