简体   繁体   中英

How to make my gatsby link work properly in netlify?

I am trying to route between pages in gatsby. It works in local host but sadly not in netlify.
The route link is My-site.com/about/ It doesn't work in netlify but when I reload the page the route become My-site.com/About/ and the page content shows.

In my index.js

function Home = () => {
  return (
       <Link to="/about/"> About Page </Link>
  );
};
export default Home;

In About.js

function About = () => {
  return (
      <h2> This is About page </h2>
  );
};
export default About

Your About.js file should be named about.js (lowercased). This is because with Gatsby, components under src/pages become pages automatically with paths based on their filename.

You can check Pages and Layout documentation for further information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM