mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
feat: doc tags (same as blog tags) (#3646)
* [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 #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 <lorber.sebastien@gmail.com>
This commit is contained in:
parent
f666de7e59
commit
f9c79cbd58
81 changed files with 1874 additions and 381 deletions
|
@ -187,6 +187,7 @@ describe('simple site', () => {
|
|||
id: 'bar',
|
||||
title: 'Bar',
|
||||
},
|
||||
tags: [],
|
||||
});
|
||||
await defaultTestUtils.testMeta(path.join('hello.md'), {
|
||||
version: 'current',
|
||||
|
@ -202,7 +203,18 @@ describe('simple site', () => {
|
|||
id: 'hello',
|
||||
title: 'Hello, World !',
|
||||
sidebar_label: 'Hello sidebar_label',
|
||||
tags: ['tag-1', 'tag 3'],
|
||||
},
|
||||
tags: [
|
||||
{
|
||||
label: 'tag-1',
|
||||
permalink: '/docs/tags/tag-1',
|
||||
},
|
||||
{
|
||||
label: 'tag 3',
|
||||
permalink: '/docs/tags/tag-3',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -232,7 +244,18 @@ describe('simple site', () => {
|
|||
id: 'hello',
|
||||
title: 'Hello, World !',
|
||||
sidebar_label: 'Hello sidebar_label',
|
||||
tags: ['tag-1', 'tag 3'],
|
||||
},
|
||||
tags: [
|
||||
{
|
||||
label: 'tag-1',
|
||||
permalink: '/docs/tags/tag-1',
|
||||
},
|
||||
{
|
||||
label: 'tag 3',
|
||||
permalink: '/docs/tags/tag-3',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -263,6 +286,7 @@ describe('simple site', () => {
|
|||
id: 'bar',
|
||||
title: 'Bar',
|
||||
},
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -297,7 +321,22 @@ describe('simple site', () => {
|
|||
slug: 'bazSlug.html',
|
||||
title: 'baz',
|
||||
pagination_label: 'baz pagination_label',
|
||||
tags: [
|
||||
'tag 1',
|
||||
'tag-1',
|
||||
{label: 'tag 2', permalink: 'tag2-custom-permalink'},
|
||||
],
|
||||
},
|
||||
tags: [
|
||||
{
|
||||
label: 'tag 1',
|
||||
permalink: '/docs/tags/tag-1',
|
||||
},
|
||||
{
|
||||
label: 'tag 2',
|
||||
permalink: '/docs/tags/tag2-custom-permalink',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -319,6 +358,7 @@ describe('simple site', () => {
|
|||
custom_edit_url: 'https://github.com/customUrl/docs/lorem.md',
|
||||
unrelated_frontmatter: "won't be part of metadata",
|
||||
},
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -356,7 +396,22 @@ describe('simple site', () => {
|
|||
slug: 'bazSlug.html',
|
||||
title: 'baz',
|
||||
pagination_label: 'baz pagination_label',
|
||||
tags: [
|
||||
'tag 1',
|
||||
'tag-1',
|
||||
{label: 'tag 2', permalink: 'tag2-custom-permalink'},
|
||||
],
|
||||
},
|
||||
tags: [
|
||||
{
|
||||
label: 'tag 1',
|
||||
permalink: '/docs/tags/tag-1',
|
||||
},
|
||||
{
|
||||
label: 'tag 2',
|
||||
permalink: '/docs/tags/tag2-custom-permalink',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(editUrlFunction).toHaveBeenCalledTimes(1);
|
||||
|
@ -402,6 +457,7 @@ describe('simple site', () => {
|
|||
lastUpdatedAt: 1539502055,
|
||||
formattedLastUpdatedAt: '10/14/2018',
|
||||
lastUpdatedBy: 'Author',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -559,6 +615,7 @@ describe('versioned site', () => {
|
|||
|
||||
await currentVersionTestUtils.testMeta(path.join('foo', 'bar.md'), {
|
||||
id: 'foo/bar',
|
||||
version: 'current',
|
||||
unversionedId: 'foo/bar',
|
||||
sourceDirName: 'foo',
|
||||
isDocsHomePage: false,
|
||||
|
@ -566,11 +623,35 @@ describe('versioned site', () => {
|
|||
slug: '/foo/barSlug',
|
||||
title: 'bar',
|
||||
description: 'This is next version of bar.',
|
||||
frontMatter: {slug: 'barSlug'},
|
||||
version: 'current',
|
||||
frontMatter: {
|
||||
slug: 'barSlug',
|
||||
tags: [
|
||||
'barTag 1',
|
||||
'barTag-2',
|
||||
{
|
||||
label: 'barTag 3',
|
||||
permalink: 'barTag-3-permalink',
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: [
|
||||
{
|
||||
label: 'barTag 1',
|
||||
permalink: '/docs/next/tags/bar-tag-1',
|
||||
},
|
||||
{
|
||||
label: 'barTag-2',
|
||||
permalink: '/docs/next/tags/bar-tag-2',
|
||||
},
|
||||
{
|
||||
label: 'barTag 3',
|
||||
permalink: '/docs/next/tags/barTag-3-permalink',
|
||||
},
|
||||
],
|
||||
});
|
||||
await currentVersionTestUtils.testMeta(path.join('hello.md'), {
|
||||
id: 'hello',
|
||||
version: 'current',
|
||||
unversionedId: 'hello',
|
||||
sourceDirName: '.',
|
||||
isDocsHomePage: false,
|
||||
|
@ -579,7 +660,7 @@ describe('versioned site', () => {
|
|||
title: 'hello',
|
||||
description: 'Hello next !',
|
||||
frontMatter: {},
|
||||
version: 'current',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -597,6 +678,7 @@ describe('versioned site', () => {
|
|||
description: 'Bar 1.0.0 !',
|
||||
frontMatter: {slug: 'barSlug'},
|
||||
version: '1.0.0',
|
||||
tags: [],
|
||||
});
|
||||
await version100TestUtils.testMeta(path.join('hello.md'), {
|
||||
id: 'version-1.0.0/hello',
|
||||
|
@ -611,6 +693,7 @@ describe('versioned site', () => {
|
|||
version: '1.0.0',
|
||||
source:
|
||||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
tags: [],
|
||||
});
|
||||
await version101TestUtils.testMeta(path.join('foo', 'bar.md'), {
|
||||
id: 'version-1.0.1/foo/bar',
|
||||
|
@ -623,6 +706,7 @@ describe('versioned site', () => {
|
|||
description: 'Bar 1.0.1 !',
|
||||
version: '1.0.1',
|
||||
frontMatter: {},
|
||||
tags: [],
|
||||
});
|
||||
await version101TestUtils.testMeta(path.join('hello.md'), {
|
||||
id: 'version-1.0.1/hello',
|
||||
|
@ -635,6 +719,7 @@ describe('versioned site', () => {
|
|||
description: 'Hello 1.0.1 !',
|
||||
version: '1.0.1',
|
||||
frontMatter: {},
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -729,6 +814,7 @@ describe('versioned site', () => {
|
|||
source:
|
||||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl: hardcodedEditUrl,
|
||||
tags: [],
|
||||
});
|
||||
|
||||
expect(editUrlFunction).toHaveBeenCalledTimes(1);
|
||||
|
@ -771,6 +857,7 @@ describe('versioned site', () => {
|
|||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-1.0.0/hello.md',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -804,6 +891,7 @@ describe('versioned site', () => {
|
|||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs/hello.md',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -838,6 +926,7 @@ describe('versioned site', () => {
|
|||
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -873,6 +962,7 @@ describe('versioned site', () => {
|
|||
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/current/hello.md',
|
||||
tags: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue