Skip to content
Phillip Haydon edited this page Aug 11, 2013 · 6 revisions

Snow supports the idea of a series, a collection of post. This works by defining a series in the header of the markdown file.

---
series:
    name: 098765
    current: 3
    part: All about Snow Part 1
    part: All about Snow Part 2
    part: All about Snow Part 3
---

Great, how do I render my series!

Series can be rendered using the HtmlHelper Extension Method:

@Html.RenderSeries()

If you want to render the series on the index/snippet pages also, you can call the same method passing in the current post you're iterating over:

@foreach(var postPaged in Model.PostsPaged) {
   ...
   @Html.RenderSeries(postPaged)
   ...
}

name

This is the name of the series, used to identify and group many posts into a series. If you have a 3 part series, this is used to identify all 3 parts and group them together.

This could be a number, a string. So long as its unique per series.

current

Using the example above, current identifies current post in the series. The value should be the index value, with the index starting at 1. (This is NOT a 0 based index)

e.g

---
series:
    name: 098765
    current: 3
    part: All about Snow Part 1
    part: All about Snow Part 2
    part: All about Snow Part 3
---

This example shows the current post is Part 3 of 3, by specifying the index as 3.

e.g 2

---
series:
    name: 098765
    current: 1
    part: All about Snow Part 1
    part: All about Snow Part 2
    part: All about Snow Part 3
---

This example is part 1 of the 3 post series, by specifying the index 1.

part

A part is the name of a post in the series. This collection is ordered in the order you write them in, and only the latest collection of parts is meaningful (see <#what-happens-if-i-added-more-parts>).

The part name is the name that will be shown on your website.

Generated output

The generated output ends up as an HTML Unordered List <ul>

e.g

<ul class="snow-series">
    <li><a href="/2013/06/setting-up-ubuntu-and-nginx-on-azure/">Part 1 - Setting up the Virtual Machine and nginx</a></li>
    <li><a href="/2013/06/setting-up-a-new-website-and-domain-on-nginx/">Part 2 - Setting up new Website and Domain on nginx</a></li>
    <li><a href="/2013/06/setting-up-mono-on-nginx/">Part 3 - Setting up Mono on nginx</a></li><li>Part 4 - Setting up a NancyFX website</li>
    <li><a href="/2013/07/setting-up-a-servicestack-service/">Part 5 - Setting up a ServiceStack web service</a></li>
</ul>

(real example taken from http://www.philliphaydon.com/2013/07/setting-up-a-nancyfx-website/

If you are on the current post, the post will not be shown as a link.

If a post does not exist yet, it will not be shown as a link.

What happens if I added more parts?

You can add more parts to a series, in future posts, by adding them to the list, only the latest series>parts counts.

This means if you have your very first post with the parts:

part: All about Snow Part 1
part: All about Snow Part 2
part: All about Snow Part 3

Then when you get to part 3 you're like:

Hey, I want to add 2 more parts to my series!

You can update the data like so:

part: All about Snow Part 1
part: All about Snow Part 2
part: All about Snow Part 3
part: All about Snow Part 4
part: All about Snow Part 5

This updated change ONLY needs to be applied in the new post, and will be applied to all existing posts. No need to go update anything!!!