A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(docs): let search engines index the docs site (#3570)
Hampusc9fa68bf4f5d
diff --git a/fluxer_docs/Dockerfile b/fluxer_docs/Dockerfileindex de8fca7ac..f236839a6 100644--- a/fluxer_docs/Dockerfile+++ b/fluxer_docs/Dockerfile@@ -17,6 +17,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \python3 && \rm -rf /var/lib/apt/lists/*+ENV FLUXER_DOCS_ENDPOINT=https://docs.fluxer.app+ENV FLUXER_DOCS_SEARCH_INDEXING=true+COPY . .RUN pnpm install --frozen-lockfile@@ -61,6 +64,8 @@ ENV NODE_ENV=productionENV NODE_OPTIONS="--enable-source-maps"ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crtENV BUILD_VERSION=${BUILD_VERSION}+ENV FLUXER_DOCS_ENDPOINT=https://docs.fluxer.app+ENV FLUXER_DOCS_SEARCH_INDEXING=trueUSER 65532:65532diff --git a/fluxer_docs/astro.config.ts b/fluxer_docs/astro.config.tsindex 6c054f1bf..67a322c76 100644--- a/fluxer_docs/astro.config.ts+++ b/fluxer_docs/astro.config.ts@@ -340,12 +340,15 @@ export default defineConfig({redirects: {'/admin-api/operator-pass': '/admin-api/','/admin-api/payment-disputes': '/admin-api/',+ '/api-reference': '/http-api/',+ '/api-reference/[...path]': '/http-api/','/http-api/donations': '/http-api/billing/','/http-api/in-app-purchases': '/http-api/premium/','/http-api/operator-pass': '/http-api/premium/','/http-api/operator-pass-waitlist': '/http-api/premium/','/operator/configuration': '/operator/running/','/operator/get-started': '/operator/',+ '/operator/operator-pass': '/operator/','/operator/upgrading': '/operator/running/',},publicDir: path.join(staticDirectory, 'web'),diff --git a/fluxer_docs/src/pages/robots.txt.ts b/fluxer_docs/src/pages/robots.txt.tsnew file mode 100644index 000000000..3383f3cba--- /dev/null+++ b/fluxer_docs/src/pages/robots.txt.ts@@ -0,0 +1,13 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import type {APIRoute} from 'astro';+import {docsPublicEndpoint, docsSearchIndexing} from '@/server/DocsConfig';++export const prerender = false;++export const GET: APIRoute = () => {+ const body = docsSearchIndexing()+ ? `User-agent: *\nAllow: /\n\nSitemap: ${new URL('sitemap-index.xml', `${docsPublicEndpoint().replace(/\/$/, '')}/`).href}\n`+ : 'User-agent: *\nDisallow: /\n';+ return new Response(body, {headers: {'Content-Type': 'text/plain; charset=utf-8'}});+};