What is the difference between routes and collections?

Hi,

Could you please let me know the difference between routes and collection?
I think they seem to do the same thing: Define the URL, what will appear at that URL and under which template. So what is the difference between them and how to choose one?

Thank you in advance.

Have you checked out the docs here?

The TL;DR is that

  • routes define URLs for specific templates (among other things)
  • collections define how your content is organized and accessed via URLs
1 Like

Thank Ryan, I checked the docs but it is not quite clear to me.
Is it wrong if I have a configuration like this:

routes:
  /blog/: blog
    
collections:
  /blog/:
    permalink: /blog/{slug}/
    template: blog

You only need the collections key as that sets up the URL and the collection

1 Like