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

current Version in Docusaurus still shows Next label even if specified otherwise #8184

Closed
4 of 7 tasks
YazzyYaz opened this issue Oct 7, 2022 · 3 comments
Closed
4 of 7 tasks
Labels
closed: question This issue is a user error/misunderstanding.

Comments

@YazzyYaz
Copy link

YazzyYaz commented Oct 7, 2022

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Inside my docusaurus.config.js:

presets: [
    [
      'classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          lastVersion: 'mamaki',
          editCurrentVersion: true,
          versions: {
            current: {
              label: 'Testnet',
              path: 'testnet',
            },
          },
*
*
*
]

It still shows Next instead of Testnet. Not sure if I have to configure something else somewhere for current.

Reproducible demo

No response

Steps to reproduce

  1. Generate a docusaurus project with versioning added.
  2. Add a new version
  3. Rename current's label to Testnet or something else.
  4. Generating it still shows Next

Expected behavior

current should update it's label based on what's passed in label

Actual behavior

current version doesn't update it's label. Path seems to update fine though.

Your environment

  • Public source code: https://github.com/celestiaorg/docs
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@YazzyYaz YazzyYaz added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Oct 7, 2022
@slorber
Copy link
Collaborator

slorber commented Oct 7, 2022

https://github.com/celestiaorg/docs

=> I don't see a versioned site here nor your modified config I could inspect, nor the live result showing me the problem and you didn't either include screenshots showing where the wrong label is displayed. This is really hard for me to double-check your setup and try to help you 😅

Have you tried creating a smaller repro with Docusaurus.new to be sure it's not something else causing the problem?

Note, I see you use i18n, make sure you don't have the "Next" label in the /en folder. This may be surprising but the /en folder content is used in the priority over the docusaurus.config.js labels. Somehow your en site config labels could be overridden by the i18n/en labels 🤪

This is likely the issue:
https://github.com/celestiaorg/docs/blob/main/i18n/en/docusaurus-plugin-content-docs/current.json#L3

Not sure what to do to prevent this kind of error 😅 I can understand this is confusing.

At the same time we have to consider that devs may set a default hardcoded text somewhere in English, and yet translators will provide a better text in English to override it through Crowdin or any external system, so it still makes sense to have i18n/en to override default hardcoded labels (often created by devs, not always good copywriters)

When in doubt delete your local i18n/en: if you use Crowdin it should mostly be created only in the i18n upload/download dance on the CI, and you don't need this folder locally (unless you test things locally, temporarily)

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Oct 7, 2022
@YazzyYaz
Copy link
Author

YazzyYaz commented Oct 7, 2022

@slorber thank you so much for the support. It worked when I edited current.json and I will scope out CI automation for i18n directory.

Wanted to check, after I got it working, the navbars stay on latest path. For example, say I switch versioning from latest to current, which updates fine; When I click on another item on the navbar, it redirects back to latest rather than stay in current. Not sure if there's something I need to enable so that when a version is selected in the navbar dropdown, other items in the navbar will update their path to the version selected. For example, it works really well in the Docusaurus website on Docs and API navbar items. I checked the code on Docusaurus and nothing immediately comes up as to why this behavior works there and not in my site. Is there a missing thing I need to enable?

@slorber
Copy link
Collaborator

slorber commented Oct 7, 2022

Hey @YazzyYaz, great that this is solved. I guess we can close then.

We have different navbar item types.
There's a type to link to a doc, and it will automatically use the link of the doc in the currently selected version (assuming the docId exists in all versions)

{
  type: "doc",
  docId: "concepts/how-celestia-works/introduction",
  label: "Concepts"
};

You can also try to implement your own custom navbar item if that doesn't work for your use-case (see #7227). We'll likely provide more useful navbar items in the future.

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2022
@Josh-Cena Josh-Cena added closed: question This issue is a user error/misunderstanding. and removed bug An error in the Docusaurus core causing instability or issues with its execution labels Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question This issue is a user error/misunderstanding.
Projects
None yet
Development

No branches or pull requests

3 participants