Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
| ### `getEntryBySlug()` | ||
|
|
||
| `getEntry()` is function that returns a specific entry in a collection by entry ID (file path relative to the collection). Both of these are required parameters. | ||
| `getEntryBySlug()` is function that returns a specific entry in a collection by its slug (a slug that can be used in a URL). Both of these are required parameters. |
There was a problem hiding this comment.
| `getEntryBySlug()` is function that returns a specific entry in a collection by its slug (a slug that can be used in a URL). Both of these are required parameters. | |
| `getEntryBySlug()` is function that returns a specific entry in a collection by its slug (filename without the extension). Both of these are required parameters. |
Is this what it is? Is the slug exactly the file name (minus extension), or is it user-defined?
Saying "a slug" makes it sound like it could be up for grabs. If something defined in frontmatter, then maybe we could say something like:
(a value defined in the frontmatter)
Otherwise, the rest of the changes look good to me!
There was a problem hiding this comment.
Not exactly, if you have things like spaces those get converted to -. The slug is described more accurately in the section right after this. That's why I was being more vague here.
Could just omit the definition or link to the section below.
There was a problem hiding this comment.
Yes, I think linking to the term below is good. Why try to figure out how to say it twice? 😄
I guess the closest heading is #data-returned-from-a-collection-query
If you'd rather, what about something like:
its slug (URL-ready)
its URL-ready slug
Does that convey it well enough?
There was a problem hiding this comment.
Yeah, I think either of those work well enough.
There was a problem hiding this comment.
Went with its slug (URL-ready)
|
Closing in favor of @FredKSchott's PR which has more changes. |
What kind of changes does this PR include?
Description
getEntrytogetEntryBySlugto reduce the overlap between id and slug. The hope is that in the future we provide better utilities around types of collections; for example some collections are used to generate pages and should have a slug (or permalink) and some are not, in which case they should not have that.