Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add algolia doc search #48

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
pull_request:

jobs:
build-publish:
Expand All @@ -27,6 +26,9 @@ jobs:

- name: Build website
run: npm run build
env:
REACT_APP_DOC_SEARCH_APP_ID: ${{ secrets.DOC_SEARCH_APP_ID }}
REACT_APP_DOC_SEARCH_INDEX_NAME: ${{ secrets.DOC_SEARCH_INDEX_NAME }}

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
Expand Down
23 changes: 23 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import * as process from "node:process";

const config: Config = {
title: 'Brave Ads',
Expand All @@ -26,6 +27,16 @@ const config: Config = {
defaultLocale: 'en',
locales: ['en'],
},

headTags: [
{
tagName: 'meta',
attributes: {
'http-equiv': 'Content-Security-Policy',
content: `default-src 'none'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'none'; connect-src https://*.algolia.net https://*.algolianet.com https://*.algolia.io;`,
},
}
],

presets: [
[
Expand Down Expand Up @@ -102,6 +113,18 @@ const config: Config = {
],
copyright: `Copyright © ${new Date().getFullYear()} Brave Software, Inc.`,
},
algolia: {
appId: process.env.REACT_APP_DOC_SEARCH_APP_ID,
// Public API key: it is safe to commit it
apiKey: '9d6bcc3afa8daed9395db8c441bc04a1',
thypon marked this conversation as resolved.
Show resolved Hide resolved
IanKrieger marked this conversation as resolved.
Show resolved Hide resolved
indexName: process.env.REACT_APP_DOC_SEARCH_INDEX_NAME,
// Ensures that search results are relevant to the current language and version
contextualSearch: true,
searchParameters: {
analytics: false,
clickAnalytics: false,
}
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.