Feature: Post data As a hacker who likes to blog I want to be able to embed data into my posts In order to make the posts slightly dynamic Scenario: Use post.title variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post title: {{ page.title }}" When I run jekyll build Then the _site directory should exist And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html" Scenario: Use post.url variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post url: {{ page.url }}" When I run jekyll build Then the _site directory should exist And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html" Scenario: Use post.date variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}" When I run jekyll build Then the _site directory should exist And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html" Scenario: Use post.id variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post id: {{ page.id }}" When I run jekyll build Then the _site directory should exist And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html" Scenario: Use post.content variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post content: {{ content }}" When I run jekyll build Then the _site directory should exist And I should see "Post content:
Luke, I am your father.
" in "_site/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder Given I have a movies directory And I have a movies/_posts directory And I have a _layouts directory And I have the following post in "movies": | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and has category in YAML Given I have a movies directory And I have a movies/_posts directory And I have a _layouts directory And I have the following post in "movies": | title | date | layout | category | content | | Star Wars | 2009-03-27 | simple | film | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and has categories in YAML Given I have a movies directory And I have a movies/_posts directory And I have a _layouts directory And I have the following post in "movies": | title | date | layout | categories | content | | Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML Given I have a movies directory And I have a movies/_posts directory And I have a _layouts directory And I have the following post in "movies": | title | date | layout | category | content | | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.tags variable Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | tag | content | | Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. | And I have a simple layout that contains "Post tags: {{ page.tags }}" When I run jekyll build Then the _site directory should exist And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" Scenario: Use post.categories variable when categories are in folders Given I have a scifi directory And I have a scifi/movies directory And I have a scifi/movies/_posts directory And I have a _layouts directory And I have the following post in "scifi/movies": | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build Then the _site directory should exist And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in folders with mixed case Given I have a scifi directory And I have a scifi/Movies directory And I have a scifi/Movies/_posts directory And I have a _layouts directory And I have the following post in "scifi/Movies": | title | date | layout | content | | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build Then the _site directory should exist And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in YAML Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | category | content | | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in YAML and is mixed-case Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | category | content | | Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: Movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | categories | content | | Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build Then the _site directory should exist And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML and are duplicated Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | categories | content | | Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML with mixed case Given I have a _posts directory And I have a _layouts directory And I have the following posts: | title | date | layout | categories | content | | Star Wars | 2009-03-27 | simple | ['scifi', 'Movies'] | Luke, I am your father. | | Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build Then the _site directory should exist And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: SciFi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html" Scenario Outline: Use page.path variable Given I have a