Skip to content

Sidebar Experience Different between Dev Mode and Build Mode #2670

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

Open
1 task done
isaacrlevin opened this issue Oct 17, 2020 · 1 comment
Open
1 task done

Sidebar Experience Different between Dev Mode and Build Mode #2670

isaacrlevin opened this issue Oct 17, 2020 · 1 comment
Labels
need feedback Awaiting author response

Comments

@isaacrlevin
Copy link

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

  • Create new vuepress site
  • add few pages in guide with tags
  • eject theme
  • modify resolveSidebarItems in theme/utils/index to walk pages and grab tags and group
 let tags = []
  for (let page of sortedPages) {
    for (let index in page.frontmatter.tags) {
      const tag = page.frontmatter.tags[index]
      var result = tags.find(t => {
        return t.title.toLowerCase().trim() === tag.toLowerCase().trim()
      });
      if (result == undefined)
      {
        let finalTag = {};
        finalTag.title = tag.toLowerCase().trim();
        finalTag.collapsable = true;
        finalTag.children = [];
        finalTag.children.push(page.regularPath.replace(".html",""));
        tags.push(finalTag);
      }
      else
      {
        if (result.children != undefined)
        {
          result.children.push(page.regularPath.replace(".html",""));
        }
      }
    }
  }

and concat group to config output

    let newconfig = config.concat(tags);

    return newconfig
      ? newconfig.map(item => resolveItem(item, pages, base))
      : []

vuepress dev to test than vuepress build

What is expected?

output of vuepress build should have sidebar groups collapsible (this will work fine in dev mode)

yep

What is actually happening?

Built site groups cannot be toggled, they stay collapsed. This is something that works find in dev mode, but built is not the same expereince

Other relevant information

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
  Binaries:
    Node: 12.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 86.0.4240.75
    Edge: Spartan (44.19041.423.0), Chromium (86.0.622.43), ChromiumDev (87.0.664.8)
  npmPackages:
    @vuepress/core:  1.6.0
    @vuepress/theme-default:  1.6.0
    vuepress: ^1.6.0 => 1.6.0
  npmGlobalPackages:
    vuepress: Not Found
@d-pollard
Copy link
Collaborator

Hmmm, do you have an example we can look at?

It doesn't look like this is a documented feature we offer out of the box, so I'm thinking this issue might be related to some customization made by extending the theme

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

No branches or pull requests

2 participants