Skip to content

Commit

Permalink
refactor: remove deprecated docs homePageId option (#6065)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored Dec 7, 2021
1 parent c64987e commit f96a051
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module.exports = {
'@docusaurus/preset-classic',
{
docs: {
homePageId: 'installation',
showLastUpdateAuthor: true,
showLastUpdateTime: true,
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
Expand All @@ -53,7 +52,7 @@ module.exports = {
title: 'Docusaurus',
logo: {src: 'img/docusaurus.svg'},
items: [
{to: 'docs/', label: 'Docs', position: 'left'},
{to: 'docs/installation', label: 'Docs', position: 'left'},
{to: 'docs/tutorial-setup', label: 'Tutorial', position: 'left'},
{to: '/users', label: 'Users', position: 'left'},
{
Expand Down
6 changes: 1 addition & 5 deletions packages/docusaurus-migrate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ export function createConfigFile({
'v1Config' | 'siteDir' | 'newDir'
>): VersionTwoConfig {
const siteConfig = v1Config;
const homePageId = siteConfig.headerLinks?.filter((value) => value.doc)[0]
.doc;

const customConfigFields: Record<string, unknown> = {};
// add fields that are unknown to v2 to customConfigFields
Object.keys(siteConfig).forEach((key) => {
Expand Down Expand Up @@ -309,7 +306,6 @@ export function createConfigFile({
{
docs: {
...(v2DocsPath && {path: v2DocsPath}),
homePageId,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
editUrl: siteConfig.editUrl,
Expand All @@ -334,7 +330,7 @@ export function createConfigFile({
const position = 'left';
if (doc) {
return {
to: `docs/${doc === homePageId ? '' : doc}`,
to: `docs/${doc}`,
label,
position,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: hello
title: Hello, World !
sidebar_label: Hello sidebar_label
tags: [tag-1, tag 3]
slug: /
---

Hi, Endilie here :)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: hello-1
title: Hello 1
slug: /
---

Hello World 1!
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
slug: /
---
Hello `next` !
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
slug: /
---
Hello `1.0.0` ! (translated en)
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
slug: /
---
Hello `1.0.0` ! (translated fr)
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
slug: /
---
Hello `1.0.0` !
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
slug: /
---
Hello `1.0.1` !
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Array [
Array [
undefined,
Object {
"permalink": "/docs/hello",
"permalink": "/docs/",
"title": "Hello sidebar_label",
},
],
Expand All @@ -41,7 +41,7 @@ Array [
],
Array [
Object {
"permalink": "/docs/hello",
"permalink": "/docs/",
"title": "Hello sidebar_label",
},
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ Object {
\\"tags\\": [
\\"tag-1\\",
\\"tag 3\\"
]
],
\\"slug\\": \\"/\\"
},
\\"sidebar\\": \\"docs\\",
\\"previous\\": {
Expand Down Expand Up @@ -1528,7 +1529,9 @@ Object {
\\"permalink\\": \\"/docs/next/\\",
\\"tags\\": [],
\\"version\\": \\"current\\",
\\"frontMatter\\": {},
\\"frontMatter\\": {
\\"slug\\": \\"/\\"
},
\\"sidebar\\": \\"docs\\",
\\"previous\\": {
\\"title\\": \\"bar\\",
Expand Down Expand Up @@ -1606,7 +1609,9 @@ Object {
\\"permalink\\": \\"/docs/1.0.0/\\",
\\"tags\\": [],
\\"version\\": \\"1.0.0\\",
\\"frontMatter\\": {},
\\"frontMatter\\": {
\\"slug\\": \\"/\\"
},
\\"sidebar\\": \\"version-1.0.0/docs\\",
\\"previous\\": {
\\"title\\": \\"baz\\",
Expand Down Expand Up @@ -1684,7 +1689,9 @@ Object {
\\"permalink\\": \\"/docs/\\",
\\"tags\\": [],
\\"version\\": \\"1.0.1\\",
\\"frontMatter\\": {},
\\"frontMatter\\": {
\\"slug\\": \\"/\\"
},
\\"sidebar\\": \\"VersionedSideBarNameDoesNotMatter/docs\\",
\\"previous\\": {
\\"title\\": \\"bar\\",
Expand Down
Loading

0 comments on commit f96a051

Please sign in to comment.