-
Notifications
You must be signed in to change notification settings - Fork 10k
Style guide best practices #23516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Style guide best practices #23516
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1590890
structure
kodster28 225febc
Image maintenance
kodster28 6a9eaeb
Add page on screenshots
kodster28 e70f243
Finish screenshot guidelines
kodster28 bd8d6cc
migrated over info on redirects
kodster28 6c12034
structure for metadata page
kodster28 2acef48
Add in code examples for metadata
kodster28 3b48e0e
Added scripts and links to redirects
kodster28 a16cad7
Finish adding in links
kodster28 01cf1af
Denise feedback
kodster28 54f4690
Merge branch 'production' into style-guide-best-practices
kodster28 9343bd4
Apply suggestions from code review
kodster28 476780d
Tweaks from Caley
kodster28 915bff7
Small update
kodster28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 6 additions & 7 deletions
13
src/content/docs/style-guide/api-content-strategy/index.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/content/docs/style-guide/how-we-docs/image-maintenance.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Image maintenance | ||
| meta: | ||
| title: Image maintenance | How we docs | ||
| --- | ||
|
|
||
| import { GitHubCode } from "~/components"; | ||
|
|
||
| Though valuable for user understanding, images are difficult to maintain. We have a few strategies that we use to help make this easier. | ||
|
|
||
| ## Guidelines | ||
|
|
||
| We support a few different types of images in our docs, including: | ||
|
|
||
| - [Diagrams](/style-guide/documentation-content-strategy/component-attributes/diagrams/) | ||
| - [Mermaid diagrams](/style-guide/components/mermaid/) | ||
| - Screenshots | ||
|
|
||
| Of these, we prefer Mermaid diagrams because they are searchable and changeable. The "cost" of updating a Mermaid diagram is much lower than re-taking a screenshot or working with a designer to update a diagram. | ||
|
|
||
| Additionally, you should only use screenshots intentionally, such as when there's a clear user confusion that needs a visual image. [Find account and zone ID](/fundamentals/account/find-account-and-zone-ids/) is a good illustration of this, because it's a common user pain point and one that's very difficult in the current Cloudflare UI. | ||
|
|
||
| ## Maintenance | ||
|
|
||
| The best way to improve image maintenance is to avoid using them. | ||
|
|
||
| The other way to streamline maintenance is to remove images that are no longer referenced in your documentation. This pattern becomes particularly helpful if you need to audit images for UI changes or leaked information, because then you are not wasting time looking at unused images too. | ||
|
|
||
| We do that through a combination of GitHub actions. | ||
|
|
||
| ### Flag unused images | ||
|
|
||
| We have a specific GitHub action to [flag unused images](https://github.com/cloudflare/cloudflare-docs/blob/production/.github/workflows/image-audit.yml). | ||
|
|
||
| What it does is: | ||
|
|
||
| 1. Finds all `.png` or `.svg` files in our content. | ||
| 2. Checks to see if those files are referenced in any of our MDX files. | ||
| 3. If there are unreferenced files, creates a [GitHub issue](https://github.com/cloudflare/cloudflare-docs/issues/23343) listing them out. | ||
kodster28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Evaluate image paths | ||
|
|
||
| In combination with [flagging unused images](#flag-unused-images), we also have logic in our [build process](https://github.com/cloudflare/cloudflare-docs/blob/production/astro.config.ts) to validate image paths. | ||
|
|
||
| <GitHubCode | ||
| repo="cloudflare/cloudflare-docs" | ||
| file="astro.config.ts" | ||
| commit="aaacc3c3c2a7517ee307ddfc56962cbea9847202" | ||
| lang="ts" | ||
| lines="62-76" | ||
| code={{ title: "astro.config.ts", mark: 5 }} | ||
| /> | ||
|
|
||
| This line ensures that our custom [Remark plugin](https://github.com/cloudflare/cloudflare-docs/blob/production/src/plugins/remark/validate-images.ts) validates all images paths. If the path does not exist, we throw an error and prevent the site from building. | ||
|
|
||
| <GitHubCode | ||
| repo="cloudflare/cloudflare-docs" | ||
| file="src/plugins/remark/validate-images.ts" | ||
| commit="fdeaadcfa99030d085512e721bc0a5948dcf70d4" | ||
| lang="ts" | ||
| code={{ title: "validate-images.ts" }} | ||
| /> | ||
|
|
||
| When paired with [flagging unused images](#flag-unused-images), this path validation ensures that a tech writer can safely delete unused files in a PR. So long as the site builds correctly, you have only deleted image files that are not referenced anywhere. | ||
kodster28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| pcx_content_type: navigation | ||
| title: How we docs | ||
| sidebar: | ||
| order: 10 | ||
| --- | ||
|
|
||
| import { DirectoryListing } from "~/components"; | ||
|
|
||
| This section shares how Cloudflare approaches docs strategically, covering topics like `how we built our site` and `how we think about redirects`. | ||
|
|
||
| The goal is twofold, because it: | ||
kodster28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Encourages deep thinking about how we approach things (and if they could be better). | ||
| - Contributes back to the open-source ecosystem. We get a lot of benefits from being open source and we want to give back. | ||
|
|
||
| We hope you learn from the topics below. As always, [submit an issue](https://github.com/cloudflare/cloudflare-docs/issues/new) if you find something inaccurate or unclear. | ||
|
|
||
| <DirectoryListing /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Links | ||
| meta: | ||
| title: Links | How we docs | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
kodster28 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pcx_content_type: how-to | ||
| title: Metadata | ||
| meta: | ||
| title: Metadata | How we docs | ||
| --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Redirects | ||
| meta: | ||
| title: Redirects | How we docs | ||
| --- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.