jekyllstatic-sitenanoc

How to use a static site generator for a Getting Started guide


I want to write some getting started guides for areas of my site in markdown and split them over multiple pages.

My file structure is like so:

/doing-x
  1-blah-blah.md
  2-blah-blah.md
  3-blah-blah.md
/doing-y
  ...

I managed to get mostly what I needed done in nanoc, but I'd like to have next and previous buttons on each page of each section.

I tried the paginator gem but it's for paging an index of blogs.


Solution

  • In the docs, it says page.previous and page.next are just for posts, but I believe they work for collection items too. http://jekyllrb.com/docs/variables/#page-variables

    So it would look like:

    {% if page.previous %}
      <a href="{{ page.previous.url }}">
        {{ page.previous.title }}
      </a>
    {% endif %}
    

    and same thing for next.