Added permalink time variables

This commit is contained in:
Pedro Euko 2015-09-23 13:38:11 -03:00
parent 8563f59125
commit 22b59ae793
3 changed files with 46 additions and 0 deletions

View File

@ -64,6 +64,19 @@ Feature: Fancy permalinks
Then the _site directory should exist Then the _site directory should exist
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html" And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
Scenario: Use custom permalink schema with date and time
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 22:31:07 | Totally custom. |
And I have a configuration file with:
| key | value |
| permalink | "/:year:month:day:hour:minute:second.html" |
| timezone | UTC |
When I run jekyll build
Then the _site directory should exist
And I should see "Totally custom." in "_site/20090327223107.html"
Scenario: Use per-post permalink Scenario: Use per-post permalink
Given I have a _posts directory Given I have a _posts directory
And I have the following post: And I have the following post:

View File

@ -227,6 +227,9 @@ module Jekyll
:year => date.strftime("%Y"), :year => date.strftime("%Y"),
:month => date.strftime("%m"), :month => date.strftime("%m"),
:day => date.strftime("%d"), :day => date.strftime("%d"),
:hour => date.strftime("%H"),
:minute => date.strftime("%M"),
:second => date.strftime("%S"),
:title => slug, :title => slug,
:i_day => date.strftime("%-d"), :i_day => date.strftime("%-d"),
:i_month => date.strftime("%-m"), :i_month => date.strftime("%-m"),

View File

@ -73,6 +73,36 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
<p>Year from the Posts filename without the century.</p> <p>Year from the Posts filename without the century.</p>
</td> </td>
</tr> </tr>
<tr>
<td>
<p><code>hour</code></p>
</td>
<td>
<p>
Hour of the day, 24-hour clock, zero-padded from the Posts filename. (00..23)
</p>
</td>
</tr>
<tr>
<td>
<p><code>minute</code></p>
</td>
<td>
<p>
Minute of the hour from the Posts filename. (00..59)
</p>
</td>
</tr>
<tr>
<td>
<p><code>second</code></p>
</td>
<td>
<p>
Second of the minute from the Posts filename. (00..60)
</p>
</td>
</tr>
<tr> <tr>
<td> <td>
<p><code>title</code></p> <p><code>title</code></p>