-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Explore adding top-level "API" link to header nav #171
Comments
You could just make the active style programmatic right? Just say any reference doc pages make the API header link active. Perhaps removing the accordion is an option too? |
We could but that's what this section from the description was referencing:
Short of moving the header out of the layout or hard-coding a bunch of URLs in it- how would you propose we do this? |
done! https://github.com/reactjs/reactjs.org/blob/master/content/docs/nav.yml :-) |
Reading between the lines, what you're suggesting seems a bit janky to me. It would require us to embed nav YML files in the layout component (rather than their template) and do pattern matching based on file names / slugs (which might cause conflicts between top-level docs folders) rather than the root of the URL. I guess we could combine both techniques (root of the URL + filename) but I still don't like the nav YMLs being used in the layout. |
Yeah, you'd import the docs yaml file into the layout component and there, check the current pathname against the list of paths in the yaml file. If the path is in the reference section, you highlight "API". |
Sure, I understand what you're proposing 😄 it just seems janky to me. |
Give it five minutes Brian! ;-) |
@bvaughn @KyleAMathews - what if a |
Hey @jxom! 😄 That's mostly what I was referring to in the last paragraph of the description, except that I would not want to combine navs in that case- to avoid introducing complexity (for people contributing code, for future changes we might make to the nav bar, etc.) Of the options that I've listed and/or that have been discussed so far, I do prefer a new, separate |
This discussion thread on Twitter provided feedback that the reference section of the docs may not be very discoverable due to the new website's accordion sidebar.
@gaearon proposed we could do something similar to what Jest does and add an "API" link to the header that directly opens the first page of the reference section (eg React Top-Level API).
Unfortunately this is a little more complicated than it would seem at a glance because of:
Unfortunately we can't rely on anything dynamic (like markdown frontmatter tags) to help with the "active" link styling because the header and footer are part of the "static" Gatsby layout. (Technically we could move them into the templates but this doesn't seem ideal.)
We could move reference docs into a new folder (eg "content/api") give them a unique URL prefix (eg "/api") but we'd need to leave backwards-compatible redirects (eg
redirect_from
like here) in place so that no bookmarked links were broken. This would also require separating "Docs" and "API" sidebar structure.The text was updated successfully, but these errors were encountered: