diff --git a/CONTRIBUTING.markdown b/.github/CONTRIBUTING.markdown similarity index 98% rename from CONTRIBUTING.markdown rename to .github/CONTRIBUTING.markdown index f83249c9..c563e2d6 100644 --- a/CONTRIBUTING.markdown +++ b/.github/CONTRIBUTING.markdown @@ -1,5 +1,4 @@ -Contribute -========== +# Contributing So you've got an awesome idea to throw into Jekyll. Great! Please keep the following in mind: @@ -56,7 +55,7 @@ Workflow Here's the most direct way to get your work merged into the project: -* Fork the project. +* [Fork](https://github.com/jekyll/jekyll/fork) the project. * Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ). * Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ). * Hack away, add tests. Not necessarily in that order. diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md 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/CONDUCT.markdown b/CONDUCT.markdown index a0f06de7..8425dfc7 100644 --- a/CONDUCT.markdown +++ b/CONDUCT.markdown @@ -1,4 +1,4 @@ -# Contributor Code of Conduct +# Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who 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 12d97825..4c329b25 100644 --- a/History.markdown +++ b/History.markdown @@ -1,8 +1,35 @@ ## 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) + * Site Template: Removed unnecessary nesting from `_base.scss` (#4637) + +### Bug Fixes + + * Site Template: Added a default lang attribute (#4633) + * 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) + * Unify method for copying special files from repo to site (#4601) + ### 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) + * Adding Aerobatic to list of deployment options (#4630) ## 3.1.2 / 2016-02-19 diff --git a/README.markdown b/README.markdown index e35a2f1d..5caaa1eb 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# [Jekyll](http://jekyllrb.com/) +# [Jekyll](https://jekyllrb.com/) [][ruby-gems] [][travis] @@ -14,7 +14,7 @@ [hakiri]: https://hakiri.io/github/jekyll/jekyll/master [travis]: https://travis-ci.org/jekyll/jekyll -Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](http://pages.github.com), which you can use to host sites right from your GitHub repositories. +Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](https://pages.github.com), which you can use to host sites right from your GitHub repositories. ## Philosophy @@ -22,14 +22,14 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs ## Having trouble with OS X El Capitan? -See: http://jekyllrb.com/docs/troubleshooting/#jekyll-amp-mac-os-x-1011 +See: https://jekyllrb.com/docs/troubleshooting/#jekyll-amp-mac-os-x-1011 ## Getting Started -* [Install](http://jekyllrb.com/docs/installation/) the gem -* Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/) +* [Install](https://jekyllrb.com/docs/installation/) the gem +* Read up about its [Usage](https://jekyllrb.com/docs/usage/) and [Configuration](https://jekyllrb.com/docs/configuration/) * Take a gander at some existing [Sites](https://wiki.github.com/jekyll/jekyll/sites) -* [Fork](https://github.com/jekyll/jekyll/fork) and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications +* [Fork](https://github.com/jekyll/jekyll/fork) and [Contribute](https://jekyllrb.com/docs/contributing/) your own modifications * Have questions? Check out our official forum community [Jekyll Talk](https://talk.jekyllrb.com/) or [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/) ## Code of Conduct @@ -41,17 +41,17 @@ conduct. Please adhere to this code of conduct in any interactions you have in the Jekyll community. It is strictly enforced on all official Jekyll repositories, websites, and resources. If you encounter someone violating -these terms, please let a maintainer (@parkr, @envygeeks, or @mattr-) know +these terms, please let a maintainer ([@parkr](https://github.com/parkr), [@envygeeks](https://github.com/envygeeks), or [@mattr-](https://github.com/mattr-)) know and we will address it as soon as possible. ## Diving In * [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system -* Learn how the [YAML Front Matter](http://jekyllrb.com/docs/frontmatter/) works -* Put information on your site with [Variables](http://jekyllrb.com/docs/variables/) -* Customize the [Permalinks](http://jekyllrb.com/docs/permalinks/) your posts are generated with -* Use the built-in [Liquid Extensions](http://jekyllrb.com/docs/templates/) to make your life easier -* Use custom [Plugins](http://jekyllrb.com/docs/plugins/) to generate content specific to your site +* Learn how the [YAML Front Matter](https://jekyllrb.com/docs/frontmatter/) works +* Put information on your site with [Variables](https://jekyllrb.com/docs/variables/) +* Customize the [Permalinks](https://jekyllrb.com/docs/permalinks/) your posts are generated with +* Use the built-in [Liquid Extensions](https://jekyllrb.com/docs/templates/) to make your life easier +* Use custom [Plugins](https://jekyllrb.com/docs/plugins/) to generate content specific to your site ## License diff --git a/Rakefile b/Rakefile index e3f99c41..d4365723 100644 --- a/Rakefile +++ b/Rakefile @@ -87,6 +87,30 @@ def converted_history(markdown) normalize_bullets(markdown))))) end +def siteify_file(file, front_matter = {}) + abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file) + title = File.read(file).match(/\A# (.*)$/)[1] + slug = File.basename(file, ".markdown").downcase + front_matter = front_matter.merge({ + "title" => title, + "layout" => "docs", + "permalink" => "/docs/#{slug}/", + "note" => "This file is autogenerated. Edit /#{file} instead." + }) + contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" + File.write("site/_docs/#{slug}.md", contents) +end + +def content_for(file) + contents = File.read(file) + case file + when "History.markdown" + converted_history(contents) + else + contents.gsub!(/\A# .*\n\n?/, "") + end +end + ############################################################################# # # Standard tasks 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 @@