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

Handling external links #24

Open
jgaehring opened this issue Dec 18, 2021 · 1 comment
Open

Handling external links #24

jgaehring opened this issue Dec 18, 2021 · 1 comment

Comments

@jgaehring
Copy link
Member

So I've been thinking about this since @paul121 opened up #21 and #22, particularly as I've shifted my thinking that links to the source repositories (not for editing docs, just for viewing source) probably fit best in the left navigation drawer. We could then add the "open-in-new" icon to those menu items, plus any other external links in the menu, like for the forum, chat and the Jitsi link. And while we're at it, it would be pretty easy to also set target="_blank" to open it in a new window as well. The easiest way to do this is probably to check if the href starts with 'http' or not. If we're doing that, we could also run other tests, like if it starts with 'https://github.com/' or 'http://twitter.com' and add a little GitHub or Twitter icon inline as well.

All this makes me think this logic should be written into the NestedNav component itself, or as a special ExternalLink component that could be used in NestedNav and elsewhere, since this seems more and more like a concern for the rendering layer.

Similarly, we could add some logic to gatsby-remark-prefix-relative-links to add a special class to external links, so we could append an ::after pseudo-element to those links with the same "open-in-new" icon, similar to how Wikipedia does with inline external links.

@jgaehring
Copy link
Member Author

A closely related issue to this (perhaps its own issue?) is cross-linking between different source repos, such as the link to "farmOS Data Model" on the farmOS.js Entities page. If you click that link currently, it forces a full page load, since it's not a relative link.

The simplest fix would be to check all those absolute URL's for any that start with 'https://farmos.org' and just strip the origin off if it does, but perhaps there's a more elegant solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant