We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Creating my first Blog Collection...

Stephen September 18, 2020 by Stephen


First time using Statamic, I've created a Blog collection...

I used the scaffolding option, which created blank index and show files in views/blog. I've figured out the show file is what's used to show a post/item in a collection.

I've set up my route as blog/{slug} in the configure collection settings.

I've created a blog page (/blog), I'm using the views/blog/index template as my blog page template.

Question 1

How do I display the correct blog post, when I'm viewing blog/{slug}? I understand this is using the show template. I guess I have to put something in between these tags, like this:

{{ collection:blog }}
<h1>{{ title }}</h1>    
{{ /collection:blog }}

But that outputs all the titles in my collection. Is there a way to filter the list by the {slug}? How?

Question 2 Searching the forums I've seen snippets like this:

{{ collection:blog limit="3" }}

What is the limit="3" bit called? and is there a list somewhere of all the attributes/settings I can apply to a collection tag?


Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
4 Replies