Skip to content
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

feat(docs, blog): add support for tags.yml, predefined list of tags #10137

Merged
merged 145 commits into from
May 31, 2024

Conversation

OzakIOne
Copy link
Contributor

@OzakIOne OzakIOne commented May 14, 2024

Motivation

User request to have a predefined list of tags in a file which you can only choose from

Using a tags file, you can ensure that your tags usage is consistent across your plugin content set. Use the onInlineTags: 'throw' plugin option to enforce this consistency and prevent usage of inline tags declared on the fly.

Behavior :
undefined: search tags.yml by convention. Feature disabled if file does not exist
null/false (default): feature disabled even if tags.yml exists
tagFile.yml: search for tagFile.yml and throw if file does not exist

We check for duplicated tags permalink route and throw in case of duplication

Test Plan

yarn jest -t
ensureUniquePermalinks
normalizeTags
normalize tags
normalizeFrontMatterTags
processFileTagsPath
Dogfood

Test links

Guides:

API refs:

Tags pages blog:

Tags pages docs:

Related issues/PRs

fix #5913
#5975

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 14, 2024
Copy link

github-actions bot commented May 14, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 75 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 61 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 67 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 62 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 70 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 75 🟢 100 🟢 100 🟢 90 🟠 88 Report

Copy link

netlify bot commented May 14, 2024

[V2]

Name Link
🔨 Latest commit 389e046
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6659ea1795ae61000849512e
😎 Deploy Preview https://deploy-preview-10137--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need :

  export type VersionMetadata = ContentPaths & {
    tagsFile: TagsFile | null;

    tagsPath: string;
  }

We probably need to modify/rename this method

type TagsFile = Record<string, Tag>

export function normalizeFrontMatterTags(
  /** Base path to append the tag permalinks to. */
  tagsPath: string,
  /** Can be `undefined`, so that we can directly pipe in `frontMatter.tags`. */
  frontMatterTags: FrontMatterTag[] | undefined = [],
  tagsFile: TagsFile
): Tag[]

packages/docusaurus-plugin-content-docs/src/options.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-docs/src/options.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-docs/src/tags.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-docs/src/docs.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-docs/src/docs.ts Outdated Show resolved Hide resolved
website/docusaurus.config.ts Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 17, 2024

Size Change: +614 B (+0.04%)

Total Size: 1.72 MB

Filename Size Change
website/.docusaurus/docusaurus.config.mjs 27.1 kB +155 B (+0.58%)
website/.docusaurus/registry.js 276 kB +108 B (+0.04%)
website/.docusaurus/routes.js 180 kB +72 B (+0.04%)
website/.docusaurus/routesChunkNames.json 120 kB +36 B (+0.03%)
website/build/assets/js/main.********.js 855 kB +243 B (+0.03%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/codeTranslations.json 2 B
website/.docusaurus/globalData.json 107 kB
website/.docusaurus/i18n.json 930 B
website/.docusaurus/site-metadata.json 2.17 kB
website/build/assets/css/styles.********.css 112 kB
website/build/index.html 38.1 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Predefined tag lists per plugin/preset
3 participants