Adding the categories back into the post payload
This commit is contained in:
parent
aff6c9c23a
commit
829530be36
|
@ -20,7 +20,7 @@ Feature: Embed filters
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
|
||||
And I have a default layout that contains "{{ page.title | xml_escape }}"
|
||||
And I have a default layout that contains "{{ site.posts.first.title | xml_escape }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html"
|
||||
|
@ -31,7 +31,7 @@ Feature: Embed filters
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
|
||||
And I have a default layout that contains "{{ content | xml_escape }}"
|
||||
And I have a default layout that contains "{{ site.posts.first.content | xml_escape }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "7" in "_site/2009/03/27/star-wars.html"
|
||||
|
@ -42,7 +42,7 @@ Feature: Embed filters
|
|||
And I have the following post:
|
||||
| title | date | layout | tags | content |
|
||||
| Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
|
||||
And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
|
||||
And I have a default layout that contains "{{ site.posts.first.tags | array_to_sentence_string }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
|
||||
|
|
|
@ -9,7 +9,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post title: {{ post.title }}"
|
||||
And I have a simple layout that contains "Post title: {{ site.posts.first.title }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html"
|
||||
|
@ -20,7 +20,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post url: {{ post.url }}"
|
||||
And I have a simple layout that contains "Post url: {{ site.posts.first.url }}"
|
||||
When I run jekyll
|
||||
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"
|
||||
|
@ -31,10 +31,10 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post date: {{ post.date }}"
|
||||
And I have a simple layout that contains "Post date: {{ site.posts.first.date }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post url: 2009-03-27" in "_site/2009/03/27/star-wars.html"
|
||||
And I should see "Post date: Fri Mar 27" in "_site/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.id variable
|
||||
Given I have a _posts directory
|
||||
|
@ -42,7 +42,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post id: {{ post.id }}"
|
||||
And I have a simple layout that contains "Post id: {{ site.posts.first.id }}"
|
||||
When I run jekyll
|
||||
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"
|
||||
|
@ -53,10 +53,10 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post content: {{ post.content }}"
|
||||
And I have a simple layout that contains "Post content: {{ site.posts.first.content }}"
|
||||
When I run jekyll
|
||||
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"
|
||||
And I should see "Post content: <p>Luke, I am your father.</p>" 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
|
||||
|
@ -65,7 +65,7 @@ Feature: Post data
|
|||
And I have the following post in "movies":
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ post.categories }}"
|
||||
And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||
|
@ -78,7 +78,7 @@ Feature: Post data
|
|||
And I have the following post in "movies/scifi":
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post categories: {{ post.categories }}"
|
||||
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post categories: movies scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
||||
|
@ -89,7 +89,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | category | content |
|
||||
| Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ post.categories }}"
|
||||
And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post categories: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||
|
@ -100,7 +100,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | categories | content |
|
||||
| Star Wars | 3/27/2009 | simple | movies, scifi | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post categories: {{ post.categories }}"
|
||||
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post categories: movies scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
||||
|
@ -112,7 +112,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post topics: {{ post.topics }}"
|
||||
And I have a simple layout that contains "Post topics: {{ site.posts.first.topics }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post topics: movies scifi" in "_site/2009/03/27/star-wars.html"
|
||||
|
@ -131,7 +131,7 @@ Feature: Post data
|
|||
And I have the following post:
|
||||
| title | date | layout | author | content |
|
||||
| Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post author: {{ post.author }}"
|
||||
And I have a simple layout that contains "Post author: {{ site.posts.first.author }}"
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
|
||||
|
|
|
@ -43,7 +43,7 @@ Given /^I have the following posts?(?: in "(.*)")?:$/ do |dir, table|
|
|||
table.hashes.each do |post|
|
||||
date = Date.parse(post['date']).strftime('%Y-%m-%d')
|
||||
title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
|
||||
path = File.join("_posts", "#{date}-#{title}.#{post['type'] || 'textile'}")
|
||||
path = File.join(dir || '', '_posts', "#{date}-#{title}.#{post['type'] || 'textile'}")
|
||||
|
||||
matter_hash = {}
|
||||
%w(title layout tags).each do |key|
|
||||
|
|
|
@ -193,6 +193,7 @@ module Jekyll
|
|||
"date" => self.date,
|
||||
"id" => self.id,
|
||||
"topics" => self.topics,
|
||||
"categories" => self.categories,
|
||||
"content" => self.content }.deep_merge(self.data)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue