-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Adding dynamic navigation based on site.json
#409
Conversation
@sup I've updated the PR - added a short description as you suggested. I also made a couple of formatting changes in the navigation helper that were failing on travis but not picked up pre-commit. |
can we get a screenshot :) |
Hey @mikeal, this doesn't change the appearance at all. It only changes way the navigation is managed. Instead of having to maintain different menu templates for different sidebar menus, they share a generic template and the menus are defined in each locale's The benefit will be more noticeable for additional translations of the site as they won't require the menu structure to be identical to the english version. (I'm not sure if this behaviour is desirable or not?) |
ahhhh, ok :) 👍 |
The merge conflict above is a result of deleting |
I have resolved the merge conflict. As far as my testing goes, I think that I've been able to replicate the current navigation. I have added additional logic in the template to support the API doc's "LTS" label and the text is an optional Let me know if there are any additional considerations I have missed. |
@nodejs/website Can you please take a look and test it? This would be a huge improvement. |
"api": { | ||
"text": "API" | ||
"api-lts": { | ||
"link": "dist/latest-v4.x/docs/api", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ok?
I think that dist/latest-v4.x/docs/api
becomes /en/dist/latest-v4.x/docs/api/
after generation.
However true url is https://nodejs.org/dist/latest-v4.x/docs/api/
.
dist/latest-v5.x/docs/api
is also the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh hmm, no that isn't ok. The docs are not translated to begin with. (due to various other issues)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @abouthiroppy. I accidentally introduced this while trying to figure out how to handle the "LTS" label on the version 4 docs. I'll push a patch shortly.
Seems to work fine. LGTM |
I've update the PR with the following changes:
Please let me know if you spot anything else out of the ordinary. |
LGTM 👍 |
Merged, thank you all! |
Implements a solution for the menus, partially as described in #281.
Changes to
site.json
are to replicate the current state of the various sidebar menusMenu Links
link
and atext
propertylink
can be an internal path relative to the local. e.gdocs/faq
link
can be relative to the root. e.g/api/
link
can be an external url. e.ghttps://github.com/nodejs/nodejs.org
Main menu
site.json
.trademark
from the object to prevent it showing up in the main nameSub menus
{{> navigation key='about'}}
Navigation Helper
The navigation helper adds the menus to the metadata under the property
nav