$ npm install gatsby-plugin-catch-links
This plugin intercepts all local links that have not been created in React using gatsby-link
, and replaces their behavior with that of the gatsby-link
navigate
. This avoids the browser having to refresh the whole page when navigating between local pages, preserving the Single Page Application (SPA) feel.
Example use cases:
a
tags by
gatsby-transformer-remark
)a
tag that has been created by a Content Management System (CMS) WYSIWYG editornpm install gatsby-plugin-catch-links
// In your gatsby-config.js
plugins: [`gatsby-plugin-catch-links`]
excludePattern
[Regular Expression][optional]
Regular expression for paths to be excluded from being handled by this plugin.
{
resolve: `gatsby-plugin-catch-links`,
options: {
excludePattern: /(excluded-link|external)/,
},
},
© 2010 - cnpmjs.org x YWFE | Home | YWFE