-
Notifications
You must be signed in to change notification settings - Fork 394
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
Add external doc sidebar links and replace "Changelog" with one. #1273
Conversation
Keep in mind that this is meant as a quick fix, and the current sidebar system is likely to be overhauled in the future in a way that will have the functionality, but not necessarily invoked with the same "type" syntax. This branch allows the sidebar to have external links, and changes the "Changelog" link at the end to be a link to the DVC GitHub. Both the sidebar utils and component had to be changed to enable this- the sidebar utils moreso as the "external" type bypasses previous logic entirely. Anything without "external" set on it is treated the same, however. The component change just treats external-typed entries a little differently by setting `target=_blank` and preventing the `href` from having anything prepended to it. The best solution is to move this out of the component level entirely, but the best solution isn't the quickest and I've already mentioned big sidebar changes are coming soon.
My mistake, I thought `null` was the proper syntax here and I guess the linter missed it.
I'm sure we're going to want the "Changelog" entry in right now to be labeled and/or pointing to another link. I just have what's there as an example right now. |
This is easier to read for most people, and also works better with linters.
I just grabbed an SVG we already had. It could use some work, but this is a simple working implementation so it's worth pushing.
Some parts of the application still use the sidebar.json helpers to determine their links, and when attempting to do so on external-type links broke the build. This change fixes that situation, letting the `findChildWithSource` function adapt to input that isn't internal. It's a bit ugly, but this whole branch is a bit ugly. The sidebar overhaul should take care of this more cleanly in the future.
I'm sorry, they look like they took some effort to write! But that's also the reason we have to stop writing these and get rid of the old ones.
I had to wrestle with the sidebar logic some more, but I think it's ready to go unless we want to change how it looks. This PR now has:
|
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.
Can the community page link open in a new window like the links in the User Content section? Thanks
https://dvc-landing-sidebar-ext-pezxhp.herokuapp.com/community
I made a new SVG based off the other one. It uses "currentColor" so it will take on the color of its surrounding font by default, and also is fully transparent. This new SVG is only used in the sidebar- other external link icons are still the old hard-coded blue and white one.
This is done the same way as we already do `rel="noopener noreferrer"`. The change applies site-wide, but only to external links that don't specify a target. `target` can still be overridden with anything, including a blank string.
Done! I actually added functionality to our Link component that makes external links default to |
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.
just one minor request - move the asset close to the component
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.
🚀 LGTM
Fixes #1272
Keep in mind that this is meant as a quick fix, and the current sidebar system
is likely to be overhauled in the future in a way that will have this
functionality, but not necessarily invoked with the same "type" syntax.
This branch allows the sidebar to have external links, and changes the
"Changelog" link at the end to be a link to the DVC GitHub.
Both the sidebar utils and component had to be changed to enable this- the
sidebar utils moreso as the "external" type bypasses previous logic entirely.
Anything without "external" set on it is treated the same, however.
The component change just treats external-typed entries a little differently by
setting
target=_blank
and preventing thehref
from having anything prependedto it. The best solution is to move this out of the component level entirely,
but the best solution isn't the quickest and I've already mentioned big sidebar
changes are coming soon.