Link component

Frontity Roadmap :biking_man:

Feature Card


<Link> is a component needed in all the themes. Even tho it’s not complex to create one tailored to the developer needs, we can provide a default one.

In my option, we need to make it super clear in the documentation that theme developers can create their own <Link> component with their own logic. We should provide examples of how to do so. The usage of this component should always be optional.

User Stories

As a theme developer
I want to import a default Link component
so that I don’t have to create it myself

Possible solution

Where should it live:

  • In the @frontity/components package, imported like this:
import Link from "@frontity/components/link";

const MyComp = () => {
  return <Link>...</Link>;
  • In the all the router packages, imported like this:
const MyComp = ({ libraries }) => {
  const Link = libraries.router.Link;
  return <Link>...</Link>;

I noticed that in @frontity/mars-theme the current behavior of the Link component prevents the user from opening links in a new tab when using a shortcut such as cmd + click. This should be contemplated. An easy solution, even if not exhaustive, is described in this post:

1 Like

Thanks @orballo.

Let’s add this user story for this:

As a final reader
I want to open links in new tabs when I cmd+click
so that I can use the site without hassle

1 Like

Another cool thing could be to add a warning if people forget to pass the link prop, like in this case: Link does not render href on the anchor tag

As a Frontity developer
I want to get a warning if my links won’t render a href
so that I can be sure that all my links work