Skip to content

gatsby-link should work as a regular anchor for off-site URLs #4662

@tremby

Description

@tremby

Description

It would make things simpler if I didn't have to care whether a given URL is somewhere on my website or whether it's an external link, and I could pass them to gatsby-link either way.

Steps to reproduce

Add some links with gatsby-link to a page, one with its to parameter pointing to a site-local destination, another pointing somewhere external.

Expected result

Both should function as expected: the internal one should do a react-router-driven page change, the external one should function as a regular link.

Actual result

Gatsby (or maybe the upstream react-router link?) assumes that by http://example.com I mean some page on the current website called /http://example.com, which I clearly do not, and so I get a broken link.

Environment

  • Gatsby version (npm list gatsby): [email protected]
  • gatsby-cli version (gatsby --version): 1.1.41
  • Node.js version: v8.9.4
  • Operating System: Linux spiral 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

File contents (if changed):

gatsby-config.js: nothing special
package.json: nothing special
gatsby-node.js: nothing special
gatsby-browser.js: not changed
gatsby-ssr.js: not changed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions