Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please tell me migration procedure about sidebar (Breaking Change) #36

Closed
yoshixmk opened this issue Aug 11, 2020 · 4 comments
Closed
Assignees
Labels

Comments

@yoshixmk
Copy link

Describe the bug
Can you give me an example of the migration procedure for the sidebar?
Sorry, I tried looking at the code to understand how to set it up, but I didn't understand.

error: Uncaught TypeError: sidebarConfig.map is not a function
  return sidebarConfig.map((sidebarConfigItem) => {
                       ^
    at parseSidebarConfig (sidebar.tsx:54:24)
    at Object.fn (sidebar.tsx:35:31)
    at Pagic.runPlugins (Pagic.ts:301:20)
    at async Pagic.rebuild (Pagic.ts:149:5)
    at async Pagic.build (Pagic.ts:133:5)

To Reproduce
When pagic build at https://github.com/yoshixmk/profile, this error occurs.
Here is Detail Log by Github Action.

Expected behavior

  • How to migration.
  • Be able to build.

Context

  • Pagic version: v0.8.6
  • Deno version: 1.2.3
  • Browser version (optional): (no effect)
  • OS version: (no effect)
@yoshixmk yoshixmk added the bug label Aug 11, 2020
@yoshixmk yoshixmk changed the title Tell me migration procedure about sidebar (Breaking Change) Please tell me migration procedure about sidebar (Breaking Change) Aug 11, 2020
@xcatliu
Copy link
Owner

xcatliu commented Aug 11, 2020

Sorry for the confusing.

Yes there is a breaking change in sidebar

The new sidebar config for your project should be:

export default {
  sidebar: {
    '/': [
      "README.md",
      {
        link: "articles/README.md",
        children: [
          "articles/001-deno-introduction-in-my-company.md",
          "articles/002-news-published-third-party-module.md",
          "articles/003-deno-introduction-at-ts-study-meeting.md",
          "articles/004-deno-introduce-by-yoshixmk-regret-10-things.tsx",
          "articles/005-deno-react-chat.md",
          "articles/006-tege-next-introduction.md",
        ],
      },
      {
        link: "translations/README.md",
        children: [
          "translations/001-perfomance-aspect-of-deno-vs-node-js.md",
          "translations/002-what-is-the-best-deno-web-framework.md",
          "translations/003-registration-form-mongodb.md",
          "translations/004-guide-to-porting-node-modules-to-deno.md",
        ],
      },
    ]
  }
};

@xcatliu
Copy link
Owner

xcatliu commented Aug 11, 2020

The new version also support different sidebar in different path, for example:

export default {
  sidebar: {
    '/docs/': [
      "translations/001-perfomance-aspect-of-deno-vs-node-js.md",
      "translations/002-what-is-the-best-deno-web-framework.md"
    ],
    '/news/': [
      "README.md",
      {
        link: "articles/README.md",
        children: [
          "articles/001-deno-introduction-in-my-company.md",
          "articles/002-news-published-third-party-module.md"
        ],
      }
    ]
  }
};

For the above example,

  • page path starts with /docs/ will show the docs sidebar
  • page path starts with /news/ will show the news sidebar
  • other pages will not have any sidebar

@xcatliu
Copy link
Owner

xcatliu commented Aug 11, 2020

I'm writing the documentation of pagic 1.0
There should be a detailed description then.

@yoshixmk
Copy link
Author

Thx, it works. I am looking forward to pagic 1.0!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants