This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
forked from gjtorikian/jekyll-last-modified-at
-
Notifications
You must be signed in to change notification settings - Fork 0
Add option to set page.date
automatically with the file creation date
#1
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b4eb87d
Add option for setting page.date automatically
khemarato c550c1d
address some PR feedback
khemarato f6fa621
better README
khemarato c9f2864
Merge branch 'buddhist-uni/post-date'
numist eabd896
flip set-page-date default to true
numist 56eef6b
add test file so committed file test has something to work with
numist 0ace09a
add (failing): tests for date
numist b9cd318
ignore test-generated file
numist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<title>date-with-format</title> | ||
</head> | ||
<body> | ||
<span class="last-modified-at">Article created on {% page.date | date: "%Y:%B:%A:%d" %}</span> | ||
|
||
{{ content }} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: Testing Last Modified At | ||
layout: date_with_format | ||
--- | ||
|
||
Yay. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'Date Tag' do | ||
context 'A committed post file' do | ||
def setup(file, layout) | ||
@post = setup_post(file) | ||
do_render(@post, layout) | ||
end | ||
|
||
it 'has date' do | ||
setup('no-date.md', 'date_with_format.html') | ||
expect(@post.output).to match(/Article created on 09-Nov-22/) | ||
end | ||
end | ||
|
||
context 'An uncommitted post file' do | ||
before(:all) do | ||
cheater_file = 'no-date.md' | ||
uncommitted_file = 'date_no.md' | ||
duplicate_post(cheater_file, uncommitted_file) | ||
@post = setup_post(uncommitted_file) | ||
do_render(@post, 'date_with_format.html') | ||
end | ||
|
||
it 'has date' do | ||
expect(@post.output).to match(Regexp.new("Article created on #{Time.new.utc.strftime('%d-%b-%y')}")) | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently struggling with:
Removing
page.
fromspec/fixtures/_layouts/date_with_format.html
(so it's justdate
) doesn't change anything. I'm probably missing something obvious but it's tired and I'm late.