diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index ad111a4..a380f8e 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -51,6 +51,21 @@ jobs: mv build-raw/* "build/${BASE_URL}/" rm -rf build-raw + - name: Generate cache headers + env: + BASE_URL: ${{ steps.env.outputs.base_url }} + run: | + printf '%s\n' \ + "/${BASE_URL}/assets/*" \ + " Cache-Control: public, max-age=31536000, immutable" \ + "" \ + "/${BASE_URL}/img/*" \ + " Cache-Control: public, max-age=2592000" \ + "" \ + "/${BASE_URL}/*.js" \ + " Cache-Control: public, max-age=31536000, immutable" \ + > build/_headers + - name: Deploy to Cloudflare Pages uses: cloudflare/wrangler-action@v3 with: diff --git a/docusaurus.config.js b/docusaurus.config.js index 4d873b8..a563767 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -18,6 +18,7 @@ const config = { : "https://www.marketdata.app/", baseUrl: process.env.PROD == "true" ? "/docs/" : "/docs-staging/", + noIndex: process.env.PROD !== "true", onBrokenLinks: "ignore", onBrokenMarkdownLinks: "warn", favicon: "img/favicon.ico", diff --git a/static/robots.txt b/static/robots.txt deleted file mode 100644 index 1f53798..0000000 --- a/static/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/worker/index.js b/worker/index.js index 5036fa0..2d0a57f 100644 --- a/worker/index.js +++ b/worker/index.js @@ -64,7 +64,7 @@ async function handleRequest(request) { for (const route of ROUTES) { if (matchesRoute(url.pathname, route.prefix)) { url.hostname = route.target; - return fetch(new Request(url, request)); + return fetch(new Request(url, request), { cf: { cacheEverything: true } }); } } diff --git a/worker/wrangler.toml b/worker/wrangler.toml index e661729..67089d1 100644 --- a/worker/wrangler.toml +++ b/worker/wrangler.toml @@ -5,4 +5,6 @@ compatibility_date = "2024-01-01" routes = [ { pattern = "www.marketdata.app/docs-staging", zone_name = "marketdata.app" }, { pattern = "www.marketdata.app/docs-staging/*", zone_name = "marketdata.app" }, + { pattern = "www.marketdata.app/docs", zone_name = "marketdata.app" }, + { pattern = "www.marketdata.app/docs/*", zone_name = "marketdata.app" }, ]