feat(v2): introduce docs slug in front matter (#2771)

* feat: docs pathname frontmatter (for #2697)

* feat: docs pathname frontmatter (for #2697)

* chore: comment typo

* feat: add slug frontmatter for docs

* test: add tests for versioned sites slugs

* docs: document slug feature

* test: fix tests and snapshots about doc slug feature

* docs(v2): doc slug wording

* Update website/docs/docs.md

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
This commit is contained in:
Sébastien Lorber 2020-06-02 19:50:30 +02:00 committed by GitHub
parent a32422caa2
commit b8de9c6ded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 71 additions and 24 deletions

View file

@ -163,7 +163,7 @@ describe('simple website', () => {
permalink: '/docs/hello',
previous: {
title: 'baz',
permalink: '/docs/foo/baz',
permalink: '/docs/foo/bazSlug.html',
},
sidebar: 'docs',
source: path.join('@site', pluginPath, 'hello.md'),
@ -175,7 +175,7 @@ describe('simple website', () => {
id: 'foo/bar',
next: {
title: 'baz',
permalink: '/docs/foo/baz',
permalink: '/docs/foo/bazSlug.html',
},
permalink: '/docs/foo/bar',
sidebar: 'docs',
@ -300,7 +300,7 @@ describe('versioned website', () => {
expect(docsMetadata['version-1.0.1/foo/baz']).toBeUndefined();
expect(docsMetadata['foo/bar']).toEqual({
id: 'foo/bar',
permalink: '/docs/next/foo/bar',
permalink: '/docs/next/foo/barSlug',
source: path.join('@site', routeBasePath, 'foo', 'bar.md'),
title: 'bar',
description: 'This is next version of bar.',
@ -321,7 +321,7 @@ describe('versioned website', () => {
sidebar: 'docs',
previous: {
title: 'bar',
permalink: '/docs/next/foo/bar',
permalink: '/docs/next/foo/barSlug',
},
});
expect(docsMetadata['version-1.0.1/hello']).toEqual({
@ -363,7 +363,7 @@ describe('versioned website', () => {
},
previous: {
title: 'bar',
permalink: '/docs/1.0.0/foo/bar',
permalink: '/docs/1.0.0/foo/barSlug',
},
});