diff --git a/CONTRIBUTING.markdown b/.github/CONTRIBUTING.markdown similarity index 100% rename from CONTRIBUTING.markdown rename to .github/CONTRIBUTING.markdown diff --git a/.travis.yml b/.travis.yml index 5c6e5855..842bfa90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ rvm: - &ruby1 2.3.0 - &ruby2 2.2.4 - &ruby3 2.1.8 - - &ruby4 2.0.0-p648 - &jruby jruby-9.0.4.0 - &rhead ruby-head diff --git a/Gemfile b/Gemfile index 5666fae4..5aad2c4d 100644 --- a/Gemfile +++ b/Gemfile @@ -55,7 +55,7 @@ end group :jekyll_optional_dependencies do gem "toml", "~> 0.1.0" gem "coderay", "~> 1.1.0" - gem "jekyll-docs", path: '../docs' if Dir.exist?('../docs') + gem "jekyll-docs", :path => '../docs' if Dir.exist?('../docs') && ENV['JEKYLL_VERSION'] gem "jekyll-gist", "~> 1.0" gem "jekyll-feed", "~> 0.1.3" gem "jekyll-coffeescript", "~> 1.0" @@ -80,6 +80,7 @@ group :site do if ENV["PROOF"] gem "html-proofer", "~> 2.0" end + gem "jemoji" gem "jekyll-sitemap" gem "jekyll-seo-tag", "~> 1.1" diff --git a/History.markdown b/History.markdown index e40f097e..7902e446 100644 --- a/History.markdown +++ b/History.markdown @@ -2,14 +2,32 @@ ## HEAD +### Minor Enhancements + + * Stop testing with Ruby 2.0.x, which is EOL'd. (#4381) + * Allow collections to have documents that have no file extension (#4545) + * Add size property to group_by result (#4557) + +### Bug Fixes + + * Site template: Escape title and description where it is used in HTML (#4606) + * Document#date: drafts which have no date should use source file mtime (#4611) + * Filters#time: clone an input Time so as to be non-destructive (#4590) + * Doctor: fix issue where `--config` wasn't a recognized flag (#4598) + * Ensures related_posts are only set for a post (#4620) + ### Development Fixes * Add project maintainer profile links (#4591) + * Fix state leakage in Kramdown test (#4618) ### Site Enhancements * Add jekyll-seo-tag, jekyll-avatar, and jekyll-sitemap to the site (#4553) * Add Google search query to /docs/help/ (#4589) + * Upgrading, documentation (#4597) + * Add 'view source' entry (#4602) + * Add jekyll-video-embed to list of third-party plugins. (#4621) ## 3.1.2 / 2016-02-19 diff --git a/features/collections.feature b/features/collections.feature index ad17a896..ac67611e 100644 --- a/features/collections.feature +++ b/features/collections.feature @@ -10,7 +10,6 @@ Feature: Collections When I run jekyll build Then I should get a zero exit status And the _site directory should exist - And I should see "Collections:
Use Jekyll.configuration
to build a full configuration for use w/Jekyll.
Whatever: foo.bar
\nSigns are nice
\nJekyll.sanitized_path
is used to make sure your path is in your source.
Run your generators! default
\nPage without title.
\nRun your generators! default
" in "_site/index.html" And the "_site/methods/configuration.html" file should not exist Scenario: Rendered collection @@ -77,8 +76,8 @@ Feature: Collections """ When I run jekyll build Then I should get a zero exit status - And the _site directory should exist - And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" + Then the _site directory should exist + And I should see "Collections: _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: Collections specified as an hash Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}" @@ -90,8 +89,8 @@ Feature: Collections """ When I run jekyll build Then I should get a zero exit status - And the _site directory should exist - And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" + Then the _site directory should exist + And I should see "Collections: _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: All the documents Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}" @@ -103,11 +102,11 @@ Feature: Collections """ When I run jekyll build Then I should get a zero exit status - And the _site directory should exist - And I should see "All documents: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" + Then the _site directory should exist + And I should see "All documents: _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: Documents have an output attribute, which is the converted HTML - Given I have an "index.html" page that contains "First document's output: {{ site.documents.first.output }}" + Given I have an "index.html" page that contains "Second document's output: {{ site.documents[1].output }}" And I have fixture collections And I have a "_config.yml" file with content: """ @@ -116,8 +115,8 @@ Feature: Collections """ When I run jekyll build Then I should get a zero exit status - And the _site directory should exist - And I should see "First document's output:Use Jekyll.configuration
to build a full configuration for use w/Jekyll.
Whatever: foo.bar
" in "_site/index.html" + Then the _site directory should exist + And I should see "Second document's output:Use Jekyll.configuration
to build a full configuration for use w/Jekyll.
Whatever: foo.bar
" in "_site/index.html" Scenario: Filter documents by where Given I have an "index.html" page that contains "{% assign items = site.methods | where: 'whatever','foo.bar' %}Item count: {{ items.size }}" @@ -133,7 +132,7 @@ Feature: Collections And I should see "Item count: 2" in "_site/index.html" Scenario: Sort by title - Given I have an "index.html" page that contains "{% assign items = site.methods | sort: 'title' %}1. of {{ items.size }}: {{ items.first.output }}" + Given I have an "index.html" page that contains "{% assign items = site.methods | sort: 'title' %}2. of {{ items.size }}: {{ items[1].output }}" And I have fixture collections And I have a "_config.yml" file with content: """ @@ -143,10 +142,10 @@ Feature: Collections When I run jekyll build Then I should get a zero exit status And the _site directory should exist - And I should see "1. of 7:Page without title.
" in "_site/index.html" + And I should see "2. of 8:Page without title.
" in "_site/index.html" Scenario: Sort by relative_path - Given I have an "index.html" page that contains "Collections: {% assign methods = site.methods | sort: 'relative_path' %}{% for method in methods %}{{ method.title }}, {% endfor %}" + Given I have an "index.html" page that contains "Collections: {% assign methods = site.methods | sort: 'relative_path' %}{{ methods | map:"title" | join: ", " }}" And I have fixture collections And I have a "_config.yml" file with content: """ @@ -156,7 +155,7 @@ Feature: Collections When I run jekyll build Then I should get a zero exit status Then the _site directory should exist - And I should see "Collections: Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Site#generate, YAML with Dots," in "_site/index.html" + And I should see "Collections: Collection#entries, Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Site#generate," in "_site/index.html" Scenario: Rendered collection with date/dateless filename Given I have an "index.html" page that contains "Collections: {% for method in site.thanksgiving %}{{ method.title }} {% endfor %}" diff --git a/features/create_sites.feature b/features/create_sites.feature index 031fa434..c1f75931 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -186,3 +186,20 @@ Feature: Create sites Then I should get a zero exit status And the _site directory should exist And the "_site/2020/12/31/entry1.html" file should exist + + Scenario: Basic site with layouts, posts and related posts + Given I have a _layouts directory + And I have a page layout that contains "Page {{ page.title }}: {{ content }}" + And I have a post layout that contains "Post {{ page.title }}: {{ content }}Related posts: {{ site.related_posts | size }}" + And I have an "index.html" page with layout "page" that contains "Site contains {{ site.pages.size }} pages and {{ site.posts.size }} posts; Related posts: {{ site.related_posts | size }}" + And I have a _posts directory + And I have the following posts: + | title | date | layout | content | + | entry1 | 2009-03-27 | post | content for entry1. | + | entry2 | 2009-04-27 | post | content for entry2. | + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should see "Page : Site contains 1 pages and 2 posts; Related posts: 0" in "_site/index.html" + And I should see "Post entry1:content for entry1.
\nRelated posts: 1" in "_site/2009/03/27/entry1.html" + And I should see "Post entry2:content for entry2.
\nRelated posts: 1" in "_site/2009/04/27/entry2.html" diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb index f0e3333d..11a4f06f 100644 --- a/lib/jekyll/collection.rb +++ b/lib/jekyll/collection.rb @@ -78,7 +78,7 @@ module Jekyll def entries return [] unless exists? @entries ||= - Utils.safe_glob(collection_dir, ["**", "*.*"]).map do |entry| + Utils.safe_glob(collection_dir, ["**", "*"]).map do |entry| entry["#{collection_dir}/"] = '' entry end diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index 3a263501..5c48d5be 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -8,7 +8,7 @@ module Jekyll c.description 'Search site and print specific deprecation warnings' c.alias(:hyde) - c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' + c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.action do |_, options| Jekyll::Commands::Doctor.process(options) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 10f1203e..6768fcf6 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -68,7 +68,11 @@ module Jekyll end def date - data['date'] ||= site.time + data['date'] ||= (draft? ? source_file_mtime : site.time) + end + + def source_file_mtime + @source_file_mtime ||= File.mtime(path) end # Returns whether the document is a draft. This is only the case if diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 986bfdee..d98d28a0 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -205,7 +205,7 @@ module Jekyll input.group_by do |item| item_property(item, property).to_s end.inject([]) do |memo, i| - memo << { "name" => i.first, "items" => i.last } + memo << { "name" => i.first, "items" => i.last, "size" => i.last.size } end else input @@ -315,7 +315,7 @@ module Jekyll def time(input) case input when Time - input + input.clone when Date input.to_time when String diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb index 09815a60..7d20d452 100644 --- a/lib/jekyll/renderer.rb +++ b/lib/jekyll/renderer.rb @@ -40,6 +40,8 @@ module Jekyll if document.is_a?(Document) && document.collection.label == 'posts' payload['site']['related_posts'] = document.related_posts + else + payload['site']['related_posts'] = nil end # render and transform content (this becomes the final content of the object) diff --git a/lib/site_template/_includes/footer.html b/lib/site_template/_includes/footer.html index 72239f1c..1e4b2bc9 100644 --- a/lib/site_template/_includes/footer.html +++ b/lib/site_template/_includes/footer.html @@ -2,12 +2,12 @@