Skip to content

Commit 194501e

Browse files
authored
Add Algolia search, update site style and update docusaurus
2 parents ee6df2b + 3ee9768 commit 194501e

File tree

9 files changed

+585
-533
lines changed

9 files changed

+585
-533
lines changed

.github/workflows/algolia-scraper.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run Algolia Scraper
2+
3+
on:
4+
push:
5+
branches: ["master", "develop"]
6+
pull_request:
7+
branches: ["master", "develop"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: darrenjennings/algolia-docsearch-action@master
18+
with:
19+
algolia_application_id: "1BEGBIP9SH"
20+
algolia_api_key: ${{ secrets.ALGOLIA_API_KEY }}
21+
file: "docs/algolia.config.json"

docs/algolia.config.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"index_name": "docusaurus-2",
3+
"start_urls": [
4+
"https://rest-apis-flask.teclado.com/"
5+
],
6+
"sitemap_urls": [
7+
"https://rest-apis-flask.teclado.com/sitemap.xml"
8+
],
9+
"sitemap_alternate_links": true,
10+
"stop_urls": [
11+
"/tests"
12+
],
13+
"selectors": {
14+
"lvl0": {
15+
"selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
16+
"type": "xpath",
17+
"global": true,
18+
"default_value": "Documentation"
19+
},
20+
"lvl1": "header h1",
21+
"lvl2": "article h2",
22+
"lvl3": "article h3",
23+
"lvl4": "article h4",
24+
"lvl5": "article h5, article td:first-child",
25+
"lvl6": "article h6",
26+
"text": "article p, article li, article td:last-child"
27+
},
28+
"strip_chars": " .,;:#",
29+
"custom_settings": {
30+
"separatorsToIndex": "_",
31+
"attributesForFaceting": [
32+
"language",
33+
"version",
34+
"type",
35+
"docusaurus_tag"
36+
],
37+
"attributesToRetrieve": [
38+
"hierarchy",
39+
"content",
40+
"anchor",
41+
"url",
42+
"url_without_anchor",
43+
"type"
44+
]
45+
},
46+
"conversation_id": [
47+
"833762294"
48+
]
49+
}

docs/docusaurus.config.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ const config = {
1717
projectName: "rest-apis-flask-python", // Usually your repo name.
1818
scripts: [
1919
{
20-
src: "https://plausible.io/js/plausible.js",
20+
src: "https://plau-prox.teclado.workers.dev/get/script.outbound-links.js",
2121
defer: true,
2222
"data-domain": "rest-apis-flask.teclado.com",
23+
"data-api": "https://plau-prox.teclado.workers.dev/send/event",
2324
},
2425
],
2526
presets: [
@@ -40,10 +41,35 @@ const config = {
4041
}),
4142
],
4243
],
43-
plugins: [require.resolve("@cmfcmf/docusaurus-search-local")],
4444
themeConfig:
4545
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
4646
({
47+
docs: {
48+
sidebar: {
49+
hideable: true,
50+
},
51+
},
52+
algolia: {
53+
// The application ID provided by Algolia
54+
appId: "1BEGBIP9SH",
55+
56+
// Public API key: it is safe to commit it
57+
apiKey: "882167549d623413f9b5314788a0d900",
58+
59+
indexName: "docusaurus-2",
60+
61+
// Optional: see doc section below
62+
// contextualSearch: true,
63+
64+
// Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them.
65+
// externalUrlRegex: "external\\.com|domain\\.com",
66+
67+
// Optional: Algolia search parameters
68+
searchParameters: {},
69+
70+
// Optional: path for search page that enabled by default (`false` to disable it)
71+
searchPagePath: "search",
72+
},
4773
navbar: {
4874
title: "REST APIs with Flask and Python",
4975
logo: {

0 commit comments

Comments
 (0)