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:
Isaac Philip 2021-08-19 14:01:15 +05:30 committed by GitHub
parent f666de7e59
commit f9c79cbd58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 1874 additions and 381 deletions

View file

@ -60,6 +60,7 @@ const defaultDocMetadata: Partial<DocMetadata> = {
lastUpdatedAt: undefined,
lastUpdatedBy: undefined,
formattedLastUpdatedAt: undefined,
tags: [],
};
const createFakeActions = (contentDir: string) => {
@ -364,7 +365,23 @@ describe('simple website', () => {
title: 'baz',
slug: 'bazSlug.html',
pagination_label: 'baz pagination_label',
tags: [
'tag 1',
'tag-1', // This one will be de-duplicated as it would lead to the same permalink as the first
{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(findDocById(currentVersion, 'hello')).toEqual({
@ -392,7 +409,18 @@ describe('simple website', () => {
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',
},
],
});
expect(getDocById(currentVersion, 'foo/bar')).toEqual({
@ -579,6 +607,11 @@ describe('versioned website', () => {
description: 'This is next version of bar.',
frontMatter: {
slug: 'barSlug',
tags: [
'barTag 1',
'barTag-2',
{label: 'barTag 3', permalink: 'barTag-3-permalink'},
],
},
version: 'current',
sidebar: 'docs',
@ -586,6 +619,11 @@ describe('versioned website', () => {
title: 'hello',
permalink: '/docs/next/',
},
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'},
],
});
expect(getDocById(currentVersion, 'hello')).toEqual({
...defaultDocMetadata,