Skip to content

Commit

Permalink
fix: Default all links to remote until Jekyll is gone
Browse files Browse the repository at this point in the history
Otherwise Gatsby will attempt to load links even when they're not valid Gatsby pages.
  • Loading branch information
dcramer committed Jul 21, 2020
1 parent bf00067 commit 77d8187
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gatsby/src/components/smartLink.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { Link } from 'gatsby';
import React from "react";
import { Link } from "gatsby";

import ExternalLink from './externalLink';
import ExternalLink from "./externalLink";

// TODO(dcramer): when Gatsby conversion is done, remove remote default
export default ({ to, href, children, remote, ...props }) => {
const realTo = to || href || '';
if (realTo.indexOf('://') !== -1) {
export default ({ to, href, children, remote = true, ...props }) => {
const realTo = to || href || "";
if (realTo.indexOf("://") !== -1) {
return (
<ExternalLink href={realTo} {...props}>
{children}
</ExternalLink>
);
} else if (realTo.indexOf('/') !== 0 || remote) {
} else if (realTo.indexOf("/") !== 0 || remote) {
// this handles cases like anchor tags (where Link messes thats up)
return (
<a href={realTo} {...props}>
Expand Down

0 comments on commit 77d8187

Please sign in to comment.