You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/style-guide/how-we-docs/metadata.mdx
+31-13Lines changed: 31 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ meta:
5
5
title: Metadata | How we docs
6
6
---
7
7
8
+
import { GitHubCode } from"~/components";
9
+
8
10
Page-level metadata - content type, associated products, last updated, word count - lets you take a broader, more strategic view of your content.
9
11
10
12
It helps you answer questions like the following:
@@ -47,13 +49,30 @@ We set these values at two different levels, the folder level and the page level
47
49
48
50
We set two values at a folder level, `Product` and `Product Group`. We take this approach because we can assume that these values apply every page within that folder.
49
51
50
-
{/* GitHubCode example of a product.yaml file */}
52
+
For example, here's the content from our [DNS folder](https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/products/dns.yaml).
53
+
54
+
<GitHubCode
55
+
repo="cloudflare/cloudflare-docs"
56
+
file="src/content/products/dns.yaml"
57
+
commit="eeb4aadac6e1ca1f25f698385c1217cabda1adac"
58
+
lang="yaml"
59
+
code={{ title: "dns.yaml", mark: [4, 6] }}
60
+
/>
51
61
52
62
### Page-level attributes
53
63
54
64
We primarily set page-level attributes through the [page's frontmatter](/style-guide/frontmatter/custom-properties/).
55
65
56
-
{/* GitHubCode example of a specific file with a lot of them */}
66
+
For example, here are the values set for our [Build a Slackbot tutorial](/workers/tutorials/build-a-slackbot/).
However, the `last_modified` value is pulled automatically from the git history of a file.
59
78
@@ -73,9 +92,16 @@ For example, these are the `meta` properties and values on the [AI Audit - Get S
73
92
<metaname="pcx_last_modified"content="7" >
74
93
```
75
94
76
-
We render these values using a custom override for our [`Head.astro`]() file.
95
+
We render these values using a custom override for our [`Head.astro`](https://github.com/cloudflare/cloudflare-docs/blob/production/src/components/overrides/Head.astro) file. If specific values are set, we then add them as meta tags onto the page.
77
96
78
-
{/* GitHubCode for Head.astro */}
97
+
<GitHubCode
98
+
repo="cloudflare/cloudflare-docs"
99
+
file="src/components/overrides/Head.astro"
100
+
commit="80573b88bd2a491240e404938feb506d347093db"
101
+
lang="ts"
102
+
lines="65-72"
103
+
code={{ title: "Head.astro" }}
104
+
/>
79
105
80
106
### Benefits
81
107
@@ -91,14 +117,6 @@ Additionally, this decisions means that our GitHub repo is always the source of
91
117
92
118
It's difficult to avoid errors with this kind of metadata, specifically because we are relying on freeform text entry in the frontmatter of individual files.
93
119
94
-
We utilize `zod` schemas heavily in our Astro site, which are defined at [tbd](/tbd/).
120
+
We utilize [Zod schemas](https://zod.dev/) heavily in our Astro site, which are defined in [`src/schemas/`](https://github.com/cloudflare/cloudflare-docs/tree/production/src/schemas).
95
121
96
122
These allow us to provide Intellisense guidance for contributors using IDEs for local development.
97
-
98
-
### Optional or required
99
-
100
-
At the moment, most of our Zod schemas are purely optional, meaning that they will not cause a build to fail.
101
-
102
-
However, we do have one value, `tags`, that we enforce an allowlist as part of our schema validation. We enforce this schema specifically because we render it as a customer-facing facet for our [search page](/search/), meaning that typos are more disruptive than for other types of metadata.
103
-
104
-
To try and make this list a bit more flexible, we've included `alternate` values that can lead to the same presented value.
0 commit comments