Repository navigation
feat: doc tags (same as blog tags) - #3646
Conversation
- Addition of plugin-content-docs - Addition of DocTagsListPage in `docusaurus-theme-classic` ! Error exists for this commit towards the theme aspect and help required. Commit towards meta#3434
|
Hi @isaac-philip! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, 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. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
✔️ [V2] 🔨 Explore the source changes: 58367bb 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/611d4abc00054300074b5878 😎 Browse the preview: https://deploy-preview-3646--docusaurus-2.netlify.app |
slorber
left a comment
There was a problem hiding this comment.
I've commited various changes to your branch to help you get started.
My code is not production ready nor tested, but it's mostly to help you figure things out and create a nice PR.
I only handled the creation of the tas list page, you can proceed to create one specific page per tag in the same way.
Note each version has a:
- set of docs
- a tag list
- a page per tag linking to the docs having it in the same version
Let me know if you need more help
Also, don't forget to sign the FB CLA.
| const tagsProp = mapValues(loadedVersion.tags, (tagValue) => ({ | ||
| name: tagValue.name, | ||
| permalink: tagValue.permalink, | ||
| count: tagValue.docIds.length, | ||
| })); | ||
| const tagsPropPath = await createData( | ||
| `${docuHash(`tags-list-${loadedVersion.versionName}-prop`)}.json`, | ||
| JSON.stringify(tagsProp, null, 2), | ||
| ); |
There was a problem hiding this comment.
this is how you create a component prop as json object (should rather be moved to props.ts and have an explicit type)
|
|
||
| async function createTagPage(tag: VersionTag) { | ||
| // TODO | ||
| console.log(`todo createTagPage for tag=${tag.name}`); |
There was a problem hiding this comment.
todo: do something similar to create one page per tag
| title: Introduction | ||
| description: Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. | ||
| slug: / | ||
| tags: [test-tag, myOtherTag] |
| versionPath: string; | ||
| mainDocId: string; | ||
| docs: DocMetadata[]; | ||
| tags: VersionTags; |
There was a problem hiding this comment.
the tags are per version, it's not just a global set of tags for all the docs of the site, there is one set of tag per version
|
So finally was able to get a deploy preview to work (after fixing the bootstrap theme). Note:
As you can see, each version should have its set of tags. "current" version has 2 tags, but alpha 66 do not have any tag. This is because only docs of "current" version have been tagged |
|
Hey @slorber , thanks for this. |
|
great let me know if you need help to complete it |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
- individual doc tag page added to show docs for that specific tag
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-3646--docusaurus-2.netlify.app/ |
|
still WIP but nearing a review, next steps is to,
|
|
Done with the two top items,
|
|
Hello @slorber , require some guidance here please. for now have the page as this that means the {
"name": "myothertag",
"permalink": "/docs/tags/my-other-tag",
"docIds": [
"deployment",
"introduction"
],
"allTagsPath": "/docs/tags"
}that is more info in the <div className="margin-vert--xl">
{items.map(({content: BlogPostContent}) => (
<BlogPostItem
key={BlogPostContent.metadata.permalink}
frontMatter={BlogPostContent.frontMatter}
metadata={BlogPostContent.metadata}
truncated>
<BlogPostContent />
</BlogPostItem>
))}
</div>Please guide, I checked but the DocContent item props etc I cannot figure out from where to utilize it? |
|
@nam-hle can you suggest please? |
|
Not sure what you need. Please explain more about your situation, perhaps because of my limited knowledge about the codebase. |
# Conflicts: # packages/docusaurus-plugin-content-docs/src/docs.ts # packages/docusaurus-plugin-content-docs/src/index.ts # packages/docusaurus-plugin-content-docs/src/types.ts # packages/docusaurus-plugin-content-docs/src/versions.ts # website/docusaurus.config.js
|
Thanks @isaac-philip, I've completed your PR and made some useful cleanups/refactors to avoid code duplication and swizzle theme comps more easily. Unless someone has any comment I'll merge it tomorrow. |
|
thanks @slorber !! 😇 |
* [v2] tags to doc, same as tags to blog - [IN PROGRESS] - Addition of plugin-content-docs - Addition of DocTagsListPage in `docusaurus-theme-classic` ! Error exists for this commit towards the theme aspect and help required. Commit towards meta#3434 * docs: make tags list page work * temp: disable onBrokenLinks * theme bootstrap: create DocTagsListPage * DocTagsPage added and functionality too - individual doc tag page added to show docs for that specific tag * Added all Docs Tags Link * add some shared tag utils * move tag tests to _dogfooding * fix type * fix some tests * fix blog test * refactor blog post tags handling * better yaml tag examples * better dogfood md files * refactor and factorize theme tag components * finish DocTagDocListPage * Extract DocItemFooter + add inline tag list * minor fix * better typings * fix versions.test.ts tests * add tests for doc tags * fix tests * test toTagDocListProp * move shared theme code to tagUtils * Add new theme translation keys * move common theme code to tagUtils + add tests * update-code-translations should handle theme-common * update french translation * revert add translation * fix pluralization problem in theme.docs.tagDocListPageTitle * add theme component configuration options * add more tags tests * add documentation for docs tagging Co-authored-by: slorber <[email protected]>
* [v2] tags to doc, same as tags to blog - [IN PROGRESS] - Addition of plugin-content-docs - Addition of DocTagsListPage in `docusaurus-theme-classic` ! Error exists for this commit towards the theme aspect and help required. Commit towards meta#3434 * docs: make tags list page work * temp: disable onBrokenLinks * theme bootstrap: create DocTagsListPage * DocTagsPage added and functionality too - individual doc tag page added to show docs for that specific tag * Added all Docs Tags Link * add some shared tag utils * move tag tests to _dogfooding * fix type * fix some tests * fix blog test * refactor blog post tags handling * better yaml tag examples * better dogfood md files * refactor and factorize theme tag components * finish DocTagDocListPage * Extract DocItemFooter + add inline tag list * minor fix * better typings * fix versions.test.ts tests * add tests for doc tags * fix tests * test toTagDocListProp * move shared theme code to tagUtils * Add new theme translation keys * move common theme code to tagUtils + add tests * update-code-translations should handle theme-common * update french translation * revert add translation * fix pluralization problem in theme.docs.tagDocListPageTitle * add theme component configuration options * add more tags tests * add documentation for docs tagging Co-authored-by: slorber <[email protected]>


Note: PR completed by @slorber
Breaking changes
/blog/tags/<myTag>(let me know if you have an use-case for unprefixing them, we can restore that behavior if really needed)Motivation
Implement doc tags, similar to existing blog tags
tagsfrontmatterHave you read the Contributing Guidelines on pull requests?
yes
Test Plan
test + dogfood/peview