Skip to content

Discussion on tag format#5975

Closed
mambax wants to merge 1 commit intofacebook:mainfrom
mambax:main
Closed

Discussion on tag format#5975
mambax wants to merge 1 commit intofacebook:mainfrom
mambax:main

Conversation

@mambax
Copy link

@mambax mambax commented Nov 19, 2021

Just a first draft to discuss the format (the learning curve is quite steep but I am super motivated 🚀).

The challenge is that Tag can be either a string or a Tag object.

Should we account for both or only the Tag object?

I try to do TDD for once writing the tests first but I feel I need to know the decision here and after that maybe a bit of guidance as when I look at the authors implementation it's not quite a two-liner 😏

@facebook-github-bot
Copy link
Contributor

Hi @mambax!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@netlify
Copy link

netlify bot commented Nov 19, 2021

✔️ [V2]
Built without sensitive environment variables

🔨 Explore the source changes: 93593bc

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6197df9f3e82360008280138

😎 Browse the preview: https://deploy-preview-5975--docusaurus-2.netlify.app

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 93
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5975--docusaurus-2.netlify.app/

@Josh-Cena
Copy link
Collaborator

I try to do TDD for once writing the tests first but I feel I need to know the decision here and after that maybe a bit of guidance as when I look at the authors implementation it's not quite a two-liner 😏

It's not quite my style to do TDD. Tests are always a pain especially with fixtures and mock implementations😅 So not much to offer. There's a Jest extension on vscode made by orta to facilitate TDD I believe, but I never turned it on.

The challenge is that Tag can be either a string or a Tag object.

I would prefer a map rather than a list.

---
# instead of this:
tags:
  - release
  - i18n
  - recap
---
# or this:
tags:
  - label: release
  - label: i18n
  - label: recap
---
# I'd like this:
release:
  label: release
  description: xxx
i18n:
  label: i18n
  description: xxx
recap:
  label: recap
  description: xxx
---

Just like authors, you can then reference them in docs/blog using keys:

---
tags: [release, i18n]
---

In this case, these strings are keys, not labels. If there isn't a matching key in the tags definition, Docusaurus would frown at you.

@mambax
Copy link
Author

mambax commented Nov 20, 2021

Thanks @Josh-Cena!

I see the map as very handy, I tried to avoid repeating more code but I see clearly the advantage. On it!

Regarding TDD; I don't mean real book TDD. I just first want to reproduce the tests from the authors file as it's a better starting point than randomly coding around.

I will close this PR as I made a mistake (I committed it from my work GH account and created the PR with my private one). Therefore I also mixed the CLAs. Will reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants