Giter VIP home page Giter VIP logo

Comments (3)

chrisnmorrison avatar chrisnmorrison commented on June 1, 2024

Hey David,

Hmm, this might take a bit of planning to implement. I have the slugs autogenerating in several places.

As a start, you would need to:

  1. Add the slug as markdown metadata. E.g. path: "5-linqpad-tricks"
  2. In gatsby-node.js, this is where the slugs are autogenerated. Check if a slug was provided, and if it was, use that. If not, use autogenerated one.

Then, you'd need to ensure that when the links to articles are placed in the blog lists, the correct link is used. This might need to be changed in several places. Starting in src/components/Posts/Post.js:

  1. Update GraphQL to include slug.
  2. Similar to point 2: Check if a slug was provided, and if it was, use that within links. If not, use autogenerated one.

I unfortunately am way too busy to try to fix this at the moment, but the least I can do is point you in the right direction!

from revista-gatsby-blog-magazine.

bellons91 avatar bellons91 commented on June 1, 2024

Thanks!
Would this approach make me lose the "/blog/" part?

from revista-gatsby-blog-magazine.

chrisnmorrison avatar chrisnmorrison commented on June 1, 2024

With the approach I described - depends.

Gatsby is very flexible in this regard so you can create the pages however you like.

My preference is to just include the slug, which allows you to also use the same Markdown metadata for multiple content types. E.g. if you want to also generate Portfolio links/pages based on Markdown files, you can re-use the slug: "..." for different purposes.

However I think you can leave it, if you already have blog/... in all of your files. Just ensure that the path in gatsby-node.js is correctly generating. As long as your links are generating consistently throughout the project, you can set up your urls however you choose.

from revista-gatsby-blog-magazine.

Related Issues (6)

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.