From 2e8b34c8b2b2faab86af5b946d74046908d3e03c Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 6 Feb 2025 16:04:03 -0600 Subject: [PATCH] [Workers] [Astro] Noindex value for specific pages --- src/components/overrides/Head.astro | 13 ++++++++ .../configuration/sites/configuration.mdx | 32 +++++++------------ .../workers/configuration/sites/index.mdx | 25 +++++++++------ .../sites/start-from-existing.mdx | 3 +- .../sites/start-from-scratch.mdx | 5 +-- .../configuration/sites/start-from-worker.mdx | 1 + src/schemas/base.ts | 1 + 7 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/components/overrides/Head.astro b/src/components/overrides/Head.astro index fc03560d421e9b5..ce55d1bade4549c 100644 --- a/src/components/overrides/Head.astro +++ b/src/components/overrides/Head.astro @@ -138,6 +138,19 @@ if (currentSection) { } } +// Add noindex tag if present in frontmatter + +if (Astro.props.entry.data.noindex) { + Astro.props.entry.data.head.push({ + tag: "meta", + attrs: { + name: "robots", + content: "noindex", + }, + content: "", + }); +} + // Adding metadata used for reporting and search indexing // content type if (Astro.props.entry.data.pcx_content_type) { diff --git a/src/content/docs/workers/configuration/sites/configuration.mdx b/src/content/docs/workers/configuration/sites/configuration.mdx index 26203d3d2b6f3d4..a6a79f1b235947b 100644 --- a/src/content/docs/workers/configuration/sites/configuration.mdx +++ b/src/content/docs/workers/configuration/sites/configuration.mdx @@ -1,12 +1,12 @@ --- pcx_content_type: configuration title: Workers Sites configuration +noindex: true sidebar: order: 4 - --- -import { Render, WranglerConfig } from "~/components" +import { Render, WranglerConfig } from "~/components"; @@ -16,29 +16,23 @@ Workers Sites require the latest version of [Wrangler](https://github.com/cloudf There are a few specific configuration settings for Workers Sites in your Wrangler file: +- `bucket` required + - The directory containing your static assets, path relative to your `wrangler.toml / wrangler.json` file. Example: `bucket = "./public"`. -* `bucket` required - - * The directory containing your static assets, path relative to your `wrangler.toml / wrangler.json` file. Example: `bucket = "./public"`. - -* `include` optional - - * A list of gitignore-style patterns for files or directories in `bucket` you exclusively want to upload. Example: `include = ["upload_dir"]`. - -* `exclude` optional - * A list of gitignore-style patterns for files or directories in `bucket` you want to exclude from uploads. Example: `exclude = ["ignore_dir"]`. +- `include` optional + - A list of gitignore-style patterns for files or directories in `bucket` you exclusively want to upload. Example: `include = ["upload_dir"]`. +- `exclude` optional + - A list of gitignore-style patterns for files or directories in `bucket` you want to exclude from uploads. Example: `exclude = ["ignore_dir"]`. To learn more about the optional `include` and `exclude` fields, refer to [Ignoring subsets of static assets](#ignoring-subsets-of-static-assets). :::note - If your project uses [environments](/workers/wrangler/environments/), make sure to place `site` above any environment-specific configuration blocks. - ::: Example of a `wrangler.toml / wrangler.json` file: @@ -80,8 +74,6 @@ This means that you should use gitignore semantics when declaring which director If you want to include only a certain set of files or directories in your `bucket`, you can add an `include` field to your `[site]` section of your Wrangler file: - - ```toml @@ -98,8 +90,6 @@ Wrangler will only upload files or directories matching the patterns in the `inc If you want to exclude files or directories in your `bucket`, you can add an `exclude` field to your `[site]` section of your Wrangler file: - - ```toml @@ -120,9 +110,9 @@ If you provide both `include` and `exclude` fields, the `include` field will be Wrangler will always ignore: -* `node_modules` -* Hidden files and directories -* Symlinks +- `node_modules` +- Hidden files and directories +- Symlinks #### More about include/exclude patterns diff --git a/src/content/docs/workers/configuration/sites/index.mdx b/src/content/docs/workers/configuration/sites/index.mdx index 7420de45c11f978..54642c46a7b2e5e 100644 --- a/src/content/docs/workers/configuration/sites/index.mdx +++ b/src/content/docs/workers/configuration/sites/index.mdx @@ -3,10 +3,11 @@ pcx_content_type: navigation title: Workers Sites head: [] description: Use [Workers Static Assets](/workers/static-assets/) to host full-stack applications instead of Workers Sites. Do not use Workers Sites for new projects. +noindex: true --- -import { Render } from "~/components" -import { LinkButton } from "~/components" +import { Render } from "~/components"; +import { LinkButton } from "~/components"; @@ -14,34 +15,38 @@ Workers Sites enables developers to deploy static applications directly to Worke To deploy with Workers Sites, select from one of these three approaches depending on the state of your target project: -*** +--- ## 1. Start from scratch If you are ready to start a brand new project, this quick start guide will help you set up the infrastructure to deploy a HTML website to Workers. -Start from scratch + + Start from scratch + -*** +--- ## 2. Deploy an existing static site If you have an existing project or static assets that you want to deploy with Workers, this quick start guide will help you install Wrangler and configure Workers Sites for your project. -Start from an existing static site + + Start from an existing static site + -*** +--- ## 3. Add static assets to an existing Workers project If you already have a Worker deployed to Cloudflare, this quick start guide will show you how to configure the existing codebase to use Workers Sites. -Start from an existing Worker + + Start from an existing Worker + :::note - Workers Sites is built on Workers KV, and usage rates may apply. Refer to [Pricing](/workers/platform/pricing/) to learn more. - ::: diff --git a/src/content/docs/workers/configuration/sites/start-from-existing.mdx b/src/content/docs/workers/configuration/sites/start-from-existing.mdx index efcbaacb27c500b..99937e36aebad68 100644 --- a/src/content/docs/workers/configuration/sites/start-from-existing.mdx +++ b/src/content/docs/workers/configuration/sites/start-from-existing.mdx @@ -1,6 +1,7 @@ --- pcx_content_type: how-to title: Start from existing +noindex: true sidebar: order: 1 --- @@ -126,8 +127,6 @@ async function handleEvent(event) { 6. Deploy your site to a [custom domain](/workers/configuration/routing/custom-domains/) that you own and have already attached as a Cloudflare zone. Add a `route` property to the Wrangler file. - - ```toml diff --git a/src/content/docs/workers/configuration/sites/start-from-scratch.mdx b/src/content/docs/workers/configuration/sites/start-from-scratch.mdx index c5198648b52b172..fe71ca55a981e85 100644 --- a/src/content/docs/workers/configuration/sites/start-from-scratch.mdx +++ b/src/content/docs/workers/configuration/sites/start-from-scratch.mdx @@ -1,6 +1,7 @@ --- pcx_content_type: how-to title: Start from scratch +noindex: true sidebar: order: 2 --- @@ -60,8 +61,6 @@ The template project contains the following files and directories: - Consider updating`compatibility_date` to today's date to get access to the most recent Workers features: - - ```toml @@ -72,8 +71,6 @@ The template project contains the following files and directories: - Deploy your site to a [custom domain](/workers/configuration/routing/custom-domains/) that you own and have already attached as a Cloudflare zone: - - ```toml diff --git a/src/content/docs/workers/configuration/sites/start-from-worker.mdx b/src/content/docs/workers/configuration/sites/start-from-worker.mdx index 46d789a4db225de..3c8b6144b809081 100644 --- a/src/content/docs/workers/configuration/sites/start-from-worker.mdx +++ b/src/content/docs/workers/configuration/sites/start-from-worker.mdx @@ -1,6 +1,7 @@ --- pcx_content_type: how-to title: Start from Worker +noindex: true sidebar: order: 3 --- diff --git a/src/schemas/base.ts b/src/schemas/base.ts index 78df5c84e90097e..03d5f4a5fb4e035 100644 --- a/src/schemas/base.ts +++ b/src/schemas/base.ts @@ -73,6 +73,7 @@ export const baseSchema = z.object({ summary: z.string().optional(), goal: z.string().array().optional(), operation: z.string().array().optional(), + noindex: z.boolean().optional(), sidebar: z .object({ order: z.number().optional(),