Skip to content

Commit

Permalink
feat(JAQPOT-372): add algolia docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Nov 20, 2024
1 parent 9e0ed58 commit c2b5cf0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ALGOLIA_APP_ID=${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_API_KEY=${{ secrets.ALGOLIA_SEARCH_API_KEY }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM node:18-alpine AS base
# Add build argument
ARG DEPLOYMENT_ENV=production
ARG ALGOLIA_APP_ID
ARG ALGOLIA_SEARCH_API_KEY

# Install dependencies only when needed
FROM base AS deps
Expand Down Expand Up @@ -35,7 +37,7 @@ COPY .env.${DEPLOYMENT_ENV} .env.production
# ENV NEXT_TELEMETRY_DISABLED 1

RUN \
cd docusaurus && npm run build && cd .. && \
cd docusaurus && ALGOLIA_APP_ID=${ALGOLIA_APP_ID} ALGOLIA_SEARCH_API_KEY=${ALGOLIA_SEARCH_API_KEY} npm run build && cd .. && \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
Expand Down
32 changes: 32 additions & 0 deletions docusaurus/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,38 @@ const config: Config = {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
algolia: {
// The application ID provided by Algolia
appId: process.env.ALGOLIA_APP_ID,

// Public API key: it is safe to commit it
apiKey: process.env.ALGOLIA_SEARCH_API_KEY,

indexName: 'jaqpot',

// Optional: see doc section below
contextualSearch: true,

// 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.
externalUrlRegex: 'external\\.com|domain\\.com',

// Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs
// replaceSearchResultPathname: {
// from: '/docs/', // or as RegExp: /\/docs\//
// to: '/',
// },

// Optional: Algolia search parameters
searchParameters: {},

// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: 'search',

// Optional: whether the insights feature is enabled or not on Docsearch (`false` by default)
insights: false,

//... other Algolia params
},
} satisfies Preset.ThemeConfig,
};

Expand Down

0 comments on commit c2b5cf0

Please sign in to comment.