khnhng
September 28, 2023, 2:57am
1
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.
RyanF
September 28, 2023, 3:24pm
2
Have you checked out the docs here?
Build dedicated URL structures using Ghost's dynamic routing system, for custom homepages, podcasts, categories and more.
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
khnhng
September 28, 2023, 4:06pm
3
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
RyanF
September 28, 2023, 5:58pm
4
You only need the collections
key as that sets up the URL and the collection
1 Like