ChrisPenner / slick

Static site generator built on Shake configured in Haskell
BSD 3-Clause "New" or "Revised" License
204 stars 24 forks source link

How do tags work? #1

Closed JonathanReeve closed 5 years ago

JonathanReeve commented 5 years ago

I notice that some of the posts in the example site have tags, but I don't see the tags implemented anywhere in the site output. How would one go about making a page that listed all tags, and their associated posts?

steshaw commented 5 years ago

@JonathanReeve I've only taken a quick peek but it looks like @ChrisPenner implemented tags on chrispenner.ca. Therefore, I'd imagine you might find the answer in https://github.com/ChrisPenner/ChrisPenner.github.io/blob/slick/app/Main.hs.

ChrisPenner commented 5 years ago

Yes @JonathanReeve, @steshaw is correct; there's nothing provided inside Slick for managing tags, it's quite tricky to do generically due to the way Shake caches things. Feel free to copy my approach though; as @steshaw said you can find it in getTags and buildTag here: https://github.com/ChrisPenner/ChrisPenner.github.io/blob/slick/app/Main.hs

You may also want to take a look at my other project SitePipe; it does have rudimentary tag builder support built in, but unfortunately does not support caching between builds. You can see an example of SitePipe with tags here: https://github.com/ChrisPenner/SitePipe/blob/master/examples/blog/app/Main.hs