Coder Social home page Coder Social logo

Comments (4)

ndimatteo avatar ndimatteo commented on May 11, 2024

Hey there @DivMode you're only changing the path for links in your example code, which is not where product page routes live. This is why you are seeing a 404 error page when clicking those links, the routes simply do not exist there for products.

I'd highly recommend reading up on how dynamic routes work within Next.js

In HULL, the product routes are determined by the folder structure: /pages/products/[slug].js, while general page routes are determined by /pages/[...slug].js.

It's much easier to separate out product specific routes to their own sub-path than it is to coalesce them with the regular page routes.

I hope that helps 🤘

from hull.

DivMode avatar DivMode commented on May 11, 2024

Ok from what I understand it currently isnt possible to move the products slug to root because of […slug].

Otherwise I could just move the products slug to root and it would work.

Thanks for the help, love this repo, learning a lot just from reading the code.

from hull.

ndimatteo avatar ndimatteo commented on May 11, 2024

Exactly. You could in theory do this, but it would require a lot more work to avoid slug collisions between regular pages and product pages, and you'd have to do additional checks to know what to render.

It's fairly standard to have products exist at a sub-path like /products (even with Shopify native) so I'd suggest sticking with the default.

Glad you're enjoying the repo! cheers 🤘

from hull.

DivMode avatar DivMode commented on May 11, 2024

Actually your amazing repo has inspired me to build out a full blogging system and to start using nextjs/sanity and move away from Wordpress.

I was getting tired of Wordpress shenanigans and took some courses on react to help me get going with Nextjs and Sanity and then I came across this repo which helped me so much.

Love the whole collections and filters system which I am going to use to convert into a full blogging system with categories and tags.

I have a lot of work and learning ahead of me but am very excited for the future.

As for the reason why I wanted to the slug closer to root domain is because for SEO it is better to have the targeted keywords closer to the root domain as much as possible.

Its a small seo factor and isnt such a huge deal so Ill just stick with blog/[slug].

from hull.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.