diff --git a/.github/CONTRIBUTING.markdown b/.github/CONTRIBUTING.markdown index fe53b2f3682..f1c19732b09 100644 --- a/.github/CONTRIBUTING.markdown +++ b/.github/CONTRIBUTING.markdown @@ -4,7 +4,7 @@ Hi there! Interested in contributing to Jekyll? We'd love your help. Jekyll is a ## Where to get help or report a problem -See [the support guidelines](SUPPORT.md) +See [the support guidelines](https://jekyllrb.com/docs/support/) ## Ways to contribute @@ -111,25 +111,37 @@ If your contribution changes any Jekyll behavior, make sure to update the docume * Don't bump the Gem version in your pull request (if you don't know what that means, you probably didn't). +* You can use the command `script/console` to start a REPL to explore the result of +Jekyll's methods. It also provides you with helpful methods to quickly create a +site or configuration. [Feel free to check it out!](https://github.com/jekyll/jekyll/blob/master/script/console) + ## Running tests locally ### Test Dependencies To run the test suite and build the gem you'll need to install Jekyll's dependencies by running the following command: -
$ script/bootstrap
+```sh +script/bootstrap +``` Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly): -
$ script/cibuild
+```sh +script/cibuild +``` If you are only updating a file in `test/`, you can use the command: -
$ script/test test/blah_test.rb
+```sh +script/test test/blah_test.rb +``` If you are only updating a `.feature` file, you can use the command: -
$ script/cucumber features/blah.feature
+```sh +script/cucumber features/blah.feature +``` Both `script/test` and `script/cucumber` can be run without arguments to run its entire respective suite. diff --git a/.github/SUPPORT.md b/.github/SUPPORT.markdown similarity index 100% rename from .github/SUPPORT.md rename to .github/SUPPORT.markdown diff --git a/.github/first-timers-issue-template.md b/.github/first-timers-issue-template.md new file mode 100644 index 00000000000..fccc77715de --- /dev/null +++ b/.github/first-timers-issue-template.md @@ -0,0 +1,44 @@ +### 🆕🐥☝ First Timers Only. + +This issue is reserved for people who never contributed to Open Source before. We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you 💝 + +[About First Timers Only](http://www.firsttimersonly.com/). + +### 🤔 What you will need to know. + +Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process. + +### 📋 Step by Step + +- [ ] 👌 **Join the team**: Add yourself to a Jekyll affinity team. + + Go to [teams.jekyllrb.com](https://teams.jekyllrb.com/) and join a team that best fits your interests. Once you click the link to join a team, you will soon recieve an email inviting you to join the Jekyll organization. + +- [ ] 🙋 **Claim this issue**: Comment below. + + Leave a comment that you have claimed this issue. + +- [ ] 📝 **Update** the file [$FILENAME]($BRANCH_URL) in the `$REPO` repository (press the little pen Icon) and edit the line as shown below. + + +```diff +$DIFF +``` + + +- [ ] 💾 **Commit** your changes + +- [ ] 🔀 **Start a Pull Request**. There are two ways how you can start a pull request: + + 1. If you are familiar with the terminal or would like to learn it, [here is a great tutorial](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) on how to send a pull request using the terminal. + + 2. You can [edit files directly in your browser](https://help.github.com/articles/editing-files-in-your-repository/) + +- [ ] 🏁 **Done** Ask in comments for a review :) + +### 🤔❓ Questions + +Leave a comment below! + + +This issue was created by [First-Timers-Bot](https://github.com/hoodiehq/first-timers-bot). diff --git a/.github/first-timers.yml b/.github/first-timers.yml new file mode 100644 index 00000000000..9f866d72324 --- /dev/null +++ b/.github/first-timers.yml @@ -0,0 +1,6 @@ +repository: jekyll +labels: + - good first issue + - help-wanted + - first-time-only +template: .github/first-timers-issue-template.md diff --git a/.rubocop.yml b/.rubocop.yml index ea3aa1062fc..969c065ff70 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ --- AllCops: - TargetRubyVersion: 2.0 + TargetRubyVersion: 2.1 Include: - lib/**/*.rb Exclude: @@ -21,7 +21,7 @@ Layout/EmptyLinesAroundAccessModifier: Layout/EmptyLinesAroundModuleBody: Enabled: false Layout/EndOfLine: - EnforcedStyle: lf + EnforcedStyle: native Layout/ExtraSpacing: AllowForAlignment: true Layout/FirstParameterIndentation: @@ -38,8 +38,6 @@ Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Layout/MultilineOperationIndentation: EnforcedStyle: indented -Layout/SpaceAroundOperators: - Enabled: true Layout/SpaceInsideBrackets: Enabled: false Lint/EndAlignment: @@ -48,6 +46,8 @@ Lint/UnreachableCode: Severity: error Lint/UselessAccessModifier: Enabled: false +Lint/Void: + Enabled: false Metrics/AbcSize: Max: 21 Metrics/BlockLength: @@ -82,6 +82,10 @@ Metrics/ParameterLists: Max: 4 Metrics/PerceivedComplexity: Max: 8 +Naming/FileName: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false Security/MarshalLoad: Exclude: - !ruby/regexp /test\/.*.rb$/ @@ -94,14 +98,11 @@ Style/Alias: Enabled: false Style/AndOr: Severity: error -Style/Attr: - Enabled: false Style/BracesAroundHashParameters: Enabled: false Style/ClassAndModuleChildren: Enabled: false Style/FrozenStringLiteralComment: - Enabled: true EnforcedStyle: always Style/Documentation: Enabled: false @@ -109,8 +110,6 @@ Style/Documentation: - !ruby/regexp /features\/.*.rb$/ Style/DoubleNegation: Enabled: false -Style/FileName: - Enabled: false Style/GuardClause: Enabled: false Style/HashSyntax: @@ -153,5 +152,3 @@ Style/SymbolArray: Enabled: false Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: consistent_comma -Style/UnneededCapitalW: - Enabled: false diff --git a/.travis.yml b/.travis.yml index 00e21f93e19..2cfe51b7697 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ language: ruby sudo: false rvm: - - &ruby1 2.4.1 - - &ruby2 2.3.4 - - &ruby3 2.2.7 + - &ruby1 2.4.2 + - &ruby2 2.3.5 + - &ruby3 2.2.8 - &ruby4 2.1.10 - - &jruby jruby-9.1.7.0 + - &jruby jruby-9.1.13.0 matrix: include: diff --git a/Gemfile b/Gemfile index 216c2626f19..92f6f45e54e 100644 --- a/Gemfile +++ b/Gemfile @@ -23,14 +23,14 @@ end group :test do gem "codeclimate-test-reporter", "~> 1.0.5" - gem "cucumber", "~> 2.1" + gem "cucumber", "~> 3.0" gem "jekyll_test_plugin" gem "jekyll_test_plugin_malicious" # nokogiri v1.8 does not work with ruby 2.1 and below gem "nokogiri", RUBY_VERSION >= "2.2" ? "~> 1.7" : "~> 1.7.0" gem "rspec" gem "rspec-mocks" - gem "rubocop", "~> 0.49.1" + gem "rubocop", "~> 0.51.0" gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__) gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__) diff --git a/History.markdown b/History.markdown index 50ba202e33d..e74d59b3fc6 100644 --- a/History.markdown +++ b/History.markdown @@ -1,17 +1,103 @@ ## HEAD +### Documentation + + * Docs: GitHub Pages instructions (#6384) + * Improve documentation for theme-gem installation (#6387) + * Fix diff syntax-highlighting (#6388) + * Fix code-block highlighting in docs (#6398) + * Docs: Filtering Posts with categories, tags, or other variables (#6399) + * Fixes formatting on pre-formatted text. (#6405) + * Docs: updates (#6407) + * Docs: Fix `collections_dir` example (#6408) + * Docs: Renaming duplicate of "Scenario 6" to "Scenario 7" (#6411) + * Docs: Mark `collection_dir` as unreleased (#6412) + * Docs: Fix link to SUPPORT (#6415) + * Docs: Added new tutorial to tutorials section on docs (#6406) + * Fix list appearance by adding missing `ol` tag (#6421) + * Explain how to override output collection index page (#6424) + * Added github-cards to the list of plugins (#6425) + * add post about diversity (#6447) + * Docs: Add a note about Liquid and syntax highlighting (#6466) + * Add a note on `:jekyll_plugins` group in the docs (#6488) + * Updated custom-404-page.md (#6489) + * Remove `sudo` from macOS troubleshooting instructions (#6486) + * add formester to the list of saas form backend (#6059) + * Fix a few minor issues in the docs (#6494) + ### Development Fixes - * Strip unnecessary leading whitespace in template (#6228) - * Users should be installing patch versions. (#6198) - * fix tests (#6240) - * Define path with __dir__ (#6087) - * exit site.process sooner (#6239) - * make flakey test more robust (#6277) - * Add a quick test for DataReader (#6284) - * script/backport-pr: commit message no longer includes the `#` (#6289) - * Add Add CODEOWNERS file to help automate reviews. (#6320) - * Fix builds on codeclimate (#6333) + * Upgrade to Cucumber 3.0 (#6395) + * Provide a better default hash for tracking liquid stats (#6417) + * Docs: CoC violation correspondants (#6429) + * add failing test for non-utf8 encoding (#6339) + * Add configuration for first-timers bot (#6431) + * Update first-timers-issue-template.md (#6472) + * Site: Rename method (#6474) + * Do not linkify escaped characters as PRs in History (#6468) + * Rely on jekyll-mentions for linking usernames (#6469) + * Enable `Lint/RescueWithoutErrorClass` Cop (#6482) + * Added direct collection access to future collection item feature test (#6151) + * Clean up Rubocop config (#6495) + * Fix #6498: Use Gem to discover the location of bundler. (#6499) + * Remove unnecessary encoding comment (#6513) + * Suggest using Rubocop to automatically fix errors (#6514) + * Assert raising Psych::SyntaxError when `"strict_front_matter"=>true` (#6520) + * [RuboCop] Enable `Style/UnneededCapitalW` cop (#6526) + * Use Kernel#Array instead of explicit Array check (#6525) + +### Minor Enhancements + + * Disable default layouts for Pages with a `layout: none` declaration (#6182) + * Upgrade to Rouge 3 (#6381) + * Allow the user to set collections_dir to put all collections under one subdirectory (#6331) + * Scope path glob (#6268) + * Allow plugins to modify the obsolete files. (#6502) + * .sass-cache doesn't *always* land in options['source'] (#6500) + * Add Utils::Internet.connected? to determine whether host machine has internet connection. (#5870) + * Add latin mode to slugify (#6509) + * filter relative_url should keep absolute urls with scheme/authority (#6490) + +### Site Enhancements + + * Docs: Update instructions (#6396) + * Add special styling for code-blocks run in shell (#6389) + * Update list of files excluded from Docs site (#6457) + * Update site History (#6460) + * Site: Add default twitter card image (#6476) + * Update normalize.css to v7.0.0 (#6491) + +### Bug Fixes + + * Raise when theme root directory is not available (#6455) + +## 3.6.2 / 2017-10-21 + +### Development Fixes + + * Update Rubocop to 0.51.0 (#6444) + * Add test for layout as string (#6445) + +### Bug Fixes + + * Problematic UTF+bom files (#6322) + * Always treat `data.layout` as a string (#6442) + +## 3.6.1 / 2017-10-20 + +### Documentation + + * Doc y_day in docs/permalinks (#6244) + * Update frontmatter.md (#6371) + * Elaborate on excluding items from processing (#6136) + * Style lists in tables (#6379) + * Remove duplicate "available" (#6380) + +### Development Fixes + + * Bump rubocop to use `v0.50.x` (#6368) + +## 3.6.0 / 2017-09-21 ### Minor Enhancements @@ -24,19 +110,24 @@ * Add support for Rouge 2, in addition to Rouge 1 (#5919) * Allow `yield` to logger methods & bail early on no-op messages (#6315) * Update mime-types. (#6336) + * Use a Schwartzian transform with custom sorting (#6342) + * Alias `Drop#invoke_drop` to `Drop#[]` (#6338) ### Bug Fixes * `Deprecator`: fix typo for `--serve` command (#6229) * `Reader#read_directories`: guard against an entry not being a directory (#6226) * kramdown: symbolize keys in-place (#6247) - * Call to_s on site.url before attempting to concatenate strings (#6253) + * Call `to_s` on site.url before attempting to concatenate strings (#6253) * Enforce Style/FrozenStringLiteralComment (#6265) * Update theme-template README to note 'assets' directory (#6257) - * Memoize the return value of Document#url (#6266) + * Memoize the return value of `Document#url` (#6266) * delegate `StaticFile#to_json` to `StaticFile#to_liquid` (#6273) - * Fix Drop#key? so it can handle a nil argument (#6281) + * Fix `Drop#key?` so it can handle a nil argument (#6281) * Guard against type error in absolute url (#6280) + * Mutable drops should fallback to their own methods when a mutation isn't present (#6350) + * Skip adding binary files as posts (#6344) + * Don't break if bundler is not installed (#6377) ### Documentation @@ -56,6 +147,9 @@ * Docs: `site.url` behavior on development and production environments (#6270) * Fix typo in site.url section of variables.md :-[ (#6337) * Docs: updates (#6343) + * Fix precedence docs (#6346) + * add note to contributing docs about `script/console` (#6349) + * Docs: Fix permalink example (#6375) ### Site Enhancements @@ -63,6 +157,20 @@ * Customizing url in collection elements clarified (#6264) * Plugins is the new gems (#6326) +### Development Fixes + + * Strip unnecessary leading whitespace in template (#6228) + * Users should be installing patch versions. (#6198) + * Fix tests (#6240) + * Define path with `__dir__` (#6087) + * exit site.process sooner (#6239) + * make flakey test more robust (#6277) + * Add a quick test for DataReader (#6284) + * script/backport-pr: commit message no longer includes the `#` (#6289) + * Add Add CODEOWNERS file to help automate reviews. (#6320) + * Fix builds on codeclimate (#6333) + * Bump rubies on Travis (#6366) + ## 3.5.2 / 2017-08-12 ### Bug Fixes @@ -1275,7 +1383,7 @@ ### Site Enhancements - * Add `@alfredxing` to the `@jekyll/core` team. :tada: (#3218) + * Add @alfredxing to the @jekyll/core team. :tada: (#3218) * Document the `-q` option for the `build` and `serve` commands (#3149) * Fix some minor typos/flow fixes in documentation website content (#3165) * Add `keep_files` to configuration documentation (#3162) diff --git a/README.markdown b/README.markdown index 1350d019e0b..7dac7786cb9 100644 --- a/README.markdown +++ b/README.markdown @@ -45,7 +45,7 @@ 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 [team captain](https://github.com/orgs/jekyll/teams/affinity-team-captains/members) know and we will address it as soon as possible. +these terms, please let one of our core team members [Olivia](mailto:olivia@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Pat](mailto:pat@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Matt](mailto:matt@jekyllrb.com?subject=Jekyll%20CoC%20Violation) or [Parker](mailto:parker@jekyllrb.com?subject=Jekyll%20CoC%20Violation) know and we will address it as soon as possible. ## Diving In diff --git a/Rakefile b/Rakefile index a7d50088d93..786a2626dc4 100644 --- a/Rakefile +++ b/Rakefile @@ -46,19 +46,13 @@ def normalize_bullets(markdown) end def linkify_prs(markdown) - markdown.gsub(%r!#(\d+)!) do |word| + markdown.gsub(%r!(?<\!&)#(\d+)!) do |word| "[#{word}]({{ site.repository }}/issues/#{word.delete("#")})" end end -def linkify_users(markdown) - markdown.gsub(%r!(@\w+)!) do |username| - "[#{username}](https://github.com/#{username.delete("@")})" - end -end - def linkify(markdown) - linkify_users(linkify_prs(markdown)) + linkify_prs(markdown) end def liquid_escape(markdown) @@ -72,11 +66,11 @@ def custom_release_header_anchors(markdown) _, major, minor, patch = *release_notes.match(header_regexp) release_notes .gsub(header_regexp, "\\0\n{: #v\\1-\\2-\\3}") - .gsub(section_regexp) { |section| "#{section}\n{: ##{sluffigy(section)}-v#{major}-#{minor}-#{patch}}" } + .gsub(section_regexp) { |section| "#{section}\n{: ##{slugify(section)}-v#{major}-#{minor}-#{patch}}" } end.join("\n## ") end -def sluffigy(header) +def slugify(header) header.delete("#").strip.downcase.gsub(%r!\s+!, "-") end @@ -101,7 +95,7 @@ def siteify_file(file, overrides_front_matter = {}) abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exist?(file) title = begin File.read(file).match(%r!\A# (.*)$!)[1] - rescue + rescue NoMethodError File.basename(file, ".*").downcase.capitalize end slug = File.basename(file, ".markdown").downcase diff --git a/benchmark/schwartzian_transform.rb b/benchmark/schwartzian_transform.rb new file mode 100644 index 00000000000..76c53e44e32 --- /dev/null +++ b/benchmark/schwartzian_transform.rb @@ -0,0 +1,115 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# The Ruby documentation for #sort_by describes what's called a Schwartzian transform: +# +# > A more efficient technique is to cache the sort keys (modification times in this case) +# > before the sort. Perl users often call this approach a Schwartzian transform, after +# > Randal Schwartz. We construct a temporary array, where each element is an array +# > containing our sort key along with the filename. We sort this array, and then extract +# > the filename from the result. +# > This is exactly what sort_by does internally. +# +# The well-documented efficiency of sort_by is a good reason to use it. However, when a property +# does not exist on an item being sorted, it can cause issues (no nil's allowed!) +# In Jekyll::Filters#sort_input, we extract the property in each iteration of #sort, +# which is quite inefficient! How inefficient? This benchmark will tell you just how, and how much +# it can be improved by using the Schwartzian transform. Thanks, Randall! + +require 'benchmark/ips' +require 'minitest' +require File.expand_path("../lib/jekyll", __dir__) + +def site + @site ||= Jekyll::Site.new( + Jekyll.configuration("source" => File.expand_path("../docs", __dir__)) + ).tap(&:reset).tap(&:read) +end + +def site_docs + site.collections["docs"].docs.dup +end + +def sort_by_property_directly(docs, meta_key) + docs.sort! do |apple, orange| + apple_property = apple[meta_key] + orange_property = orange[meta_key] + + if !apple_property.nil? && !orange_property.nil? + apple_property <=> orange_property + elsif !apple_property.nil? && orange_property.nil? + -1 + elsif apple_property.nil? && !orange_property.nil? + 1 + else + apple <=> orange + end + end +end + +def schwartzian_transform(docs, meta_key) + docs.collect! { |d| + [d[meta_key], d] + }.sort! { |apple, orange| + if !apple[0].nil? && !orange[0].nil? + apple.first <=> orange.first + elsif !apple[0].nil? && orange[0].nil? + -1 + elsif apple[0].nil? && !orange[0].nil? + 1 + else + apple[-1] <=> orange[-1] + end + }.collect! { |d| d[-1] } +end + +# Before we test efficiency, do they produce the same output? +class Correctness + include Minitest::Assertions + + require "pp" + define_method :mu_pp, &:pretty_inspect + + attr_accessor :assertions + + def initialize(docs, property) + @assertions = 0 + @docs = docs + @property = property + end + + def assert! + assert sort_by_property_directly(@docs, @property).is_a?(Array), "sort_by_property_directly must return an array" + assert schwartzian_transform(@docs, @property).is_a?(Array), "schwartzian_transform must return an array" + assert_equal sort_by_property_directly(@docs, @property), + schwartzian_transform(@docs, @property) + puts "Yeah, ok, correctness all checks out for property #{@property.inspect}" + end +end + +Correctness.new(site_docs, "redirect_from".freeze).assert! +Correctness.new(site_docs, "title".freeze).assert! + +# First, test with a property only a handful of documents have. +Benchmark.ips do |x| + x.config(time: 10, warmup: 5) + x.report('sort_by_property_directly with sparse property') do + sort_by_property_directly(site_docs, "redirect_from".freeze) + end + x.report('schwartzian_transform with sparse property') do + schwartzian_transform(site_docs, "redirect_from".freeze) + end + x.compare! +end + +# Next, test with a property they all have. +Benchmark.ips do |x| + x.config(time: 10, warmup: 5) + x.report('sort_by_property_directly with non-sparse property') do + sort_by_property_directly(site_docs, "title".freeze) + end + x.report('schwartzian_transform with non-sparse property') do + schwartzian_transform(site_docs, "title".freeze) + end + x.compare! +end diff --git a/docs/_config.yml b/docs/_config.yml index 044cb386c95..d6e4443cf6f 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -8,7 +8,6 @@ google_analytics_id: UA-50755011-1 google_site_verification: onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY repository: https://github.com/jekyll/jekyll -help_url: https://github.com/jekyll/jekyll-help timezone: America/Los_Angeles @@ -25,7 +24,7 @@ defaults: type: "posts" values: layout: "news_item" - + image: /img/twitter-card.png collections: docs: @@ -57,4 +56,6 @@ plugins: exclude: - .gitignore - - README.md + - CNAME + - icomoon-selection.json + - readme.md diff --git a/docs/_data/tutorials.yml b/docs/_data/tutorials.yml index a394345bbd4..3c2a9a66bda 100644 --- a/docs/_data/tutorials.yml +++ b/docs/_data/tutorials.yml @@ -1,6 +1,7 @@ - title: Tutorials tutorials: - home + - video-walkthroughs - navigation - orderofinterpretation - custom-404-page diff --git a/docs/_docs/code_of_conduct.md b/docs/_docs/code_of_conduct.md new file mode 100644 index 00000000000..1cd0bdbc525 --- /dev/null +++ b/docs/_docs/code_of_conduct.md @@ -0,0 +1,55 @@ +--- +title: Code of Conduct +permalink: "/docs/code_of_conduct/" +note: This file is autogenerated. Edit /CODE_OF_CONDUCT.markdown instead. +redirect_from: "/conduct/index.html" +editable: false +--- + +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 +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to +fairly and consistently applying these principles to every aspect of managing +this project. Project maintainers who do not follow or enforce the Code of +Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by opening an issue or contacting a project maintainer. All complaints +will be reviewed and investigated and will result in a response that is deemed +necessary and appropriate to the circumstances. Maintainers are obligated to +maintain confidentiality with regard to the reporter of an incident. + + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.3.0, available at +[http://contributor-covenant.org/version/1/3/0/][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/3/0/ diff --git a/docs/_docs/collections.md b/docs/_docs/collections.md index 39bd99eb0d7..0b59b7db6d1 100644 --- a/docs/_docs/collections.md +++ b/docs/_docs/collections.md @@ -46,6 +46,15 @@ defaults: layout: page ``` +
+
Gather your collections
+ +

From v3.7.0 you can optionally specify a directory to store all your collections in the same place with collections_dir: my_collections

+ +

Then Jekyll will look in my_collections/_books for the books collection, and + in my_collections/_recipes for the recipes collection.

+
+ ### Step 2: Add your content {#step2} Create a corresponding folder (e.g. `/_my_collection`) and add @@ -78,6 +87,20 @@ For example, if you have `_my_collection/some_subdir/some_doc.md`, it will be rendered using Liquid and the Markdown converter of your choice and written out to `/my_collection/some_subdir/some_doc.html`. +If you wish a specific page to be shown when accessing `/my_collection/`, +simply add `permalink: /my_collection/index.html` to a page. +To list items from the collection, on that page or any other, you can use: + +{% raw %} +```liquid +{% for item in site.my_collection %} +

{{ item.title }}

+

{{ item.description }}

+

{{ item.title }}

+{% endfor %} +``` +{% endraw %} +
Don't forget to add YAML for processing

@@ -111,7 +134,7 @@ _my_collection/ each of the following `permalink` configurations will produce the document structure shown below it. -* **Default** +* **Default** Same as `permalink: /:collection/:path`. ``` @@ -121,7 +144,7 @@ each of the following `permalink` configurations will produce the document struc │   └── some_doc.html ... ``` -* `permalink: pretty` +* `permalink: pretty` Same as `permalink: /:collection/:path/`. ``` @@ -225,7 +248,7 @@ each of the following `permalink` configurations will produce the document struc Each collection is accessible as a field on the `site` variable. For example, if you want to access the `albums` collection found in `_albums`, you'd use -`site.albums`. +`site.albums`. Each collection is itself an array of documents (e.g., `site.albums` is an array of documents, much like `site.pages` and `site.posts`). See the table below for how to access attributes of those documents. @@ -310,10 +333,10 @@ you specified in your `_config.yml` (if present) and the following information:

A Hard-Coded Collection
-

In addition to any collections you create yourself, the - posts collection is hard-coded into Jekyll. It exists whether - you have a _posts directory or not. This is something to note - when iterating through site.collections as you may need to +

In addition to any collections you create yourself, the + posts collection is hard-coded into Jekyll. It exists whether + you have a _posts directory or not. This is something to note + when iterating through site.collections as you may need to filter it out.

You may wish to use filters to find your collection: {% raw %}{{ site.collections | where: "label", "myCollection" | first }}{% endraw %}

@@ -443,7 +466,7 @@ works: Every album in the collection could be listed on a single page with a template: -```html +```liquid {% raw %} {% for album in site.albums %}

{{ album.title }}

diff --git a/docs/_docs/configuration.md b/docs/_docs/configuration.md index 057e4ee29f8..cd0f20583f2 100644 --- a/docs/_docs/configuration.md +++ b/docs/_docs/configuration.md @@ -518,7 +518,7 @@ defaults: - scope: path: "" - type: "posts" + type: "pages" values: layout: "my-site" - @@ -530,7 +530,7 @@ defaults: author: "Mr. Hyde" ``` -With these defaults, all posts would use the `my-site` layout. Any html files that exist in the `projects/` folder will use the `project` layout, if it exists. Those files will also have the `page.author` [liquid variable](../variables/) set to `Mr. Hyde`. +With these defaults, all pages would use the `my-site` layout. Any html files that exist in the `projects/` folder will use the `project` layout, if it exists. Those files will also have the `page.author` [liquid variable](../variables/) set to `Mr. Hyde`. ```yaml collections: @@ -549,11 +549,26 @@ defaults: In this example, the `layout` is set to `default` inside the [collection](../collections/) with the name `my_collection`. +It is also possible to use glob patterns when matching defaults. For example, it is possible to set specific layout for each `special-page.html` in any subfolder of `section` folder. + +```yaml +collections: + my_collection: + output: true + +defaults: + - + scope: + path: "section/*/special-page.html" + values: + layout: "specific-layout" +``` + ### Precedence Jekyll will apply all of the configuration settings you specify in the `defaults` section of your `_config.yml` file. However, you can choose to override settings from other scope/values pair by specifying a more specific path for the scope. -You can see that in the second to last example above. First, we set the default layout to `my-site`. Then, using a more specific path, we set the default layout for files in the `projects/` path to `project`. This can be done with any value that you would set in the page or post front matter. +You can see that in the second to last example above. First, we set the default page layout to `my-site`. Then, using a more specific path, we set the default layout for pages in the `projects/` path to `project`. This can be done with any value that you would set in the page or post front matter. Finally, if you set defaults in the site configuration by adding a `defaults` section to your `_config.yml` file, you can override those settings in a post or page file. All you need to do is specify the settings in the post or page front matter. For example: @@ -602,12 +617,13 @@ file or on the command-line. ```yaml # Where things are -source: . -destination: ./_site -plugins_dir: _plugins -layouts_dir: _layouts -data_dir: _data -includes_dir: _includes +source: . +destination: ./_site +collections_dir: . +plugins_dir: _plugins +layouts_dir: _layouts +data_dir: _data +includes_dir: _includes collections: posts: output: true diff --git a/docs/_docs/continuous-integration/buddyworks.md b/docs/_docs/continuous-integration/buddyworks.md index 5cce1f75487..aef1ce8ed53 100644 --- a/docs/_docs/continuous-integration/buddyworks.md +++ b/docs/_docs/continuous-integration/buddyworks.md @@ -29,7 +29,7 @@ Whenever you make a push to the selected branch, the Jekyll action runs `jekyll If you prefer configuration as code over GUI, you can generate a `buddy.yml` that will create a pipeline with the Jekyll action once you push it to the target branch: -```ruby +```yaml - pipeline: "Build and Deploy Jekyll site" trigger_mode: "ON_EVERY_PUSH" ref_name: "master" diff --git a/docs/_docs/continuous-integration/circleci.md b/docs/_docs/continuous-integration/circleci.md index fede484a2d1..b4aadc616b4 100644 --- a/docs/_docs/continuous-integration/circleci.md +++ b/docs/_docs/continuous-integration/circleci.md @@ -25,7 +25,7 @@ The easiest way to manage dependencies for a Jekyll project (with or without Cir [4]: http://bundler.io/gemfile.html -```yaml +```ruby source 'https://rubygems.org' ruby '2.4.0' @@ -40,7 +40,7 @@ CircleCI detects when `Gemfile` is present is will automatically run `bundle ins The most basic test that can be run is simply seeing if `jekyll build` actually works. This is a blocker, a dependency if you will, for other tests you might run on the generate site. So we'll run Jekyll, via Bundler, in the `dependencies` phase. -``` +```yaml dependencies: post: - bundle exec jekyll build @@ -63,7 +63,7 @@ test: When you put it all together, here's an example of what that `circle.yml` file could look like: -``` +```yaml machine: environment: NOKOGIRI_USE_SYSTEM_LIBRARIES: true # speeds up installation of html-proofer diff --git a/docs/_docs/continuous-integration/travis-ci.md b/docs/_docs/continuous-integration/travis-ci.md index 91323958024..cbff5267e2e 100644 --- a/docs/_docs/continuous-integration/travis-ci.md +++ b/docs/_docs/continuous-integration/travis-ci.md @@ -49,7 +49,7 @@ Some options can be specified via command-line switches. Check out the For example to avoid testing external sites, use this command: ```sh -$ bundle exec htmlproofer ./_site --disable-external +bundle exec htmlproofer ./_site --disable-external ``` ### The HTML Proofer Library diff --git a/docs/_docs/contributing.md b/docs/_docs/contributing.md index b0b85e0f31c..f1c643d3f71 100644 --- a/docs/_docs/contributing.md +++ b/docs/_docs/contributing.md @@ -8,10 +8,7 @@ Hi there! Interested in contributing to Jekyll? We'd love your help. Jekyll is a ## Where to get help or report a problem -* If you have a question about using Jekyll, start a discussion on [Jekyll Talk](https://talk.jekyllrb.com). -* If you think you've found a bug within a Jekyll plugin, open an issue in that plugin's repository. -* If you think you've found a bug within Jekyll itself, [open an issue](https://github.com/jekyll/jekyll/issues/new). -* More resources are listed on our [Help page](https://jekyllrb.com/help/). +See [the support guidelines](https://jekyllrb.com/docs/support/) ## Ways to contribute @@ -118,25 +115,37 @@ If your contribution changes any Jekyll behavior, make sure to update the docume * Don't bump the Gem version in your pull request (if you don't know what that means, you probably didn't). +* You can use the command `script/console` to start a REPL to explore the result of +Jekyll's methods. It also provides you with helpful methods to quickly create a +site or configuration. [Feel free to check it out!](https://github.com/jekyll/jekyll/blob/master/script/console) + ## Running tests locally ### Test Dependencies To run the test suite and build the gem you'll need to install Jekyll's dependencies by running the following command: -
$ script/bootstrap
+```sh +script/bootstrap +``` Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly): -
$ script/cibuild
+```sh +script/cibuild +``` If you are only updating a file in `test/`, you can use the command: -
$ script/test test/blah_test.rb
+```sh +script/test test/blah_test.rb +``` If you are only updating a `.feature` file, you can use the command: -
$ script/cucumber features/blah.feature
+```sh +script/cucumber features/blah.feature +``` Both `script/test` and `script/cucumber` can be run without arguments to run its entire respective suite. diff --git a/docs/_docs/datafiles.md b/docs/_docs/datafiles.md index 671a32060b9..f59715198c1 100644 --- a/docs/_docs/datafiles.md +++ b/docs/_docs/datafiles.md @@ -56,8 +56,8 @@ determines the variable name). You can now render the list of members in a template: -```html {% raw %} +```liquid
    {% for member in site.data.members %}
  • @@ -67,8 +67,8 @@ You can now render the list of members in a template:
  • {% endfor %}
-{% endraw %} ``` +{% endraw %} {: .note .info } If your Jekyll site has a lot of pages, such as with documentation websites, see the detailed examples in [how to build robust navigation for your site]({% link _tutorials/navigation.md %}). @@ -106,8 +106,8 @@ members: The organizations can then be accessed via `site.data.orgs`, followed by the file name: -```html {% raw %} +```liquid
    {% for org_hash in site.data.orgs %} {% assign org = org_hash[1] %} @@ -119,8 +119,8 @@ file name: {% endfor %}
-{% endraw %} ``` +{% endraw %} ## Example: Accessing a specific author @@ -136,8 +136,8 @@ dave: The author can then be specified as a page variable in a post's frontmatter: -```html {% raw %} +```liquid --- title: sample post author: dave @@ -149,8 +149,7 @@ author: dave title="{{ author.name }}"> {{ author.name }} - -{% endraw %} ``` +{% endraw %} For information on how to build robust navigation for your site (especially if you have a documentation website or another type of Jekyll site with a lot of pages to organize), see [Navigation](/tutorials/navigation). diff --git a/docs/_docs/deployment-methods.md b/docs/_docs/deployment-methods.md index 608b0661210..972db33667f 100644 --- a/docs/_docs/deployment-methods.md +++ b/docs/_docs/deployment-methods.md @@ -20,7 +20,7 @@ Read this [Jekyll step-by-step guide](https://www.netlify.com/blog/2015/10/28/a- [Aerobatic](https://www.aerobatic.com) has custom domains, global CDN distribution, basic auth, CORS proxying, and a growing list of plugins all included. -Automating the deployment of a Jekyll site is simple. See our [Jekyll docs](https://www.aerobatic.com/docs/static-site-generators/#jekyll) for more details. Your built `_site` folder is deployed to our highly-available, globally distributed hosting service. +Automating the deployment of a Jekyll site is simple. See their [Jekyll docs](https://www.aerobatic.com/docs/static-site-generators/#jekyll) for more details. Your built `_site` folder is deployed to their highly-available, globally distributed hosting service. ## Kickster diff --git a/docs/_docs/frontmatter.md b/docs/_docs/frontmatter.md index cf5aad13f14..761c8bb5089 100644 --- a/docs/_docs/frontmatter.md +++ b/docs/_docs/frontmatter.md @@ -68,6 +68,20 @@ front matter of a page or post. _layouts directory.

+
    +
  • + Using null will produce a file without using a layout + file. However this is overridden if the file is a post/document and has a + layout defined in the + frontmatter defaults. +
  • +
  • + Starting from version 3.5.0, using none in a post/document will + produce a file without using a layout file regardless of frontmatter defaults. + Using none in a page, however, will cause Jekyll to attempt to + use a layout named "none". +
  • +
@@ -115,14 +129,14 @@ data that is sent to the Liquid templating engine during the conversion. For instance, if you set a title, you can use that in your layout to set the page title: -```html +```liquid {% raw %}{{ page.title }}{% endraw %} - ... + … ``` ## Predefined Variables for Posts @@ -153,7 +167,7 @@ These are available out-of-the-box to be used in the front matter for a post. -

category

+

category

categories

diff --git a/docs/_docs/github-pages.md b/docs/_docs/github-pages.md index 2d519f68e00..01af5e50e41 100644 --- a/docs/_docs/github-pages.md +++ b/docs/_docs/github-pages.md @@ -4,102 +4,81 @@ permalink: /docs/github-pages/ --- [GitHub Pages](https://pages.github.com) are public web pages for users, -organizations, and repositories, that are freely hosted on GitHub's -`github.io` domain or on a custom domain name of your choice. GitHub Pages are -powered by Jekyll behind the scenes, so in addition to supporting regular HTML -content, they’re also a great way to host your Jekyll-powered website for free. +organizations, and repositories, that are freely hosted on GitHub's `github.io` +domain or on a custom domain name of your choice. GitHub Pages are powered by +Jekyll behind the scenes, so they're a great way to host your Jekyll-powered +website for free. -Never built a website with GitHub Pages before? [See this marvelous guide by -Jonathan McGlone to get you up and running](http://jmcglone.com/guides/github-pages/). -This guide will teach you what you need to know about Git, GitHub, and Jekyll to create your very own website on GitHub Pages. - -### Project Page URL Structure +Your site is automatically generated by GitHub Pages when you push your source +files. Note that GitHub Pages works equally well for regular HTML content, +simply because Jekyll treats files without YAML front matter as static assets. +So if you only need to push generated HTML, you're good to go without any +further setup. -Sometimes it's nice to preview your Jekyll site before you push your `gh-pages` -branch to GitHub. However, the subdirectory-like URL structure GitHub uses for -Project Pages complicates the proper resolution of URLs. In order to assure your site builds properly, use `site.github.url` in your URLs. - -```html -{% raw %} - - - -[{{ page.title }}]("{{ page.url | prepend: site.github.url }}") -{% endraw %} -``` - -This way you can preview your site locally from the site root on localhost, -but when GitHub generates your pages from the gh-pages branch all the URLs -will resolve properly. - -## Deploying Jekyll to GitHub Pages +Never built a website with GitHub Pages before? [See this marvelous guide by +Jonathan McGlone](http://jmcglone.com/guides/github-pages/) to get you up and +running. This guide will teach you what you need to know about Git, GitHub, and +Jekyll to create your very own website on GitHub Pages. -GitHub Pages work by looking at certain branches of repositories on GitHub. -There are two basic types available: user/organization pages and project pages. -The way to deploy these two types of sites are nearly identical, except for a -few minor details. +## The github-pages gem -
-
-
+Our friends at GitHub have provided the +[github-pages](https://github.com/github/pages-gem) gem which is used to manage +[Jekyll and its dependencies on GitHub Pages](https://pages.github.com/versions/). +Using it in your projects means that when you deploy your site to GitHub Pages, +you will not be caught by unexpected differences between various versions of the +gems. -##### Use the `github-pages` gem +Note that GitHub Pages runs in `safe` mode and only allows [a set of whitelisted +plugins](https://help.github.com/articles/configuring-jekyll-plugins/#default-plugins). -Our friends at GitHub have provided the -[github-pages](https://github.com/github/pages-gem) -gem which is used to manage Jekyll and its dependencies on -GitHub Pages. Using it in your projects means that when you deploy -your site to GitHub Pages, you will not be caught by unexpected -differences between various versions of the gems. To use the -currently-deployed version of the gem in your project, add the +To use the currently-deployed version of the gem in your project, add the following to your `Gemfile`: -
-
-
- ```ruby -source 'https://rubygems.org' - -require 'json' -require 'open-uri' -versions = JSON.parse(open('https://pages.github.com/versions.json').read) +source "https://rubygems.org" -gem 'github-pages', versions['github-pages'] +gem "github-pages", group: :jekyll_plugins ``` -
- -This will ensure that when you run `bundle install`, you -have the correct version of the `github-pages` gem. -If that fails, simplify it: +Be sure to run `bundle update` often. -
-
+
+
GitHub Pages Documentation, Help, and Support
+

+ For more information about what you can do with GitHub Pages, as well as for + troubleshooting guides, you should check out + GitHub’s Pages Help section. + If all else fails, you should contact GitHub Support. +

-```ruby -source 'https://rubygems.org' +### Project Page URL Structure + +Sometimes it's nice to preview your Jekyll site before you push your `gh-pages` +branch to GitHub. However, the subdirectory-like URL structure GitHub uses for +Project Pages complicates the proper resolution of URLs. In order to assure your +site builds properly, use the handy [URL filters](../templates/#filters): -gem 'github-pages' +{% raw %} +```liquid + + + +[{{ page.title }}]("{{ page.url | relative_url }}") ``` -
+{% endraw %} -And be sure to run `bundle update` often. +This way you can preview your site locally from the site root on localhost, +but when GitHub generates your pages from the `gh-pages` branch all the URLs +will resolve properly. -If you like to install `pages-gem` on Windows you can find instructions by Jens Willmer on -[how to install github-pages gem on Windows (x64)](https://jwillmer.de/blog/tutorial/how-to-install-jekyll-and-pages-gem-on-windows-10-x46#github-pages-and-plugins). -
+## Deploying Jekyll to GitHub Pages -
-
Installing github-pages gem on Windows
-

- While Windows is not officially supported, it is possible - to install github-pages gem on Windows. - Special instructions can be found on our - Windows-specific docs page. -

-
+GitHub Pages work by looking at certain branches of repositories on GitHub. +There are two basic types available: [user/organization and project pages](https://help.github.com/articles/user-organization-and-project-pages/). +The way to deploy these two types of sites are nearly identical, except for a +few minor details. ### User and Organization Pages @@ -140,7 +119,7 @@ Please refer to GitHub official documentation on to see more detailed examples.
-
Source Files Must be in the Root Directory
+
Source files must be in the root directory

GitHub Pages overrides the “Site Source” @@ -149,12 +128,13 @@ to see more detailed examples.

-
-
GitHub Pages Documentation, Help, and Support
+
+
Installing the github-pages gem on Windows
+

- For more information about what you can do with GitHub Pages, as well as for - troubleshooting guides, you should check out - GitHub’s Pages Help section. - If all else fails, you should contact GitHub Support. + While Windows is not officially supported, it is possible + to install the github-pages gem on Windows. + Special instructions can be found on our + Windows-specific docs page.

diff --git a/docs/_docs/history.md b/docs/_docs/history.md index d64d0b1c0e5..85e493616af 100644 --- a/docs/_docs/history.md +++ b/docs/_docs/history.md @@ -4,6 +4,119 @@ permalink: "/docs/history/" note: This file is autogenerated. Edit /History.markdown instead. --- +## 3.6.2 / 2017-10-21 +{: #v3-6-2} + +### Development Fixes +{: #development-fixes-v3-6-2} + +- Update Rubocop to 0.51.0 ([#6444]({{ site.repository }}/issues/6444)) +- Add test for layout as string ([#6445]({{ site.repository }}/issues/6445)) + +### Bug Fixes +{: #bug-fixes-v3-6-2} + +- Problematic UTF+bom files ([#6322]({{ site.repository }}/issues/6322)) +- Always treat `data.layout` as a string ([#6442]({{ site.repository }}/issues/6442)) + + +## 3.6.1 / 2017-10-20 +{: #v3-6-1} + +### Documentation + +- Doc y_day in docs/permalinks ([#6244]({{ site.repository }}/issues/6244)) +- Update frontmatter.md ([#6371]({{ site.repository }}/issues/6371)) +- Elaborate on excluding items from processing ([#6136]({{ site.repository }}/issues/6136)) +- Style lists in tables ([#6379]({{ site.repository }}/issues/6379)) +- Remove duplicate "available" ([#6380]({{ site.repository }}/issues/6380)) + +### Development Fixes +{: #development-fixes-v3-6-1} + +- Bump rubocop to use `v0.50.x` ([#6368]({{ site.repository }}/issues/6368)) + + +## 3.6.0 / 2017-09-21 +{: #v3-6-0} + +### Minor Enhancements +{: #minor-enhancements-v3-6-0} + +- Ignore final newline in folded YAML string ([#6054]({{ site.repository }}/issues/6054)) +- Add URL checks to Doctor ([#5760]({{ site.repository }}/issues/5760)) +- Fix serving files that clash with directories ([#6222]({{ site.repository }}/issues/6222)) ([#6231]({{ site.repository }}/issues/6231)) +- Bump supported Ruby version to `>= 2.1.0` ([#6220]({{ site.repository }}/issues/6220)) +- set `LiquidError#template_name` for errors in included file ([#6206]({{ site.repository }}/issues/6206)) +- Access custom config array throughout session ([#6200]({{ site.repository }}/issues/6200)) +- Add support for Rouge 2, in addition to Rouge 1 ([#5919]({{ site.repository }}/issues/5919)) +- Allow `yield` to logger methods & bail early on no-op messages ([#6315]({{ site.repository }}/issues/6315)) +- Update mime-types. ([#6336]({{ site.repository }}/issues/6336)) +- Use a Schwartzian transform with custom sorting ([#6342]({{ site.repository }}/issues/6342)) +- Alias `Drop#invoke_drop` to `Drop#[]` ([#6338]({{ site.repository }}/issues/6338)) + +### Bug Fixes +{: #bug-fixes-v3-6-0} + +- `Deprecator`: fix typo for `--serve` command ([#6229]({{ site.repository }}/issues/6229)) +- `Reader#read_directories`: guard against an entry not being a directory ([#6226]({{ site.repository }}/issues/6226)) +- kramdown: symbolize keys in-place ([#6247]({{ site.repository }}/issues/6247)) +- Call `to_s` on site.url before attempting to concatenate strings ([#6253]({{ site.repository }}/issues/6253)) +- Enforce Style/FrozenStringLiteralComment ([#6265]({{ site.repository }}/issues/6265)) +- Update theme-template README to note 'assets' directory ([#6257]({{ site.repository }}/issues/6257)) +- Memoize the return value of `Document#url` ([#6266]({{ site.repository }}/issues/6266)) +- delegate `StaticFile#to_json` to `StaticFile#to_liquid` ([#6273]({{ site.repository }}/issues/6273)) +- Fix `Drop#key?` so it can handle a nil argument ([#6281]({{ site.repository }}/issues/6281)) +- Guard against type error in absolute url ([#6280]({{ site.repository }}/issues/6280)) +- Mutable drops should fallback to their own methods when a mutation isn't present ([#6350]({{ site.repository }}/issues/6350)) +- Skip adding binary files as posts ([#6344]({{ site.repository }}/issues/6344)) +- Don't break if bundler is not installed ([#6377]({{ site.repository }}/issues/6377)) + +### Documentation + +- Fix a typo in `custom-404-page.md` ([#6218]({{ site.repository }}/issues/6218)) +- Docs: fix links to issues in History.markdown ([#6255]({{ site.repository }}/issues/6255)) +- Update deprecated gems key to plugins. ([#6262]({{ site.repository }}/issues/6262)) +- Fixes minor typo in post text ([#6283]({{ site.repository }}/issues/6283)) +- Execute build command using bundle. ([#6274]({{ site.repository }}/issues/6274)) +- name unification - buddy details ([#6317]({{ site.repository }}/issues/6317)) +- name unification - application index ([#6318]({{ site.repository }}/issues/6318)) +- trim and relocate plugin info across docs ([#6311]({{ site.repository }}/issues/6311)) +- update Jekyll's README ([#6321]({{ site.repository }}/issues/6321)) +- add SUPPORT file for GitHub ([#6324]({{ site.repository }}/issues/6324)) +- Rename CODE_OF_CONDUCT to show in banner ([#6325]({{ site.repository }}/issues/6325)) +- Docs : illustrate page.id for a collection's document ([#6329]({{ site.repository }}/issues/6329)) +- Docs: post's date can be overriden in YAML front matter ([#6334]({{ site.repository }}/issues/6334)) +- Docs: `site.url` behavior on development and production environments ([#6270]({{ site.repository }}/issues/6270)) +- Fix typo in site.url section of variables.md :-[ ([#6337]({{ site.repository }}/issues/6337)) +- Docs: updates ([#6343]({{ site.repository }}/issues/6343)) +- Fix precedence docs ([#6346]({{ site.repository }}/issues/6346)) +- add note to contributing docs about `script/console` ([#6349]({{ site.repository }}/issues/6349)) +- Docs: Fix permalink example ([#6375]({{ site.repository }}/issues/6375)) + +### Site Enhancements +{: #site-enhancements-v3-6-0} + +- Adding DevKit helpers ([#6225]({{ site.repository }}/issues/6225)) +- Customizing url in collection elements clarified ([#6264]({{ site.repository }}/issues/6264)) +- Plugins is the new gems ([#6326]({{ site.repository }}/issues/6326)) + +### Development Fixes +{: #development-fixes-v3-6-0} + +- Strip unnecessary leading whitespace in template ([#6228]({{ site.repository }}/issues/6228)) +- Users should be installing patch versions. ([#6198]({{ site.repository }}/issues/6198)) +- Fix tests ([#6240]({{ site.repository }}/issues/6240)) +- Define path with `__dir__` ([#6087]({{ site.repository }}/issues/6087)) +- exit site.process sooner ([#6239]({{ site.repository }}/issues/6239)) +- make flakey test more robust ([#6277]({{ site.repository }}/issues/6277)) +- Add a quick test for DataReader ([#6284]({{ site.repository }}/issues/6284)) +- script/backport-pr: commit message no longer includes the `#` ([#6289]({{ site.repository }}/issues/6289)) +- Add Add CODEOWNERS file to help automate reviews. ([#6320]({{ site.repository }}/issues/6320)) +- Fix builds on codeclimate ([#6333]({{ site.repository }}/issues/6333)) +- Bump rubies on Travis ([#6366]({{ site.repository }}/issues/6366)) + + ## 3.5.2 / 2017-08-12 {: #v3-5-2} @@ -142,7 +255,7 @@ note: This file is autogenerated. Edit /History.markdown instead. - Be more specific on what to upload ([#6119]({{ site.repository }}/issues/6119)) - Remove Blank Newlines from "Jekyll on Windows" Page ([#6126]({{ site.repository }}/issues/6126)) - Link the troubleshooting page in the quickstart page ([#6134]({{ site.repository }}/issues/6134)) -- add documentation about the &[#34]({{ site.repository }}/issues/34);pinned&[#34]({{ site.repository }}/issues/34); label ([#6147]({{ site.repository }}/issues/6147)) +- add documentation about the "pinned" label ([#6147]({{ site.repository }}/issues/6147)) - docs(JekyllOnWindows): Add a new Installation way ([#6141]({{ site.repository }}/issues/6141)) - corrected windows.md ([#6149]({{ site.repository }}/issues/6149)) - Refine documentation for Windows ([#6153]({{ site.repository }}/issues/6153)) @@ -798,7 +911,7 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Bug Fixes {: #bug-fixes-v3-1-2} -- Fix syntax highlighting in kramdown by making `[@config](https://github.com/config)` accessible in the Markdown converter. ([#4428]({{ site.repository }}/issues/4428)) +- Fix syntax highlighting in kramdown by making `@config` accessible in the Markdown converter. ([#4428]({{ site.repository }}/issues/4428)) - `Jekyll.sanitized_path`: sanitizing a questionable path should handle tildes ([#4492]({{ site.repository }}/issues/4492)) - Fix `titleize` so already capitalized words are not dropped ([#4525]({{ site.repository }}/issues/4525)) - Permalinks which end in a slash should always output HTML ([#4546]({{ site.repository }}/issues/4546)) @@ -881,7 +994,7 @@ note: This file is autogenerated. Edit /History.markdown instead. - Convertible should make layout data accessible via `layout` instead of `page` ([#4205]({{ site.repository }}/issues/4205)) - Avoid using `Dir.glob` with absolute path to allow special characters in the path ([#4150]({{ site.repository }}/issues/4150)) - Handle empty config files ([#4052]({{ site.repository }}/issues/4052)) -- Rename `[@options](https://github.com/options)` so that it does not impact Liquid. ([#4173]({{ site.repository }}/issues/4173)) +- Rename `@options` so that it does not impact Liquid. ([#4173]({{ site.repository }}/issues/4173)) - utils/drops: update Drop to support `Utils.deep_merge_hashes` ([#4289]({{ site.repository }}/issues/4289)) - Make sure jekyll/drops/drop is loaded first. ([#4292]({{ site.repository }}/issues/4292)) - Convertible/Page/Renderer: use payload hash accessor & setter syntax for backwards-compatibility ([#4311]({{ site.repository }}/issues/4311)) @@ -942,7 +1055,7 @@ note: This file is autogenerated. Edit /History.markdown instead. - Add documentation for smartify Liquid filter ([#4333]({{ site.repository }}/issues/4333)) - Fixed broken link to blog on using mathjax with jekyll ([#4344]({{ site.repository }}/issues/4344)) - Documentation: correct reference in Precedence section of Configuration docs ([#4355]({{ site.repository }}/issues/4355)) -- Add [@jmcglone](https://github.com/jmcglone)'s guide to github-pages doc page ([#4364]({{ site.repository }}/issues/4364)) +- Add @jmcglone's guide to github-pages doc page ([#4364]({{ site.repository }}/issues/4364)) - Added the Wordpress2Jekyll Wordpress plugin ([#4377]({{ site.repository }}/issues/4377)) - Add Contentful Extension to list of third-party plugins ([#4390]({{ site.repository }}/issues/4390)) - Correct Minor spelling error ([#4394]({{ site.repository }}/issues/4394)) @@ -1323,7 +1436,7 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Site Enhancements {: #site-enhancements-v2-5-3} -- Add `[@alfredxing](https://github.com/alfredxing)` to the `[@jekyll](https://github.com/jekyll)/core` team. :tada: ([#3218]({{ site.repository }}/issues/3218)) +- Add @alfredxing to the @jekyll/core team. :tada: ([#3218]({{ site.repository }}/issues/3218)) - Document the `-q` option for the `build` and `serve` commands ([#3149]({{ site.repository }}/issues/3149)) - Fix some minor typos/flow fixes in documentation website content ([#3165]({{ site.repository }}/issues/3165)) - Add `keep_files` to configuration documentation ([#3162]({{ site.repository }}/issues/3162)) @@ -1920,7 +2033,7 @@ note: This file is autogenerated. Edit /History.markdown instead. - Fixed typo in datafiles doc page ([#1854]({{ site.repository }}/issues/1854)) - Clarify how to access `site` in docs ([#1864]({{ site.repository }}/issues/1864)) - Add closing `` tag to `context.registers[:site]` note ([#1867]({{ site.repository }}/issues/1867)) -- Fix link to [@mojombo](https://github.com/mojombo)'s site source ([#1897]({{ site.repository }}/issues/1897)) +- Fix link to @mojombo's site source ([#1897]({{ site.repository }}/issues/1897)) - Add `paginate: nil` to default configuration in docs ([#1896]({{ site.repository }}/issues/1896)) - Add link to our License in the site footer ([#1889]({{ site.repository }}/issues/1889)) - Add a charset note in "Writing Posts" doc page ([#1902]({{ site.repository }}/issues/1902)) @@ -2387,7 +2500,7 @@ note: This file is autogenerated. Edit /History.markdown instead. - Add documentation about `paginate_path` to "Templates" page in docs ([#1129]({{ site.repository }}/issues/1129)) - Give the quick-start guide its own page ([#1191]({{ site.repository }}/issues/1191)) - Update ProTip on Installation page in docs to point to all the info about Pygments and the 'highlight' tag. ([#1196]({{ site.repository }}/issues/1196)) -- Run `site/img` through ImageOptim (thanks [@qrush](https://github.com/qrush)!) ([#1208]({{ site.repository }}/issues/1208)) +- Run `site/img` through ImageOptim (thanks @qrush!) ([#1208]({{ site.repository }}/issues/1208)) - Added Jade Converter to `site/docs/plugins` ([#1210]({{ site.repository }}/issues/1210)) - Fix location of docs pages in Contributing pages ([#1214]({{ site.repository }}/issues/1214)) - Add ReadInXMinutes plugin to the plugin list ([#1222]({{ site.repository }}/issues/1222)) @@ -2869,25 +2982,25 @@ note: This file is autogenerated. Edit /History.markdown instead. {: #v0-5-3} - Bug Fixes -- Solving the permalink bug where non-html files wouldn't work ([@jeffrydegrande](https://github.com/jeffrydegrande)) +- Solving the permalink bug where non-html files wouldn't work (@jeffrydegrande) ## 0.5.2 / 2009-06-24 {: #v0-5-2} - Enhancements -- Added --paginate option to the executable along with a paginator object for the payload ([@calavera](https://github.com/calavera)) +- Added --paginate option to the executable along with a paginator object for the payload (@calavera) - Upgraded RedCloth to 4.2.1, which makes `` tags work once again. -- Configuration options set in config.yml are now available through the site payload ([@vilcans](https://github.com/vilcans)) +- Configuration options set in config.yml are now available through the site payload (@vilcans) - Posts can now have an empty YAML front matter or none at all (@ bahuvrihi) - Bug Fixes -- Fixing Ruby 1.9 issue that requires `#to_s` on the err object ([@Chrononaut](https://github.com/Chrononaut)) -- Fixes for pagination and ordering posts on the same day ([@ujh](https://github.com/ujh)) -- Made pages respect permalinks style and permalinks in yml front matter ([@eugenebolshakov](https://github.com/eugenebolshakov)) -- Index.html file should always have index.html permalink ([@eugenebolshakov](https://github.com/eugenebolshakov)) -- Added trailing slash to pretty permalink style so Apache is happy ([@eugenebolshakov](https://github.com/eugenebolshakov)) +- Fixing Ruby 1.9 issue that requires `#to_s` on the err object (@Chrononaut) +- Fixes for pagination and ordering posts on the same day (@ujh) +- Made pages respect permalinks style and permalinks in yml front matter (@eugenebolshakov) +- Index.html file should always have index.html permalink (@eugenebolshakov) +- Added trailing slash to pretty permalink style so Apache is happy (@eugenebolshakov) - Bad markdown processor in config fails sooner and with better message (@ gcnovus) -- Allow CRLFs in yaml front matter ([@juretta](https://github.com/juretta)) +- Allow CRLFs in yaml front matter (@juretta) - Added Date#xmlschema for Ruby versions < 1.9 @@ -2897,15 +3010,15 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Major Enhancements {: #major-enhancements-v0-5-1} -- Next/previous posts in site payload ([@pantulis](https://github.com/pantulis), [@tomo](https://github.com/tomo)) +- Next/previous posts in site payload (@pantulis, @tomo) - Permalink templating system - Moved most of the README out to the GitHub wiki -- Exclude option in configuration so specified files won't be brought over with generated site ([@duritong](https://github.com/duritong)) +- Exclude option in configuration so specified files won't be brought over with generated site (@duritong) - Bug Fixes - Making sure config.yaml references are all gone, using only config.yml -- Fixed syntax highlighting breaking for UTF-8 code ([@henrik](https://github.com/henrik)) -- Worked around RDiscount bug that prevents Markdown from getting parsed after highlight ([@henrik](https://github.com/henrik)) -- CGI escaped post titles ([@Chrononaut](https://github.com/Chrononaut)) +- Fixed syntax highlighting breaking for UTF-8 code (@henrik) +- Worked around RDiscount bug that prevents Markdown from getting parsed after highlight (@henrik) +- CGI escaped post titles (@Chrononaut) ## 0.5.0 / 2009-04-07 @@ -2914,21 +3027,21 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Minor Enhancements {: #minor-enhancements-v0-5-0} -- Ability to set post categories via YAML ([@qrush](https://github.com/qrush)) -- Ability to set prevent a post from publishing via YAML ([@qrush](https://github.com/qrush)) -- Add textilize filter ([@willcodeforfoo](https://github.com/willcodeforfoo)) -- Add 'pretty' permalink style for wordpress-like urls ([@dysinger](https://github.com/dysinger)) -- Made it possible to enter categories from YAML as an array ([@Chrononaut](https://github.com/Chrononaut)) -- Ignore Emacs autosave files ([@Chrononaut](https://github.com/Chrononaut)) +- Ability to set post categories via YAML (@qrush) +- Ability to set prevent a post from publishing via YAML (@qrush) +- Add textilize filter (@willcodeforfoo) +- Add 'pretty' permalink style for wordpress-like urls (@dysinger) +- Made it possible to enter categories from YAML as an array (@Chrononaut) +- Ignore Emacs autosave files (@Chrononaut) - Bug Fixes -- Use block syntax of popen4 to ensure that subprocesses are properly disposed ([@jqr](https://github.com/jqr)) -- Close open4 streams to prevent zombies ([@rtomayko](https://github.com/rtomayko)) -- Only query required fields from the WP Database ([@ariejan](https://github.com/ariejan)) -- Prevent `_posts` from being copied to the destination directory ([@bdimcheff](https://github.com/bdimcheff)) +- Use block syntax of popen4 to ensure that subprocesses are properly disposed (@jqr) +- Close open4 streams to prevent zombies (@rtomayko) +- Only query required fields from the WP Database (@ariejan) +- Prevent `_posts` from being copied to the destination directory (@bdimcheff) - Refactors -- Factored the filtering code into a method ([@Chrononaut](https://github.com/Chrononaut)) -- Fix tests and convert to Shoulda ([@qrush](https://github.com/qrush), [@technicalpickles](https://github.com/technicalpickles)) -- Add Cucumber acceptance test suite ([@qrush](https://github.com/qrush), [@technicalpickles](https://github.com/technicalpickles)) +- Factored the filtering code into a method (@Chrononaut) +- Fix tests and convert to Shoulda (@qrush, @technicalpickles) +- Add Cucumber acceptance test suite (@qrush, @technicalpickles) ## 0.4.1 @@ -2936,9 +3049,9 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Minor Enhancements {: #minor-enhancements-v--} -- Changed date format on wordpress converter (zeropadding) ([@dysinger](https://github.com/dysinger)) +- Changed date format on wordpress converter (zeropadding) (@dysinger) - Bug Fixes -- Add Jekyll binary as executable to gemspec ([@dysinger](https://github.com/dysinger)) +- Add Jekyll binary as executable to gemspec (@dysinger) ## 0.4.0 / 2009-02-03 @@ -2952,20 +3065,20 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Minor Enhancements {: #minor-enhancements-v0-4-0} -- Type importer ([@codeslinger](https://github.com/codeslinger)) -- `site.topics` accessor ([@baz](https://github.com/baz)) -- Add `array_to_sentence_string` filter ([@mchung](https://github.com/mchung)) -- Add a converter for textpattern ([@PerfectlyNormal](https://github.com/PerfectlyNormal)) -- Add a working Mephisto / MySQL converter ([@ivey](https://github.com/ivey)) -- Allowing .htaccess files to be copied over into the generated site ([@briandoll](https://github.com/briandoll)) -- Add option to not put file date in permalink URL ([@mreid](https://github.com/mreid)) -- Add line number capabilities to highlight blocks ([@jcon](https://github.com/jcon)) +- Type importer (@codeslinger) +- `site.topics` accessor (@baz) +- Add `array_to_sentence_string` filter (@mchung) +- Add a converter for textpattern (@PerfectlyNormal) +- Add a working Mephisto / MySQL converter (@ivey) +- Allowing .htaccess files to be copied over into the generated site (@briandoll) +- Add option to not put file date in permalink URL (@mreid) +- Add line number capabilities to highlight blocks (@jcon) - Bug Fixes -- Fix permalink behavior ([@cavalle](https://github.com/cavalle)) -- Fixed an issue with pygments, markdown, and newlines ([@zpinter](https://github.com/zpinter)) -- Ampersands need to be escaped ([@pufuwozu](https://github.com/pufuwozu), [@ap](https://github.com/ap)) -- Test and fix the site.categories hash ([@zzot](https://github.com/zzot)) -- Fix site payload available to files ([@matrix9180](https://github.com/matrix9180)) +- Fix permalink behavior (@cavalle) +- Fixed an issue with pygments, markdown, and newlines (@zpinter) +- Ampersands need to be escaped (@pufuwozu, @ap) +- Test and fix the site.categories hash (@zzot) +- Fix site payload available to files (@matrix9180) ## 0.3.0 / 2008-12-24 @@ -2974,19 +3087,19 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Major Enhancements {: #major-enhancements-v0-3-0} -- Added `--server` option to start a simple WEBrick server on destination directory ([@johnreilly](https://github.com/johnreilly) and [@mchung](https://github.com/mchung)) +- Added `--server` option to start a simple WEBrick server on destination directory (@johnreilly and @mchung) ### Minor Enhancements {: #minor-enhancements-v0-3-0} -- Added post categories based on directories containing `_posts` ([@mreid](https://github.com/mreid)) +- Added post categories based on directories containing `_posts` (@mreid) - Added post topics based on directories underneath `_posts` -- Added new date filter that shows the full month name ([@mreid](https://github.com/mreid)) -- Merge Post's YAML front matter into its to_liquid payload ([@remi](https://github.com/remi)) +- Added new date filter that shows the full month name (@mreid) +- Merge Post's YAML front matter into its to_liquid payload (@remi) - Restrict includes to regular files underneath `_includes` - Bug Fixes -- Change YAML delimiter matcher so as to not chew up 2nd level markdown headers ([@mreid](https://github.com/mreid)) -- Fix bug that meant page data (such as the date) was not available in templates ([@mreid](https://github.com/mreid)) +- Change YAML delimiter matcher so as to not chew up 2nd level markdown headers (@mreid) +- Fix bug that meant page data (such as the date) was not available in templates (@mreid) - Properly reject directories in `_layouts` @@ -2994,13 +3107,13 @@ note: This file is autogenerated. Edit /History.markdown instead. {: #v0-2-1} - Major Changes -- Use Maruku (pure Ruby) for Markdown by default ([@mreid](https://github.com/mreid)) +- Use Maruku (pure Ruby) for Markdown by default (@mreid) - Allow use of RDiscount with `--rdiscount` flag ### Minor Enhancements {: #minor-enhancements-v0-2-1} -- Don't load directory_watcher unless it's needed ([@pjhyett](https://github.com/pjhyett)) +- Don't load directory_watcher unless it's needed (@pjhyett) ## 0.2.0 / 2008-12-14 @@ -3029,10 +3142,10 @@ note: This file is autogenerated. Edit /History.markdown instead. ### Minor Enhancements {: #minor-enhancements-v0-1-5} -- Output informative message if RDiscount is not available ([@JackDanger](https://github.com/JackDanger)) +- Output informative message if RDiscount is not available (@JackDanger) - Bug Fixes -- Prevent Jekyll from picking up the output directory as a source ([@JackDanger](https://github.com/JackDanger)) -- Skip `related_posts` when there is only one post ([@JackDanger](https://github.com/JackDanger)) +- Prevent Jekyll from picking up the output directory as a source (@JackDanger) +- Skip `related_posts` when there is only one post (@JackDanger) ## 0.1.4 / 2008-12-08 @@ -3046,12 +3159,12 @@ note: This file is autogenerated. Edit /History.markdown instead. {: #v0-1-3} - Major Features -- Markdown support ([@vanpelt](https://github.com/vanpelt)) -- Mephisto and CSV converters ([@vanpelt](https://github.com/vanpelt)) -- Code hilighting ([@vanpelt](https://github.com/vanpelt)) +- Markdown support (@vanpelt) +- Mephisto and CSV converters (@vanpelt) +- Code hilighting (@vanpelt) - Autobuild - Bug Fixes -- Accept both `\r\n` and `\n` in YAML header ([@vanpelt](https://github.com/vanpelt)) +- Accept both `\r\n` and `\n` in YAML header (@vanpelt) ## 0.1.2 / 2008-11-22 diff --git a/docs/_docs/includes.md b/docs/_docs/includes.md index b7eb17cc4a2..948720474ab 100644 --- a/docs/_docs/includes.md +++ b/docs/_docs/includes.md @@ -5,9 +5,11 @@ permalink: /docs/includes/ The `include` tag allows you to include the content from another file stored in the `_includes` folder: +{% raw %} ```liquid -{% raw %}{% include footer.html %}{% endraw %} +{% include footer.html %} ``` +{% endraw %} Jekyll will look for the referenced file (in this case, `footer.html`) in the `_includes` directory at the root of your source directory and insert its contents. @@ -15,9 +17,11 @@ Jekyll will look for the referenced file (in this case, `footer.html`) in the `_ You can choose to include file fragments relative to the current file by using the `include_relative` tag: +{% raw %} ```liquid -{% raw %}{% include_relative somedir/footer.html %}{% endraw %} +{% include_relative somedir/footer.html %} ``` +{% endraw %} You won't need to place your included content within the `_includes` directory. Instead, the inclusion is specifically relative to the file where the tag is being used. For example, @@ -42,9 +46,11 @@ my_variable: footer_company_a.html You could then reference that variable in your include: +{% raw %} ```liquid -{% raw %}{% include {{ page.my_variable }} %}{% endraw %} +{% include {{ page.my_variable }} %} ``` +{% endraw %} In this example, the include would insert the file `footer_company_a.html` from the `_includes/footer_company_a.html` directory. @@ -52,18 +58,22 @@ In this example, the include would insert the file `footer_company_a.html` from You can also pass parameters to an include. For example, suppose you have a file called `note.html` in your `_includes` folder that contains this formatting: +{% raw %} ```liquid -{% raw %} ``` +{% endraw %} The `{% raw %}{{ include.content }}{% endraw %}` is a parameter that gets populated when you call the include and specify a value for that parameter, like this: +{% raw %} ```liquid -{% raw %}{% include note.html content="This is my sample note." %} {% endraw %} +{% include note.html content="This is my sample note." %} ``` +{% endraw %} The value of `content` (which is `This is my sample note`) will be inserted into the {% raw %}`{{ include.content }}`{% endraw %} parameter. @@ -82,14 +92,16 @@ For example, suppose you have a special image syntax with complex formatting, an You could templatize this content in your include and make each value available as a parameter, like this: +{% raw %} ```liquid -{% raw %}
+
{{ include.alt }}
{{ include.caption }}
-
{% endraw %} +
``` +{% endraw %} This include contains 5 parameters: @@ -101,15 +113,17 @@ This include contains 5 parameters: Here's an example that passes all the parameters to this include (the include file is named `image.html`): +{% raw %} ```liquid -{% raw %}{% include image.html url="http://jekyllrb.com" +{% include image.html url="http://jekyllrb.com" max-width="200px" file="logo.png" alt="Jekyll logo" -caption="This is the Jekyll logo." %} {% endraw %} +caption="This is the Jekyll logo." %} ``` +{% endraw %} The result is the original HTML code shown earlier. -To safeguard situations where users don't supply a value for the parameter, you can use [Liquid's default filter](https://help.shopify.com/themes/liquid/filters/additional-filters#default). +To safeguard situations where users don't supply a value for the parameter, you can use [Liquid's default filter](https://shopify.github.io/liquid/filters/default/). Overall, you can create includes that act as templates for a variety of uses — inserting audio or video clips, alerts, special formatting, and more. However, note that you should avoid using too many includes, as this will slow down the build time of your site. For example, don't use includes every time you insert an image. (The above technique shows a use case for special images.) @@ -121,16 +135,21 @@ The string you pass to your include parameter can't contain curly braces. For ex If you want to include this variable in your parameter that you pass to an include, you need to store the entire parameter as a variable before passing it to the include. You can use `capture` tags to create the variable: +{% raw %} ```liquid -{% raw %}{% capture download_note %}The latest version of -{{ site.product_name }} is now available.{% endcapture %}{% endraw %} +{% capture download_note %} +The latest version of {{ site.product_name }} is now available. +{% endcapture %} ``` +{% endraw %} Then pass this captured variable into the parameter for the include. Omit the quotation marks around the parameter content because it's no longer a string (it's a variable): +{% raw %} ```liquid -{% raw %}{% include note.html content=download_note %}{% endraw %} +{% include note.html content=download_note %} ``` +{% endraw %} ### Passing references to YAML files as parameter values @@ -150,18 +169,22 @@ Here's an example. In the `_data` folder, suppose you have a YAML file called `p In the `_includes` folder, assume you have a file called `spotlight.html` with this code: +{% raw %} ```liquid -{% raw %}{% for person in include.participants %} +{% for person in include.participants %} {% if person.login_age == "new" %} {{ person.name }} {% endif %} -{% endfor %}{% endraw %} +{% endfor %} ``` +{% endraw %} Now when you insert the `spotlight.html` include file, you can submit the YAML file as a parameter: +{% raw %} +```liquid +{% include spotlight.html participants=site.data.profiles %} ``` -{% raw %}{% include spotlight.html participants=site.data.profiles %}{% endraw %} -``` +{% endraw %} In this instance, `site.data.profiles` gets inserted in place of {% raw %}`include.participants`{% endraw %} in the include file, and the Liquid logic processes. The result will be `Jane Doe`. diff --git a/docs/_docs/index.md b/docs/_docs/index.md index ff5e8ccedcf..f5077201d0a 100644 --- a/docs/_docs/index.md +++ b/docs/_docs/index.md @@ -15,7 +15,7 @@ development of Jekyll itself. Jekyll is a simple, blog-aware, static site generator. It takes a template directory containing raw text files in various formats, runs it through a converter (like [Markdown](https://daringfireball.net/projects/markdown/)) -and our [Liquid](https://github.com/Shopify/liquid/wiki) renderer, and +and our [Liquid](https://shopify.github.io/liquid/) renderer, and spits out a complete, ready-to-publish static website suitable for serving with your favorite web server. Jekyll also happens to be the engine behind [GitHub Pages](https://pages.github.com), which means you can use Jekyll diff --git a/docs/_docs/installation.md b/docs/_docs/installation.md index 659becc9603..62377b698bd 100644 --- a/docs/_docs/installation.md +++ b/docs/_docs/installation.md @@ -49,7 +49,7 @@ The best way to install Jekyll is via simply run the following command to install Jekyll: ```sh -$ gem install jekyll +gem install jekyll ``` All of Jekyll’s gem dependencies are automatically installed by the above @@ -86,11 +86,11 @@ more involved. This gives you the advantage of having the latest and greatest, but may be unstable. ```sh -$ git clone git://github.com/jekyll/jekyll.git -$ cd jekyll -$ script/bootstrap -$ bundle exec rake build -$ ls pkg/*.gem | head -n 1 | xargs gem install -l +git clone git://github.com/jekyll/jekyll.git +cd jekyll +script/bootstrap +bundle exec rake build +ls pkg/*.gem | head -n 1 | xargs gem install -l ``` ## Optional Extras @@ -116,20 +116,29 @@ Check out [the extras page](../extras/) for more information. Before you start developing with Jekyll, you may want to check that you're up to date with the latest version. To find your version of Jekyll, run one of these commands: ```sh -$ jekyll --version -$ gem list jekyll +jekyll --version +gem list jekyll ``` You can also use [RubyGems](https://rubygems.org/gems/jekyll) to find the current versioning of any gem. But you can also use the `gem` command line tool: ```sh -$ gem search jekyll --remote +gem search jekyll --remote ``` and you'll search for just the name `jekyll`, and in brackets will be latest version. Another way to check if you have the latest version is to run the command `gem outdated`. This will provide a list of all the gems on your system that need to be updated. If you aren't running the latest version, run this command: ```sh -$ gem update jekyll +bundle update jekyll ``` +Alternatively, if you don't have Bundler installed run: + +```sh +gem update jekyll +``` + +Please refer to our [upgrading section](../upgrading/) for major updates +detailed instructions. + Now that you’ve got everything up-to-date and installed, let’s get to work! diff --git a/docs/_docs/pages.md b/docs/_docs/pages.md index 398d1987d1b..8852bc32b8e 100644 --- a/docs/_docs/pages.md +++ b/docs/_docs/pages.md @@ -60,7 +60,7 @@ If you have a lot of pages, you can organize those pages into subfolders. The sa If you have pages organized into subfolders in your source folder and want to flatten them in the root folder on build, you must add the [permalink]({% link _docs/permalinks.md %}) property directly in your page's front matter like this: -``` +```yaml --- title: My page permalink: mypageurl.html diff --git a/docs/_docs/pagination.md b/docs/_docs/pagination.md index c60b47e0360..41a3a8a26e5 100644 --- a/docs/_docs/pagination.md +++ b/docs/_docs/pagination.md @@ -24,7 +24,7 @@ your `_config.yml` under `plugins`. For Jekyll 2, this is standard. ## Enable pagination -To enable pagination for your blog, add a line to the `_config.yml` file that +To enable pagination for posts on your blog, add a line to the `_config.yml` file that specifies how many items should be displayed per page: ```yaml @@ -55,6 +55,14 @@ directory.

+
+
Pagination for categories, tags and collections
+

+ The more recent jekyll-paginate-v2 plugin supports more features. See the pagination examples in the repository. + This plugin is not supported by GitHub Pages. +

+
+ ## Liquid Attributes Available The pagination plugin exposes the `paginator` liquid object with the following @@ -145,8 +153,8 @@ the `paginator` variable that will now be available to you. You’ll probably want to do this in one of the main pages of your site. Here’s one example of a simple way of rendering paginated Posts in a HTML file: -```html {% raw %} +```liquid --- layout: default title: My Blog @@ -177,8 +185,8 @@ title: My Blog Next {% endif %}
-{% endraw %} ``` +{% endraw %}
Beware the page one edge-case
@@ -192,8 +200,8 @@ title: My Blog The following HTML snippet should handle page one, and render a list of each page with links to all but the current page. -```html {% raw %} +```liquid {% if paginator.total_pages > 1 %} {% endif %} -{% endraw %} ``` +{% endraw %} diff --git a/docs/_docs/permalinks.md b/docs/_docs/permalinks.md index 42e68e85ff8..8b4576eef49 100644 --- a/docs/_docs/permalinks.md +++ b/docs/_docs/permalinks.md @@ -116,6 +116,14 @@ The following table lists the template variables available for permalinks. You c

+ + +

y_day

+ _ + +

Day of the year from the post's filename, with leading zeros.

+ +

short_year

@@ -322,7 +330,7 @@ The permalink setting in your configuration file specifies the permalink style u For example: -* A permalink style of `/:categories/:year/:month/:day/:title.html` for posts becomes `/:title.html` for pages and collections. +* A permalink style of `/:categories/:year/:month/:day/:title.:output_ext` for posts becomes `/:title.html` for pages and collections. * A permalink style of `pretty` (or `/:categories/:year/:month/:day/:title/`), which omits the file extension and contains a trailing slash, will update page and collection permalinks to also omit the file extension and contain a trailing slash: `/:title/`. * A permalink style of `date`, which contains a trailing file extension, will update page permalinks to also contain a trailing file extension: `/:title.html`. But no time or category information will be included. @@ -346,13 +354,13 @@ As with posts, if you use a permalink style that omits the `.html` file extensio By default, collections follow a similar structure in the `_site` folder as pages, except that the path is prefaced by the collection name. For example: `collectionname/mypage.html`. For permalink settings that omit the file extension, the path would be `collection_name/mypage/index.html`. -Collections have their own way of setting permalinks. Additionally, collections have unique template variables available available (such as `path` and `output_ext`). See the [Configuring permalinks for collections](../collections/#permalinks) in Collections for more information. +Collections have their own way of setting permalinks. Additionally, collections have unique template variables available (such as `path` and `output_ext`). See the [Configuring permalinks for collections](../collections/#permalinks) in Collections for more information. ## Flattening pages in \_site on build If you want to flatten your pages (pull them out of subfolders) in the `_site` directory when your site builds (similar to posts), add the `permalink` property to the front matter of each page, with no path specified: -``` +```yaml --- title: My page permalink: mypageurl.html diff --git a/docs/_docs/plugins.md b/docs/_docs/plugins.md index ae55aa23d01..0c1c24d0618 100644 --- a/docs/_docs/plugins.md +++ b/docs/_docs/plugins.md @@ -25,32 +25,36 @@ having to modify the Jekyll source itself. You have 3 options for installing plugins: 1. In your site source root, make a `_plugins` directory. Place your plugins -here. Any file ending in `*.rb` inside this directory will be loaded before -Jekyll generates your site. -2. In your `_config.yml` file, add a new array with the key `plugins` and the -values of the gem names of the plugins you'd like to use. An example: + here. Any file ending in `*.rb` inside this directory will be loaded before + Jekyll generates your site. +2. In your `_config.yml` file, add a new array with the key `plugins` and the + values of the gem names of the plugins you'd like to use. An example: - plugins: - - jekyll-gist - - jekyll-coffeescript - - jekyll-assets - - another-jekyll-plugin - # This will require each of these plugins automatically. + ```yaml + # This will require each of these plugins automatically. + plugins: + - jekyll-gist + - jekyll-coffeescript + - jekyll-assets + - another-jekyll-plugin + ``` - Then install your plugins using `gem install jekyll-gist jekyll-coffeescript jekyll-assets another-jekyll-plugin` + Then install your plugins using `gem install jekyll-gist jekyll-coffeescript jekyll-assets another-jekyll-plugin` 3. Add the relevant plugins to a Bundler group in your `Gemfile`. An - example: - - group :jekyll_plugins do - gem "jekyll-gist" - gem "jekyll-coffeescript" - gem "jekyll-assets" - gem "another-jekyll-plugin" - end + example: + + ```ruby + group :jekyll_plugins do + gem "jekyll-gist" + gem "jekyll-coffeescript" + gem "jekyll-assets" + gem "another-jekyll-plugin" + end + ``` - Now you need to install all plugins from your Bundler group by running single command `bundle install`. + Now you need to install all plugins from your Bundler group by running single command `bundle install`.
@@ -64,6 +68,24 @@ values of the gem names of the plugins you'd like to use. An example:

+### The jekyll_plugins group + +Jekyll gives this particular group of gems in your `Gemfile` a different +treatment. Any gem included in this group is loaded before Jekyll starts +processing the rest of your source directory. + +A gem included here will be activated even if its not explicitly listed under +the `plugins:` key in your site's config file. + +
+

+ Gems included in the :jekyll-plugins group are activated + regardless of the --safe mode setting. Be aware of what + gems are included under this group! +

+
+ + In general, plugins you make will fall broadly into one of five categories: 1. [Generators](#generators) @@ -117,7 +139,6 @@ This is a more complex generator that generates new pages: ```ruby module Jekyll - class CategoryPage < Page def initialize(site, base, dir, category) @site = site @@ -146,7 +167,6 @@ module Jekyll end end end - end ``` @@ -385,11 +405,11 @@ Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag) In the example above, we can place the following tag anywhere in one of our pages: -```ruby {% raw %} +```ruby

{% render_time page rendered at: %}

-{% endraw %} ``` +{% endraw %} And we would get something like this on the page: @@ -885,6 +905,7 @@ You can find a few useful plugins at the following locations: - [Jekyll If File Exists](https://github.com/k-funk/jekyll-if-file-exists): A Jekyll Plugin that checks if a file exists with an if/else block. - [BibSonomy](https://github.com/rjoberon/bibsonomy-jekyll): Jekyll plugin to generate publication lists from [BibSonomy](https://www.bibsonomy.org/). +- [github-cards](https://github.com/edward-shen/github-cards): Creates styleable Github cards for your Github projects. #### Collections diff --git a/docs/_docs/posts.md b/docs/_docs/posts.md index e3a749d5a5e..854fb665335 100644 --- a/docs/_docs/posts.md +++ b/docs/_docs/posts.md @@ -26,7 +26,7 @@ To create a new post, all you need to do is create a file in the `_posts` directory. How you name files in this folder is important. Jekyll requires blog post files to be named according to the following format: -```sh +``` YEAR-MONTH-DAY-title.MARKUP ``` @@ -34,7 +34,7 @@ Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. For example, the following are examples of valid post filenames: -```sh +``` 2011-12-31-new-years-eve-is-awesome.md 2012-09-12-how-to-write-a-blog.md ``` @@ -78,55 +78,54 @@ digital assets along with your text content. While the syntax for linking to these resources differs between Markdown and Textile, the problem of working out where to store these files in your site is something everyone will face. -There are a number of ways to include digital assets in Jekyll. +There are a number of ways to include digital assets in Jekyll. One common solution is to create a folder in the root of the project directory -called something like `assets` or `downloads`, into which any images, downloads +called something like `assets`, into which any images, files or other resources are placed. Then, from within any post, they can be linked to using the site’s root as the path for the asset to include. Again, this will depend on the way your site’s (sub)domain and path are configured, but here are -some examples (in Markdown) of how you could do this using the `site.url` -variable in a post. +some examples in Markdown of how you could do this using the `absolute_url` +filter in a post. Including an image asset in a post: -```text +{% raw %} +```markdown ... which is shown in the screenshot below: -![My helpful screenshot]({% raw %}{{ site.url }}{% endraw %}/assets/screenshot.jpg) +![My helpful screenshot]({{ "/assets/screenshot.jpg" | absolute_url }}) ``` +{% endraw %} Linking to a PDF for readers to download: -```text -... you can [get the PDF]({% raw %}{{ site.url }}{% endraw %}/assets/mydoc.pdf) directly. +{% raw %} +```markdown +... you can [get the PDF]({{ "/assets/mydoc.pdf" | absolute_url }}) directly. ``` +{% endraw %} + +
-
-
ProTip™: Link using just the site root URL
-

- You can skip the {% raw %}{{ site.url }}{% endraw %} variable - if you know your site will only ever be displayed at the - root URL of your domain. In this case you can reference assets directly with - just /path/file.jpg. -

## A typical post Jekyll can handle many different iterations of the idea you might associate with a "post," however a standard blog style post, including a Title, Layout, Publishing Date, and Categories might look like this: -``` +```markdown --- layout: post title: "Welcome to Jekyll!" date: 2015-11-17 16:16:01 -0600 categories: jekyll update --- + You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `bundle exec jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works. - ``` -Everything in between the first and second `---` are part of the YAML Front Matter, and everything after the second `---` will be rendered with Markdown and show up as "Content." + +Everything in between the first and second `---` are part of the YAML Front Matter, and everything after the second `---` will be rendered with Markdown and show up as "Content". ## Displaying an index of posts @@ -136,15 +135,17 @@ you have a list of posts somewhere. Creating an index of posts on another page language](https://docs.shopify.com/themes/liquid/basics) and its tags. Here’s a basic example of how to create a list of links to your blog posts: +{% raw %} ```html ``` +{% endraw %} Of course, you have full control over how (and where) you display your posts, and how you structure your site. You should read more about [how templates @@ -155,6 +156,54 @@ you wish to access the currently-rendering page/posts's variables (the variables of the post/page that has the `for` loop in it), use the `page` variable instead. +## Displaying post categories or tags + +Hey, that's pretty neat, but what about showing just some of your posts that are +related to each other? For that you can use any of the [variables definable in +Front Matter](https://jekyllrb.com/docs/frontmatter/). In the "typical post" +section you can see how to define categories. Simply add the categories to your +Front Matter as a [yaml +list](https://en.wikipedia.org/wiki/YAML#Basic_components). + +Now that your posts have a category or multiple categories, you can make a page +or a template displaying just the posts in those categories you specify. Here's +a basic example of how to create a list of posts from a specific category. + +First, in the `_layouts` directory create a new file called `category.html` - in +that file put (at least) the following: + +{% raw %} +```liquid +--- +layout: page +--- + +{% for post in site.categories[page.category] %} + + {{ post.title }} + +{% endfor %} +``` +{% endraw %} + +Next, in the root directory of your Jekyll install, create a new directory +called `category` and then create a file for each category you want to list. For +example, if you have a category `blog` then create a file in the new directory +called `blog.html` with at least + +```yaml +--- +layout: category +title: Blog +category: blog +--- +``` + +In this case, the listing pages will be accessible at `{baseurl}/category/blog.html` + +While this example is done with categories, you can easily extend your lists to +filter by tags or any other variable created with extensions. + ## Post excerpts Each post automatically takes the first block of text, from the beginning of @@ -163,31 +212,35 @@ Take the above example of an index of posts. Perhaps you want to include a little hint about the post's content by adding the first paragraph of each of your posts: -```html +{% raw %} +```liquid ``` +{% endraw %} Because Jekyll grabs the first paragraph you will not need to wrap the excerpt in `p` tags, which is already done for you. These tags can be removed with the following if you'd prefer: -```html -{% raw %}{{ post.excerpt | remove: '

' | remove: '

' }}{% endraw %} +{% raw %} +```liquid +{{ post.excerpt | remove: '

' | remove: '

' }} ``` +{% endraw %} If you don't like the automatically-generated post excerpt, it can be explicitly overridden by adding an `excerpt` value to your post's YAML Front Matter. Alternatively, you can choose to define a custom `excerpt_separator` in the post's YAML front matter: -```text +```yaml --- excerpt_separator: --- @@ -214,8 +267,9 @@ Jekyll also has built-in support for syntax highlighting of code snippets using either Pygments or Rouge, and including a code snippet in any post is easy. Just use the dedicated Liquid tag as follows: -```text -{% raw %}{% highlight ruby %}{% endraw %} +{% raw %} +```liquid +{% highlight ruby %} def show @widget = Widget(params[:id]) respond_to do |format| @@ -223,8 +277,9 @@ def show format.json { render json: @widget } end end -{% raw %}{% endhighlight %}{% endraw %} +{% endhighlight %} ``` +{% endraw %} And the output will look like this: diff --git a/docs/_docs/quickstart.md b/docs/_docs/quickstart.md index 08d2fd5f620..024e9839cff 100644 --- a/docs/_docs/quickstart.md +++ b/docs/_docs/quickstart.md @@ -8,16 +8,16 @@ If you already have a full [Ruby](https://www.ruby-lang.org/en/downloads/) devel ```sh # Install Jekyll and Bundler gems through RubyGems -~ $ gem install jekyll bundler +gem install jekyll bundler # Create a new Jekyll site at ./myblog -~ $ jekyll new myblog +jekyll new myblog # Change into your new directory -~ $ cd myblog +cd myblog # Build the site on the preview server -~/myblog $ bundle exec jekyll serve +bundle exec jekyll serve # Now browse to http://localhost:4000 ``` diff --git a/docs/_docs/resources.md b/docs/_docs/resources.md index 24a9ab49739..d2a15c8ff8e 100644 --- a/docs/_docs/resources.md +++ b/docs/_docs/resources.md @@ -31,6 +31,7 @@ Jekyll's growing use is producing a wide variety of tutorials, frameworks, exten - [FormKeep](https://formkeep.com/guides/contact-form-jekyll?utm_source=github&utm_medium=jekyll-docs&utm_campaign=contact-form-jekyll) - [Simple Form](https://getsimpleform.com/) - [Formingo](https://www.formingo.co/guides/jekyll?utm_source=github&utm_medium=jekyll-docs&utm_campaign=Jekyll%20Documentation) + - [Formester](http://www.formester.com) - [Staticman](https://staticman.net): Add user-generated content to a Jekyll site (free and open source) - [Snipcart](https://snipcart.com/blog/static-site-e-commerce-part-2-integrating-snipcart-with-jekyll): Add a shopping cart to a Jekyll site - [Contentful](https://www.contentful.com/ecosystem/jekyll/): use Jekyll together with the API-driven Contentful CMS. diff --git a/docs/_docs/static_files.md b/docs/_docs/static_files.md index a4dda58892d..7b712c13505 100644 --- a/docs/_docs/static_files.md +++ b/docs/_docs/static_files.md @@ -66,13 +66,13 @@ following metadata:
-Note that in the above table, `file` can be anything. It's simply an arbitrarily set variable used in your own logic (such as in a for loop). It isn't a global site or page variable. +Note that in the above table, `file` can be anything. It's simply an arbitrarily set variable used in your own logic (such as in a for loop). It isn't a global site or page variable. ## Add front matter to static files -Although you can't directly add front matter values to static files, you can set front matter values through the [defaults property](../configuration/#front-matter-defaults) in your configuration file. When Jekyll builds the site, it will use the front matter values you set. +Although you can't directly add front matter values to static files, you can set front matter values through the [defaults property](../configuration/#front-matter-defaults) in your configuration file. When Jekyll builds the site, it will use the front matter values you set. -Here's an example: +Here's an example: In your `_config.yml` file, add the following values to the `defaults` property: @@ -88,11 +88,13 @@ This assumes that your Jekyll site has a folder path of `assets/img` where you Suppose you want to list all your image assets as contained in `assets/img`. You could use this for loop to look in the `static_files` object and get all static files that have this front matter property: +{% raw %} ```liquid -{% raw %}{% assign image_files = site.static_files | where: "image", true %} +{% assign image_files = site.static_files | where: "image", true %} {% for myimage in image_files %} {{ myimage.path }} -{% endfor %}{% endraw %} +{% endfor %} ``` +{% endraw %} When you build your site, the output will list the path to each file that meets this front matter condition. diff --git a/docs/_docs/support.md b/docs/_docs/support.md new file mode 100644 index 00000000000..d22331879e1 --- /dev/null +++ b/docs/_docs/support.md @@ -0,0 +1,24 @@ +--- +title: Support +permalink: "/docs/support/" +note: This file is autogenerated. Edit /.github/SUPPORT.markdown instead. +--- + +## Getting Help + +**Jekyll's issue tracker is not a support forum.** + +If you're looking for support for Jekyll, there are a lot of options: + +* Read [Jekyll Documentation](https://jekyllrb.com/docs/home/) +* If you have a question about using Jekyll, start a discussion on [Jekyll Forum](https://talk.jekyllrb.com/) or [StackOverflow](https://stackoverflow.com/questions/tagged/jekyll) +* Chat with Jekyllers — Join [our Gitter channel](https://gitter.im/jekyll/jekyll) or [our IRC channel on Freenode](irc:irc.freenode.net/jekyll) + +There are a bunch of helpful community members on these services that should be willing to point you in the right direction. + +## Report a bug + +* If you think you've found a bug within a Jekyll plugin, open an issue in that plugin's repository — First [look for the plugin on rubygems](https://rubygems.org/) then click on the `Homepage` link to access the plugin repository. +* If you think you've found a bug within Jekyll itself, [open an issue](https://github.com/jekyll/jekyll/issues/new). + +Happy Jekyllin'! diff --git a/docs/_docs/templates.md b/docs/_docs/templates.md index c37b93b5b97..81eb5b2a696 100644 --- a/docs/_docs/templates.md +++ b/docs/_docs/templates.md @@ -293,6 +293,18 @@ you come up with your own tags via plugins.

the-_config.yml-file

+

+ {% raw %}{{ "The _cönfig.yml file" | slugify: 'ascii' }}{% endraw %} +

+

+ the-c-nfig-yml-file +

+

+ {% raw %}{{ "The cönfig.yml file" | slugify: 'latin' }}{% endraw %} +

+

+ the-config-yml-file +

@@ -416,6 +428,8 @@ The default is `default`. They are as follows (with what they filter): - `raw`: spaces - `default`: spaces and non-alphanumeric characters - `pretty`: spaces and non-alphanumeric characters except for `._~!$&'()+,;=@` +- `ascii`: spaces, non-alphanumeric, and non-ASCII characters +- `latin`: like `default`, except Latin characters are first transliterated (e.g. `àèïòü` to `aeiou`) ## Tags @@ -428,9 +442,11 @@ The default is `default`. They are as follows (with what they filter): If you have small page snippets that you want to include in multiple places on your site, save the snippets as *include files* and insert them where required, by using the `include` tag: +{% raw %} ```liquid -{% raw %}{% include footer.html %}{% endraw %} +{% include footer.html %} ``` +{% endraw %} Jekyll expects all *include files* to be placed in an `_includes` directory at the root of your source directory. In the above example, this will embed the contents of `_includes/footer.html` into the calling file. @@ -451,15 +467,15 @@ languages](http://pygments.org/languages/) To render a code block with syntax highlighting, surround your code as follows: -```liquid {% raw %} +```liquid {% highlight ruby %} def foo puts 'foo' end {% endhighlight %} -{% endraw %} ``` +{% endraw %} The argument to the `highlight` tag (`ruby` in the example above) is the language identifier. To find the appropriate identifier to use for the language @@ -467,6 +483,13 @@ you want to highlight, look for the “short name” on the [Rouge wiki](https://github.com/jayferd/rouge/wiki/List-of-supported-languages-and-lexers) or the [Pygments' Lexers page](http://pygments.org/docs/lexers/). +
+
Jekyll processes all Liquid filters in code blocks
+

If you are using a language that contains curly braces, you + will likely need to place {% raw %} and + {% endraw %} tags around your code.

+
+ #### Line numbers There is a second argument to `highlight` called `linenos` that is optional. @@ -474,15 +497,15 @@ Including the `linenos` argument will force the highlighted code to include line numbers. For instance, the following code block would include line numbers next to each line: -```liquid {% raw %} +```liquid {% highlight ruby linenos %} def foo puts 'foo' end {% endhighlight %} -{% endraw %} ``` +{% endraw %} #### Stylesheets for syntax highlighting @@ -503,25 +526,25 @@ To link to a post, a page, collection item, or file, the `link` tag will generat You must include the file's original extension when using the `link` tag. Here are some examples: -```liquid {% raw %} +```liquid {{ site.baseurl }}{% link _collection/name-of-document.md %} {{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %} {{ site.baseurl }}{% link news/index.html %} {{ site.baseurl }}{% link /assets/files/doc.pdf %} -{% endraw %} ``` +{% endraw %} You can also use the `link` tag to create a link in Markdown as follows: -```liquid {% raw %} +```liquid [Link to a document]({{ site.baseurl }}{% link _collection/name-of-document.md %}) [Link to a post]({{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %}) [Link to a page]({{ site.baseurl }}{% link news/index.html %}) [Link to a file]({{ site.baseurl }}{% link /assets/files/doc.pdf %}) -{% endraw %} ``` +{% endraw %} (Including `{% raw %}{{ site.baseurl }}{% endraw %}` is optional — it depends on whether you want to preface the page URL with the `baseurl` value.) @@ -539,26 +562,26 @@ Note you cannot add filters to `link` tags. For example, you cannot append a str If you want to include a link to a post on your site, the `post_url` tag will generate the correct permalink URL for the post you specify. -```liquid {% raw %} +```liquid {{ site.baseurl }}{% post_url 2010-07-21-name-of-post %} -{% endraw %} ``` +{% endraw %} If you organize your posts in subdirectories, you need to include subdirectory path to the post: -```liquid {% raw %} +```liquid {{ site.baseurl }}{% post_url /subdir/2010-07-21-name-of-post %} -{% endraw %} ``` +{% endraw %} There is no need to include the file extension when using the `post_url` tag. You can also use this tag to create a link to a post in Markdown as follows: -```liquid {% raw %} +```liquid [Name of Link]({{ site.baseurl }}{% post_url 2010-07-21-name-of-post %}) -{% endraw %} ``` +{% endraw %} diff --git a/docs/_docs/themes.md b/docs/_docs/themes.md index c79ce54c4e1..6907ffb0c00 100644 --- a/docs/_docs/themes.md +++ b/docs/_docs/themes.md @@ -47,7 +47,7 @@ To locate a theme's files on your computer: 2. Open the theme's directory in Finder or Explorer: - ```shell + ```sh # On MacOS open $(bundle show minima) # On Windows @@ -88,7 +88,7 @@ With a clear understanding of the theme's files, you can now override any theme Let's say, for a second example, you want to override Minima's footer. In your Jekyll site, create an `_includes` folder and add a file in it called `footer.html`. Jekyll will now use your site's `footer.html` file instead of the `footer.html` file from the Minima theme gem. -To modify any stylesheet you must take the extra step of also copying the main sass file (`_sass/minima.scss` in the Minima theme) into the `_sass` directory in your site's source. +To modify any stylesheet you must take the extra step of also copying the main sass file (`_sass/minima.scss` in the Minima theme) into the `_sass` directory in your site's source. Jekyll will look first to your site's content before looking to the theme's defaults for any requested file in the following folders: @@ -125,9 +125,19 @@ To install a gem-based theme: 1. Add the theme to your site's `Gemfile`: - ```sh + ```ruby + # ./Gemfile + gem "jekyll-theme-awesome" ``` + Or if you've started with the `jekyll new` command, replace `gem "minima", "~> 2.0"` with your theme-gem: + + ```diff + # ./Gemfile + + - gem "minima", "~> 2.0" + + gem "jekyll-theme-awesome" + ``` 2. Install the theme: @@ -137,7 +147,7 @@ To install a gem-based theme: 3. Add the following to your site's `_config.yml` to activate the theme: - ```sh + ```yaml theme: jekyll-theme-awesome ``` @@ -208,13 +218,15 @@ _sass Your theme's styles can be included in the user's stylesheet using the `@import` directive. +{% raw %} ```css -{% raw %}@import "{{ site.theme }}";{% endraw %} +@import "{{ site.theme }}"; ``` +{% endraw %} ### Theme-gem dependencies -From `v3.5`, Jekyll will automatically require all whitelisted `runtime_dependencies` of your theme-gem even if they're not explicitly included under the `gems` array in the site's config file. (NOTE: whitelisting is only required when building or serving with the `--safe` option.) +From `v3.5`, Jekyll will automatically require all whitelisted `runtime_dependencies` of your theme-gem even if they're not explicitly included under the `plugins` array in the site's config file. (Note: whitelisting is only required when building or serving with the `--safe` option.) With this, the end-user need not keep track of the plugins required to be included in their config file for their theme-gem to work as intended. diff --git a/docs/_docs/troubleshooting.md b/docs/_docs/troubleshooting.md index 48163fdc5bb..4ccc164318b 100644 --- a/docs/_docs/troubleshooting.md +++ b/docs/_docs/troubleshooting.md @@ -65,7 +65,7 @@ sudo emerge -av dev-ruby/rubygems On Windows, you may need to install [RubyInstaller DevKit](https://wiki.github.com/oneclick/rubyinstaller/development-kit). -On Android (with Termux) you can install all requirements by running: +On Android (with Termux) you can install all requirements by running: ```sh apt update && apt install libffi-dev clang ruby-dev make @@ -74,7 +74,7 @@ apt update && apt install libffi-dev clang ruby-dev make On macOS, you may need to update RubyGems (using `sudo` only if necessary): ```sh -sudo gem update --system +gem update --system ``` If you still have issues, you can download and install new Command Line @@ -84,11 +84,11 @@ Tools (such as `gcc`) using the following command: xcode-select --install ``` -which may allow you to install native gems using this command (again using +which may allow you to install native gems using this command (again, using `sudo` only if necessary): ```sh -sudo gem install jekyll +gem install jekyll ``` Note that upgrading macOS does not automatically upgrade Xcode itself @@ -103,10 +103,10 @@ With the introduction of System Integrity Protection, several directories that were previously writable are now considered system locations and are no longer available. Given these changes, there are a couple of simple ways to get up and running. One option is to change the location where the gem will be -installed (again using `sudo` only if necessary): +installed (again, using `sudo` only if necessary): ```sh -sudo gem install -n /usr/local/bin jekyll +gem install -n /usr/local/bin jekyll ``` Alternatively, Homebrew can be installed and used to set up Ruby. This can be @@ -195,10 +195,37 @@ That is: defaults are overridden by options specified in `_config.yml`, and flags specified at the command-line will override all other settings specified elsewhere. -If you encounter an error in building the site, with the error message -"'0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the -YAML front matter." try including the line `exclude: [vendor]` -in `_config.yml`. +**Note: From v3.3.0 onward, Jekyll does not process `node_modules` and certain subdirectories within `vendor`, by default. But, by having an `exclude:` array defined explicitly in the config file overrides this default setting, which results in some users to encounter an error in building the site, with the following error message:** + +``` + ERROR: YOUR SITE COULD NOT BE BUILT: + ------------------------------------ + Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': + Document 'vendor/bundle/gems/jekyll-3.4.3/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' + does not have a valid date in the YAML front matter. +``` + +Simply adding `vendor/bundle` to the `exclude:` list will solve this problem but will lead to having other sub-directories under `/vendor/` (and also `/node_modules/`, if present) be processed to the destination folder `_site`. + + +The proper solution is to incorporate the default setting for `exclude:` rather than override it completely: + +For versions upto `v3.4.3`, the `exclude:` setting must look like following: + +```yaml +exclude: + - Gemfile + - Gemfile.lock + - node_modules + - vendor/bundle/ + - vendor/cache/ + - vendor/gems/ + - vendor/ruby/ + - any_additional_item # any user-specific listing goes at the end +``` + +From `v3.5` onward, `Gemfile` and `Gemfile.lock` are also excluded by default. So, in most cases there is no need to define another `exclude:` array in the config file. So an existing definition can either be modified as above, or removed completely, or simply commented out to enable easy edits in future. + ## Markup Problems @@ -234,7 +261,7 @@ The issue is caused by trying to copy a non-existing symlink.
Please report issues you encounter!

- If you come across a bug, please create an issue + If you come across a bug, please create an issue on GitHub describing the problem and any work-arounds you find so we can document it here for others.

diff --git a/docs/_docs/upgrading.md b/docs/_docs/upgrading.md index e59187a496d..3029c0724e9 100644 --- a/docs/_docs/upgrading.md +++ b/docs/_docs/upgrading.md @@ -4,10 +4,26 @@ title: Upgrading permalink: /docs/upgrading/ --- -Upgrading from an older version of Jekyll? Upgrading to a new major version of Jekyll (e.g. from v2.x to v3.x) may cause some headaches. Take the following guides to aid your upgrade: +Upgrading from an older version of Jekyll? Upgrading to a new major version of +Jekyll (e.g. from v2.x to v3.x) may cause some headaches. Take the following +guides to aid your upgrade: - [From 0.x to 1.x and 2.x](/docs/upgrading/0-to-2/) - [From 2.x to 3.x](/docs/upgrading/2-to-3/) -If you are making a minor update (for example from 3.3.1 to the latest version at the time 3.3.2) run 'bundle update jekyll' when in your site directory. -If you would like to update all your gems, run 'bundle update' when in your site directory. +## Minor updates + +
+
Stay Up to Date
+

We recommend you update Jekyll as often as possible to benefit from + the latest bug fixes. +

+
+ +If you followed our setup recommendations and installed [Bundler](http://bundler.io/), run `bundle update jekyll` or simply `bundle update` and all your gems will +update to the latest versions. + +If you don't have Bundler installed, run `gem update jekyll`. + +The procedure is similar [if you use the `github-pages` +gem](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/#keeping-your-site-up-to-date-with-the-github-pages-gem). diff --git a/docs/_docs/upgrading/0-to-2.md b/docs/_docs/upgrading/0-to-2.md index 5f9d2320b80..31548339335 100644 --- a/docs/_docs/upgrading/0-to-2.md +++ b/docs/_docs/upgrading/0-to-2.md @@ -9,7 +9,7 @@ and 2.0 that you'll want to know about. Before we dive in, go ahead and fetch the latest version of Jekyll: ```sh -$ gem update jekyll +gem update jekyll ```
diff --git a/docs/_docs/upgrading/2-to-3.md b/docs/_docs/upgrading/2-to-3.md index 2b1b13573c6..c12a1a91f41 100644 --- a/docs/_docs/upgrading/2-to-3.md +++ b/docs/_docs/upgrading/2-to-3.md @@ -3,20 +3,21 @@ title: Upgrading from 2.x to 3.x permalink: /docs/upgrading/2-to-3/ --- -Upgrading from an older version of Jekyll? A few things have changed in 3.0 +Upgrading from an older version of Jekyll? A few things have changed in Jekyll 3 that you'll want to know about. Before we dive in, go ahead and fetch the latest version of Jekyll: ```sh -$ gem update jekyll +gem update jekyll ``` -Please note: Jekyll 3.2 requires Ruby version >= 2.1 +Since v3.2 Jekyll requires Ruby version >= 2.1 +{: .note .warning }
-
Diving in
-

Want to get a new Jekyll site up and running quickly? Simply +

Diving in
+

Want to get a new Jekyll site up and running quickly? Simply run jekyll new SITENAME to create a new folder with a bare bones Jekyll site.

@@ -68,7 +69,7 @@ generate when running `jekyll build` or `jekyll serve`.
Future Posts on GitHub Pages

An exception to the above rule are GitHub Pages sites, where the --future flag remains enabled - by default to maintain historical consistency for those sites. + by default to maintain historical consistency for those sites.

diff --git a/docs/_docs/usage.md b/docs/_docs/usage.md index f4123aed3fd..dc273b29e90 100644 --- a/docs/_docs/usage.md +++ b/docs/_docs/usage.md @@ -7,22 +7,22 @@ The Jekyll gem makes a `jekyll` executable available to you in your Terminal window. You can use this command in a number of ways: ```sh -$ jekyll build +jekyll build # => The current folder will be generated into ./_site -$ jekyll build --destination +jekyll build --destination # => The current folder will be generated into -$ jekyll build --source --destination +jekyll build --source --destination # => The folder will be generated into -$ jekyll build --watch +jekyll build --watch # => The current folder will be generated into ./_site, # watched for changes, and regenerated automatically. ```
-
Changes to _config.yml are not included during automatic regeneration.
+
Changes to _config.yml are not included during automatic regeneration.

The _config.yml master configuration file contains global configurations and variable definitions that are read once at execution time. Changes made to _config.yml @@ -52,25 +52,22 @@ Jekyll also comes with a built-in development server that will allow you to preview what the generated site will look like in your browser locally. ```sh -$ jekyll serve +jekyll serve # => A development server will run at http://localhost:4000/ # Auto-regeneration: enabled. Use `--no-watch` to disable. -$ jekyll serve --detach +jekyll serve --detach # => Same as `jekyll serve` but will detach from the current terminal. # If you need to kill the server, you can `kill -9 1234` where "1234" is the PID. # If you cannot find the PID, then do, `ps aux | grep jekyll` and kill the instance. ``` - -

-
Be aware of default behavior
-

- As of version 2.4, the serve command will watch for changes automatically. To disable this, you can use jekyll serve --no-watch, which preserves the old behavior. -

+
+
Livereload
+

If you want to enable Livereload, you can enable the jekyll-livereload plugin in a development config file.

```sh -$ jekyll serve --no-watch +jekyll serve --no-watch # => Same as `jekyll serve` but will not watch for changes. ``` @@ -89,8 +86,8 @@ destination: _deploy Then the following two commands will be equivalent: ```sh -$ jekyll build -$ jekyll build --source _source --destination _deploy +jekyll build +jekyll build --source _source --destination _deploy ``` For more about the possible configuration options, see the diff --git a/docs/_docs/windows.md b/docs/_docs/windows.md index 9f21b6edf8b..d1a30b2752f 100644 --- a/docs/_docs/windows.md +++ b/docs/_docs/windows.md @@ -17,17 +17,17 @@ If you are using Windows 10 Anniversary Update, the easiest way to run Jekyll is First let's make sure all our packages / repositories are up to date. Open a new Command Prompt instance, and type the following: -``` +```sh bash ``` Your Command Prompt instance should now be a Bash instance. Now we must update our repo lists and packages. -``` +```sh sudo apt-get update -y && sudo apt-get upgrade -y ``` Now we can install Ruby. To do this we will use a repository from [BrightBox](https://www.brightbox.com/docs/ruby/ubuntu/), which hosts optimized versions of Ruby for Ubuntu. -``` +```sh sudo apt-add-repository ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get install ruby2.3 ruby2.3-dev build-essential @@ -35,19 +35,19 @@ sudo apt-get install ruby2.3 ruby2.3-dev build-essential Next let's update our Ruby gems: -``` +```sh sudo gem update ``` Now all that is left to do is install Jekyll. -``` +```sh sudo gem install jekyll bundler ``` Check if Jekyll installed properly by running: -``` +```sh jekyll -v ``` @@ -55,7 +55,7 @@ jekyll -v To start a new project named `my_blog`, just run: -``` +```sh jekyll new my_blog ``` @@ -122,14 +122,14 @@ This gem is also needed in the github-pages and to get it running on Windows x64 **Note:** In the current [pre release][nokogiriFails] it works out of the box with Windows x64 but this version is not referenced in the github-pages. -`choco install libxml2 -Source "https://www.nuget.org/api/v2/"`{:.language-ruby} +```sh +choco install libxml2 -Source "https://www.nuget.org/api/v2/" -`choco install libxslt -Source "https://www.nuget.org/api/v2/"`{:.language-ruby} +choco install libxslt -Source "https://www.nuget.org/api/v2/" -`choco install libiconv -Source "https://www.nuget.org/api/v2/"`{:.language-ruby} +choco install libiconv -Source "https://www.nuget.org/api/v2/ -```ruby - gem install nokogiri --^ +gem install nokogiri --^ --with-xml2-include=C:\Chocolatey\lib\libxml2.2.7.8.7\build\native\include^ --with-xml2-lib=C:\Chocolatey\lib\libxml2.redist.2.7.8.7\build\native\bin\v110\x64\Release\dynamic\cdecl^ --with-iconv-include=C:\Chocolatey\lib\libiconv.1.14.0.11\build\native\include^ @@ -138,7 +138,7 @@ This gem is also needed in the github-pages and to get it running on Windows x64 --with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic ``` -#### Install github-pages +#### Install github-pages * Open command prompt and install [Bundler][]: `gem install bundler` * Create a file called `Gemfile` without any extension in your root directory of your blog @@ -165,14 +165,10 @@ In the future the installation process of the github-pages should be as simple a [Bundler]: http://bundler.io/ "Ruby Dependencie Manager" [nokogiriReleases]: https://github.com/sparklemotion/nokogiri/releases "Nokogiri Releases" ---- - For a more conventional way of installing Jekyll you can follow this [complete guide to install Jekyll 3 on Windows by Sverrir Sigmundarson][windows-installjekyll3]. Optionally you can use [Autoinstall Jekyll for Windows][fastjekyll-autoinstall]. ---- - [windows-installjekyll3]: https://labs.sverrirs.com/jekyll/ [fastjekyll-autoinstall]: https://github.com/KeJunMao/fastjekyll#autoinstall-jekyll-for-windows @@ -185,11 +181,11 @@ Jekyll. This is especially relevant when you're running Jekyll on Windows. Additionally, you might need to change the code page of the console window to UTF-8 in case you get a "Liquid Exception: Incompatible character encoding" error during the site generation process. It can be done with the following command: ```sh -$ chcp 65001 +chcp 65001 ``` -## Time-Zone Management +## Time-Zone Management Since Windows doesn't have a native source of zoneinfo data, the Ruby Interpreter would not understand IANA Timezones and hence using them had the `TZ` environment variable default to UTC/GMT 00:00. Though Windows users could alternatively define their blog's timezone by setting the key to use POSIX format of defining timezones, it wasn't as user-friendly when it came to having the clock altered to changing DST-rules. @@ -205,9 +201,9 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] [IANA-database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones -## Auto Regeneration +## Auto Regeneration -As of v1.3.0, Jekyll uses the `listen` gem to watch for changes when the `--watch` switch is specified during a build or serve. While `listen` has built-in support for UNIX systems, it may require an extra gem for compatibility with Windows. +Jekyll uses the `listen` gem to watch for changes when the `--watch` switch is specified during a build or serve. While `listen` has built-in support for UNIX systems, it may require an extra gem for compatibility with Windows. Add the following to the Gemfile for your site if you have issues with auto-regeneration on Windows alone: diff --git a/docs/_posts/2014-12-22-jekyll-2-5-3-released.markdown b/docs/_posts/2014-12-22-jekyll-2-5-3-released.markdown index 491007cdd1d..d2c9b13d3a6 100644 --- a/docs/_posts/2014-12-22-jekyll-2-5-3-released.markdown +++ b/docs/_posts/2014-12-22-jekyll-2-5-3-released.markdown @@ -10,7 +10,7 @@ Happy Holidays, everyone. Jekyll v2.5.3 is a quick patch release, containing some minor fixes. See the [full history](/docs/history/) for more info. If you notice any problems, -please [let us know]({{ site.help_url }}). +please [let us know]({{ site.repository }}). This release also marks the start of Jekyll 3 development. I wrote about it over on my personal blog: [Jekyll 3 — The Road Ahead](https://byparker.com/blog/2014/jekyll-3-the-road-ahead/). diff --git a/docs/_posts/2017-09-21-jekyll-3-6-0-released.markdown b/docs/_posts/2017-09-21-jekyll-3-6-0-released.markdown new file mode 100644 index 00000000000..0a468673694 --- /dev/null +++ b/docs/_posts/2017-09-21-jekyll-3-6-0-released.markdown @@ -0,0 +1,17 @@ +--- +title: 'Jekyll turns 3.6!' +date: 2017-09-21 16:38:20 -0400 +author: parkr +version: 3.6.0 +categories: [release] +--- + +Another much-anticipated release of Jekyll. This release comes with it Rouge 2 support, but note you can continue to use Rouge 1 if you'd prefer. We also now require Ruby 2.1.0 as 2.0.x is no longer supported by the Ruby team. + +Otherwise, it's a massive bug-fix release! A few bugs were found and squashed with our `Drop` implementation. We're using the Schwartzian transform to speed up our custom sorting (thanks, Perl community!). We now protect against images that are named like posts and we generally worked on guarding our code to enforce requirements, instead of assuming the input was as expected. + +Please let us know if you find any bugs! You can see [the full history here](/docs/history/#v3-6-0). + +Many thanks to our contributors who helped make this release possible: Aleksander Kuś, André Jaenisch, Antonio Argote, ashmaroli, Ben Balter, Bogdan, Bradley Meck, David Zhang, Florian Thomas, Frank Taillandier, Jordon Bedwell, Joshua Byrd, Kyle Zhao, lymaconsulting, Maciej Bembenista, Matt Sturgeon, Natanael Arndt, Ohad Schneider, Pat Hawks, Pedro Lamas, and Sid Verma. + +As always, Happy Jekylling! diff --git a/docs/_posts/2017-10-19-diversity-open-source.markdown b/docs/_posts/2017-10-19-diversity-open-source.markdown new file mode 100644 index 00000000000..0b1e24eccbb --- /dev/null +++ b/docs/_posts/2017-10-19-diversity-open-source.markdown @@ -0,0 +1,44 @@ +--- +title: "Diversity in Open Source, and Jekyll's role in it" +date: 2017-10-19 21:33:00 +0200 +author: pup +categories: [community] +--- + +Open Source has a problem with diversity. GitHub recently conducted a [survey](http://opensourcesurvey.org/2017) which revealed that 95% of the respondents were identifying as male. This is even worse than in the tech industry overall, where the percentage is only about 76%. Every other week, there seems to be another case of a maintainer engaging in targeted harassment against minorities. People somehow deem it completely okay to let these things slide, though. + +Fortunately, there's a couple of things we can do to make it easier and more comfortable for people that have never contributed to any open source project before, to contribute to our projects. + +## Add a Code of Conduct, and enforce it + +This might seem like one of the easiest steps to do, but it actually requires a lot of dedication to pull through with. Basically, a Code of Conduct is a document detailing what is and what isn't acceptable behavior in your project. A good Code of Conduct also details enforcement procedures, that means how the person violating the Code of Conduct gets dealt with. This is the point at which I've seen a looooot of projects fail. It's easy enough to copy-paste a Code of Conduct into your project, but it's more important to be clear on how to enforce it. Inconsistent —or worse, nonexistent— enforcement is just going to scare off newcomers even more! + +The most widely adopted Code of Conduct is the [Contributor Covenant](https://www.contributor-covenant.org/). It's a very good catch-all document, but it is a bit light in the enforcement section, so I'd recommend to flesh it out by yourself, be it by means of adding contact information or expanding the enforcement rules. + +No matter which Code of Conduct you pick, the most important thing is to actually _read it for yourself_. The worst thing in open source is a maintainer that doesn't know when they've violated their own Code of Conduct. + +## Document your contributing workflow + +The problem that puts people off the most is incomplete or missing documentation, as revealed through GitHub's [open source survey](http://opensourcesurvey.org/2017). A very popular myth in programming is that good code explains itself, which might be true, but only for the person writing it. It's important, especially once you put your project out there for the world to see, to document not only your code, but also the process by which you maintain it. Otherwise, it's going to be extremely hard for newcomers to even figure out where to begin contributing to your project. + +Jekyll has [an entire section of its docs](/docs/contributing) dedicated to information on how to contribute for this very reason. Every documentation page has a link to directly edit and improve it on GitHub. It's also important to realize that not all contributions are code. It can be documentation, it can be reviewing pull requests, but it can also just be weighing into issues, and all of this should be recognized in the same way. At Jekyll, out of 397 total merged pull requests in the last year, __204__ were documentation pull requests! + +## Create newcomer-friendly issues + +For most people new to open source, the biggest hurdle is creating their first pull request. That's why initiatives such as [YourFirstPR](https://twitter.com/yourfirstpr) and [First Timers Only](http://www.firsttimersonly.com/) were started. Recently, [a GitHub bot that automatically creates first-timer friendly issues](https://github.com/hoodiehq/first-timers-bot) was launched, which makes it very easy for maintainers to convert otherwise small or trivial changes into viable pull requests that can be taken on by newcomers! So we decided to give it a shot, and we've created a couple of very easy `first timers only` issues: + +- [Issue #6437](https://github.com/jekyll/jekyll/issues/6437) +- [Issue #6438](https://github.com/jekyll/jekyll/issues/6438) +- [Issue #6439](https://github.com/jekyll/jekyll/issues/6439) + +(There's also an up-to-date listing of all of our `first timers only` issues [here](https://github.com/jekyll/jekyll/issues?q=is%3Aissue+is%3Aopen+label%3Afirst-time-only)) + +These issues are designed to be taken on only by someone who has had little to no exposure to contributing to open source before, and additionally, project maintainers offer support in case a question arises. + +Jekyll is a very big and popular open source project, and we hope that with these special issues, we can help people who haven't contributed to open source before to catch a footing in these unsteady waters. + +## Be nice + +I know this is a cliche and a overused phrase, but really, it works if you pull through with it. Come to terms with the fact that some people aren't as fast or reliable as you might want to think. Don't get angry when a contributor takes a day longer than you might like them to. Treat new contributors to your project with respect, but also with hospitality. Think twice before you send that comment with slurs in it. + +I've been contributing to open source for about 4 years now, and I've had my fair share of horrible, horrible experiences. But Jekyll has historically been a project that has always valued the people contributing to it over the code itself, and I hope we can keep it that way. I also hope that other project maintainers read this and take inspiration from this post. Every project should be more diverse. diff --git a/docs/_posts/2017-10-21-jekyll-3-6-2-released.markdown b/docs/_posts/2017-10-21-jekyll-3-6-2-released.markdown new file mode 100644 index 00000000000..04ca046a22b --- /dev/null +++ b/docs/_posts/2017-10-21-jekyll-3-6-2-released.markdown @@ -0,0 +1,42 @@ +--- +title: 'Jekyll 3.6.2 Released' +date: 2017-10-21 21:31:40 +0200 +author: dirtyf +version: 3.6.2 +categories: [release] +--- + +3.6.2 is out, it's a tiny patch release and we invite you to run `bundle update` +if you want to avoid possible build problems with: + +* some UTF-8 and UTF-16 encoded files, +* fully numeric layout names (we convert those to string for you now). + +Other changes include updates to our documentation, like this [complete +video series by Giraffe Academy](../tutorials/video-walkthroughs/) aimed at +complete beginners. A big thanks to Mike for this. + +And if you're wondering what happened to version 3.6.1, it was just our new +release maintainer getting familiar with the release process. 😄 + +We try to release patch releases as quickly as possible and we're already +working on the next minor version 3.7.0 that will allow you to store all your +collections in a single directory. Stay tuned. + +Theme developers are invited to test the brand new +[`jekyll-remote-theme`](https://github.com/benbalter/jekyll-remote-theme) plugin +and give their feedback to @benbalter. This plugin allows you to use any +GitHub hosted theme as a remote theme! + +Once again, many thanks to our contributors who helped make this release possible: +ashmaroli, bellvat, Frank Taillandier, i-give-up, Jan Piotrowski, Maximiliano +Kotvinsky, Oliver Steele and Pat Hawks. For some it was their [first +contribution to open-source]({% link +_posts/2017-10-19-diversity-open-source.markdown %}) 👏 + +As it's been nine years this week that Tom Preston-Werner started this project, +I also wanna seize this opportunity to thank [all of the 732 contributors](https://github.com/jekyll/jekyll/graphs/contributors) who +helped make it possible for Jekyll to power millions of websites around the world +today. + +Happy Birthday Jekyll! 🎂 diff --git a/docs/_sass/_normalize.scss b/docs/_sass/_normalize.scss index b26c1009564..fa4e73dd418 100644 --- a/docs/_sass/_normalize.scss +++ b/docs/_sass/_normalize.scss @@ -1,4 +1,4 @@ -/*! normalize.css v6.0.0 | MIT License | github.com/necolas/normalize.css */ +/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */ /* Document ========================================================================== */ @@ -18,6 +18,14 @@ html { /* Sections ========================================================================== */ +/** + * Remove the margin in all browsers (opinionated). + */ + +body { + margin: 0; +} + /** * Add the correct display in IE 9-. */ @@ -225,7 +233,8 @@ svg:not(:root) { ========================================================================== */ /** - * Remove the margin in Firefox and Safari. + * 1. Change the font styles in all browsers (opinionated). + * 2. Remove the margin in Firefox and Safari. */ button, @@ -233,7 +242,10 @@ input, optgroup, select, textarea { - margin: 0; + font-family: sans-serif; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ } /** @@ -292,6 +304,14 @@ button:-moz-focusring, outline: 1px dotted ButtonText; } +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + /** * 1. Correct the text wrapping in Edge and IE. * 2. Correct the color inheritance from `fieldset` elements in IE. diff --git a/docs/_sass/_pygments.scss b/docs/_sass/_pygments.scss index 2858bcd2fb7..4b45bf60521 100644 --- a/docs/_sass/_pygments.scss +++ b/docs/_sass/_pygments.scss @@ -8,16 +8,16 @@ .n { color: #ffffff} /* Name */ .o { color: #ffffff} /* Operator */ .x { color: #ffffff} /* Other */ - .p { color: #ffffff} /* Punctuation */ + .p { color: #98b9ef} /* Punctuation */ .cm { color: #87ceeb} /* Comment.Multiline */ .cp { color: #cd5c5c} /* Comment.Preproc */ .c1 { color: #87ceeb} /* Comment.Single */ .cs { color: #87ceeb} /* Comment.Special */ - .gd { color: #0000c0; font-weight: bold; background-color: #008080 } /* Generic.Deleted */ + .gd { color: #ce342c} /* Generic.Deleted */ .ge { color: #c000c0; text-decoration: underline} /* Generic.Emph */ .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */ .gh { color: #cd5c5c} /* Generic.Heading */ - .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */ + .gi { color: #27b42c} /* Generic.Inserted */ span.go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output, qualified with span to prevent applying this style to the Go language, see #1153. */ .gp { color: #ffffff} /* Generic.Prompt */ .gs { color: #ffffff} /* Generic.Strong */ @@ -45,7 +45,7 @@ .nx { color: #ffffff} /* Name.Other */ .py { color: #ffffff} /* Name.Property */ .nt { color: #f0e68c} /* Name.Tag */ - .nv { color: #98fb98} /* Name.Variable */ + .nv { color: #88d472} /* Name.Variable */ .ow { color: #ffffff} /* Operator.Word */ .w { color: #ffffff} /* Text.Whitespace */ .mf { color: #ffffff} /* Literal.Number.Float */ @@ -69,10 +69,6 @@ .vi { color: #98fb98} /* Name.Variable.Instance */ .il { color: #ffffff} /* Literal.Number.Integer.Long */ .bash .nv { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; + user-select: none; } -} \ No newline at end of file +} diff --git a/docs/_sass/_style.scss b/docs/_sass/_style.scss index 7399c34ef66..152b630eec2 100644 --- a/docs/_sass/_style.scss +++ b/docs/_sass/_style.scss @@ -682,15 +682,15 @@ h5 > code, .highlight { margin: 1em 0; - padding: 10px 0; width: 100%; overflow: auto; } +pre.highlight { padding: 10px 0.5em; } + .highlighter-rouge .highlight { @extend .highlight; margin: 0; - padding: 10px 0.5em; } /* HTML Elements */ @@ -813,7 +813,12 @@ tbody td { background-image: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1affffff', endColorstr='#00ffffff',GradientType=0 ); - p { + ul { + padding-left: 1em; + } + + p, + ul { font-size: 16px; code { font-size: 14px; } @@ -1053,3 +1058,23 @@ code.output { background: #454545; } } + +.language-sh { + &:before { + display: table; + padding: 5px 8px; + width: 100%; + color: #272727; + text-shadow: none; + font-size: 14px; + line-height: 1.25; + font-weight: 700; + content: "TERMINAL"; + background: #7a7a7a; + border: 1px solid #333; + @include border-radius(5px 5px 0 0); + } + .highlight { + @include border-radius(0 0 5px 5px); + } +} diff --git a/docs/_tutorials/convert-existing-site-to-jekyll.md b/docs/_tutorials/convert-existing-site-to-jekyll.md index 2a6db34d323..379edc2e02d 100644 --- a/docs/_tutorials/convert-existing-site-to-jekyll.md +++ b/docs/_tutorials/convert-existing-site-to-jekyll.md @@ -306,7 +306,7 @@ At minimum, a layout should contain `{% raw %}{{ content }}{% endraw %}`, which ### For loops -By the way, let's pause here to look at the `for` loop logic a little more closely. [For loops in Liquid](https://help.shopify.com/themes/liquid/tags/iteration-tags#for) are one of the most commonly used Liquid tags. *For loops* let you iterate through content in your Jekyll site and build out a result. The `for` loop also has [certain properties available](https://help.shopify.com/themes/liquid/objects/for-loops) (like first or last iteration) based on the loop's position in the loop as well. +By the way, let's pause here to look at the `for` loop logic a little more closely. [For loops in Liquid](https://shopify.github.io/liquid/tags/iteration/) are one of the most commonly used Liquid tags. *For loops* let you iterate through content in your Jekyll site and build out a result. The `for` loop also has [certain properties available](https://help.shopify.com/themes/liquid/objects/for-loops) (like first or last iteration) based on the loop's position in the loop as well. We've only scratched the surface of what you can do with `for` loops in retrieving posts. For example, if you wanted to display posts from a specific category, you could do so by adding a `categories` property to your post's front matter and then look in those categories. Further, you could limit the number of results by adding a `limit` property. Here's an example: diff --git a/docs/_tutorials/custom-404-page.md b/docs/_tutorials/custom-404-page.md index 2512618e2ef..47efe958247 100644 --- a/docs/_tutorials/custom-404-page.md +++ b/docs/_tutorials/custom-404-page.md @@ -15,7 +15,7 @@ Simply add a `404.md` or `404.html` at the root of your site's source directory If you plan to organize your files under subdirectories, the error page should have the following Front Matter Data, set: `permalink: /404.html`. This is to ensure that the compiled `404.html` resides at the root of your processed site, where it'll be picked by the server. -``` +```markdown --- # example 404.md @@ -34,19 +34,19 @@ Apache Web Servers load a configuration file named [`.htaccess`](http://www.htac Simply add the following to your `.htaccess` file. -``` +```apache ErrorDocument 404 /404.html ``` With an `.htaccess` file, you have the freedom to place your error page within a subdirectory. -``` +```apache ErrorDocument 404 /error_pages/404.html ``` Where the path is relative to your site's domain. -More info on configuring Apache Error Pages can found in [official documentation](https://httpd.apache.org/docs/current/mod/core.html#errordocument). +More info on configuring Apache Error Pages can found in [official documentation](https://httpd.apache.org/docs/current/mod/core.html#errordocument). ## Hosting on Nginx server @@ -55,12 +55,13 @@ The procedure is just as simple as configuring Apache servers, but slightly diff Add the following to the nginx configuration file, `nginx.conf`, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`: -``` +```nginx server { error_page 404 /404.html; - location /404.html { + location = /404.html { internal; } } ``` + The `location` directive prevents users from directly browsing the 404.html page. diff --git a/docs/_tutorials/navigation.md b/docs/_tutorials/navigation.md index 94d79d0e8ed..8fc6fe5dd58 100644 --- a/docs/_tutorials/navigation.md +++ b/docs/_tutorials/navigation.md @@ -91,28 +91,36 @@ Suppose you wanted to sort the list by the `title`. To do this, convert the refe **Liquid** +{% raw %} ```liquid -{% raw %}{% assign doclist = site.data.samplelist.docs | sort: 'title' %} +{% assign doclist = site.data.samplelist.docs | sort: 'title' %} +
    {% for item in doclist %}
  1. {{ item.title }}
  2. -{% endfor %}{% endraw %} +{% endfor %} +
``` +{% endraw %} **Result** The items now appear in alphabetical order. The `sort` property in the Liquid filter applies to the `title`, which is an actual property in the list. If `title` weren't a property, we would need to sort by another property. See the [Liquid array filter](https://help.shopify.com/themes/liquid/filters/array-filters) for more filter options. Note that you can't simply use this syntax: +{% raw %} ```liquid -{% raw %}{% for item in site.data.samplelist.docs | sort: "title" %}{% endfor %}{% endraw %} +{% for item in site.data.samplelist.docs | sort: "title" %}{% endfor %} ``` +{% endraw %} You have to convert `site.data.samplelist.docs` to a variable first using either `assign` or `capture` tags. @@ -152,16 +160,18 @@ toc: **Liquid** +{% raw %} ```liquid -{% raw %}{% for item in site.data.samplelist.toc %} +{% for item in site.data.samplelist.toc %}

{{ item.title }}

- {% endfor %}{% endraw %} + {% endfor %} ``` +{% endraw %} **Result**
@@ -242,8 +252,9 @@ toc2: **Liquid** +{% raw %} ```liquid -{% raw %}
+
{% if site.data.samplelist.toc2[0] %} {% for item in site.data.samplelist.toc2 %}

{{ item.title }}

@@ -263,8 +274,9 @@ toc2: {% endif %} {% endfor %} {% endif %} -
{% endraw %} +
``` +{% endraw %} **Result** @@ -327,13 +339,16 @@ sidebar: toc **Liquid** +{% raw %} ```liquid -{% raw %}
    +
      {% for item in site.data.samplelist[page.sidebar] %}
    • {{ item.title }}
    • {% endfor %} -
    {% endraw %} +
``` +{% endraw %} + **Result**
@@ -361,13 +376,15 @@ In addition to inserting items from the YAML data file into your list, you also ``` **Liquid** +{% raw %} ```liquid -{% raw %}{% for item in site.data.samplelist.docs %} +{% for item in site.data.samplelist.docs %}
  • {{ item.title }}
  • -{% endfor %}{% endraw %} +{% endfor %} ``` +{% endraw %} **Result** @@ -388,7 +405,7 @@ In this case, assume `Deployment` is the current page. To make sure the `item.url` (stored in the YAML file) matches the `page.url`, it can be helpful to print the `{% raw %}{{ page.url }}{% endraw %}` to the page. -## Scenario 6: Including items conditionally +## Scenario 7: Including items conditionally You might want to include items conditionally in your list. For example, maybe you have multiple site outputs and only want to include the sidebar item for certain outputs. You can add properties in each list item and then use those properties to conditionally include the content. @@ -412,15 +429,17 @@ docs2: **Liquid** +{% raw %} ```liquid -{% raw %}
      +
        {% for item in site.data.samplelist.docs2 %} {% if item.version == 1 %}
      • {{ item.title }}
      • {% endif %} {% endfor %} -
      {% endraw %} +
    ``` +{% endraw %} **Result** @@ -433,7 +452,7 @@ docs2: The `Deployment` page is excluded because its `version` is `2`. -## Scenario 7: Retrieving items based on front matter properties +## Scenario 8: Retrieving items based on front matter properties If you don't want to store your navigation items in a YAML file in your `_data` folder, you can use `for` loops to look through the YAML front matter of each page or collection and get the content based on properties in the front matter. @@ -491,16 +510,18 @@ Note that even though `category` is used in the doc front matter, `category` is If you wanted to simply get all docs in the collection for a specific category, you could use a `for` loop with an `if` condition to check for a specific category: +{% raw %} ```liquid -{% raw %}

    Getting Started

    +

    Getting Started

      {% for doc in site.docs %} {% if doc.category == "getting-started" %}
    • {{ doc.title }}
    • {% endif %} {% endfor %} -
    {% endraw %} + ``` +{% endraw %} The result would be as follows: @@ -523,8 +544,9 @@ Here's the code for getting lists of pages grouped under their corresponding cat **Liquid** +{% raw %} ```liquid -{% raw %}{% assign mydocs = site.docs | group_by: 'category' %} +{% assign mydocs = site.docs | group_by: 'category' %} {% for cat in mydocs %}

    {{ cat.name | capitalize }}

      @@ -533,8 +555,9 @@ Here's the code for getting lists of pages grouped under their corresponding cat
    • {{ item.title }}
    • {% endfor %}
    -{% endfor %}{% endraw %} +{% endfor %} ``` +{% endraw %} **Result** @@ -574,6 +597,6 @@ After getting the category name, we assign the variable `items` for the docs and The `for item in items` loop looks through each `item` and gets the `title` and `url` to form the list item link. -For more details on the `group_by` filter, see [Jekyll's Templates documentation](https://jekyllrb.com/docs/templates/) as well as [this Siteleaf tutorial](https://www.siteleaf.com/blog/advanced-liquid-group-by/). For more details on the `sort` filter, see [sort](https://help.shopify.com/themes/liquid/filters/array-filters#sort) in Liquid's documentation. +For more details on the `group_by` filter, see [Jekyll's Templates documentation](https://jekyllrb.com/docs/templates/) as well as [this Siteleaf tutorial](https://www.siteleaf.com/blog/advanced-liquid-group-by/). For more details on the `sort` filter, see [sort](https://shopify.github.io/liquid/filters/sort/) in Liquid's documentation. Whether you use properties in your doc's front matter to retrieve your pages or a YAML data file, in both cases you can programmatically build a more robust navigation for your site. diff --git a/docs/_tutorials/orderofinterpretation.md b/docs/_tutorials/orderofinterpretation.md index 8cf9da557b0..b0ea0ec7f0d 100644 --- a/docs/_tutorials/orderofinterpretation.md +++ b/docs/_tutorials/orderofinterpretation.md @@ -37,15 +37,19 @@ The following scenarios highlight potential problems you might encounter. These In your layout file (`_layouts/default.html`), suppose you have a variable assigned: +{% raw %} +```liquid +{% assign myvar = "joe" %} ``` -{% raw %}{% assign myvar = "joe" %}{% endraw %} -``` +{% endraw %} On a page that uses the layout, you reference that variable: +{% raw %} +```liquid +{{ myvar }} ``` -{% raw %}{{ myvar }}{% endraw %} -``` +{% endraw %} The variable won't render because the page's order of interpretation is to render Liquid first and later process the Layout. When the Liquid rendering happens, the variable assignment isn't available. @@ -63,9 +67,11 @@ This is a list: You include the file into an HTML file as follows: +{% raw %} ```liquid -{% raw %}{% include mycontent.md %}{% endraw %} +{% include mycontent.md %} ``` +{% endraw %} The Markdown is not processed because first the Liquid (`include` tag) gets processed, inserting `mycontent.md` into the HTML file. *Then* the Markdown would get processed. @@ -75,11 +81,13 @@ To make the code work, use HTML formatting in includes that are inserted into HT Note that `highlight` tags don't require Markdown to process. Suppose your include contains the following: +{% raw %} ```liquid -{% raw %}{% highlight javascript %} +{% highlight javascript %} console.log('alert'); -{% endhighlight %}{% endraw %} +{% endhighlight %} ``` +{% endraw %} The `highlight` tag *is* Liquid. (Liquid passes the content to Rouge or Pygments for syntax highlighting.) As a result, this code will actually convert to HTML with syntax highlighting. Jekyll does not need the Markdown filter to process `highlight` tags. @@ -87,8 +95,9 @@ The `highlight` tag *is* Liquid. (Liquid passes the content to Rouge or Pygments Suppose you try to mix Liquid's `assign` tag with JavaScript, like this: +{% raw %} ```javascript -{% raw %} +

    @@ -97,15 +106,17 @@ Suppose you try to mix Liquid's `assign` tag with JavaScript, like this: function someFunction() { document.getElementById("intro").innerHTML = someContent; } -{% endraw %} + ``` +{% endraw %} This won't work because the `assign` tag is only available during the Liquid rendering phase of the site. In this JavaScript example, the script executes when a user clicks a button ("Click me") on the HTML page. At that time, the Liquid logic is no longer available, so the `assign` tag wouldn't return anything. However, you can use Jekyll's site variables or Liquid to *populate* a script that is executed at a later time. For example, suppose you have the following property in your front matter: `someContent: "This is some content"`. You could do this: +{% raw %} ```js -{% raw %} +

    @@ -114,8 +125,9 @@ However, you can use Jekyll's site variables or Liquid to *populate* a script th function someFunction() { document.getElementById("intro").innerHTML = "{{ page.someContent }}"; } -{% endraw %} + ``` +{% endraw %} When Jekyll builds the site, this `someContent` property populates the script's values, converting `{% raw %}{{ page.someContent }}{% endraw %}` to `"This is some content"`. @@ -127,17 +139,21 @@ There's one more detail to remember: Liquid does not render when embedded in YAM For example, suppose you have a `highlight` tag in your `_data/mydata.yml` file: -``` -{% raw %}myvalue: > +{% raw %} +```liquid +myvalue: > {% highlight javascript %} console.log('alert'); - {% endhighlight %}{% endraw %} + {% endhighlight %} ``` +{% endraw %} On a page, you try to insert the value: +{% raw %} +```liquid +{{ site.data.mydata.myvalue }} ``` -{% raw %}{{ site.data.mydata.myvalue }}{% endraw %} -``` +{% endraw %} This would render only as a string rather than a code sample with syntax highlighting. To make the code render, consider using an include instead. diff --git a/docs/_tutorials/video-walkthroughs.md b/docs/_tutorials/video-walkthroughs.md new file mode 100644 index 00000000000..c673434aab3 --- /dev/null +++ b/docs/_tutorials/video-walkthroughs.md @@ -0,0 +1,35 @@ +--- +layout: tutorials +permalink: /tutorials/video-walkthroughs/ +title: Video Walkthroughs +--- + +[Giraffe Academy](https://www.youtube.com/c/GiraffeAcademy) has a series of videos that will walk you through the basics of using Jekyll. In this series you'll learn everything from installing Jekyll on your computer and setting up your first site, to using more complex features like variables, layouts and conditionals. + +
    + +
    + +## List of Lessons + +1. [Introduction to Jekyll (see above)](https://www.youtube.com/watch?v=T1itpPvFWHI&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=1) +2. [Mac Installation](https://www.youtube.com/watch?v=WhrU9m82Wm8&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=2) +3. [Windows Installation](https://www.youtube.com/watch?v=LfP7Y9Ja6Qc&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=3) +4. [Creating a Site](https://www.youtube.com/watch?v=pxua_1vyFck&index=4&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +5. [Front Matter](https://www.youtube.com/watch?v=ZtEbGztktvc&index=5&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +6. [Writing Posts](https://www.youtube.com/watch?v=gsYqPL9EFwQ&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=6) +7. [Working With Drafts](https://www.youtube.com/watch?v=X8jXkW3k2Jg&index=7&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +8. [Creating Pages](https://www.youtube.com/watch?v=1na-IWfv08M&index=8&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +9. [Permalinks](https://www.youtube.com/watch?v=938jDG_YPdc&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=9) +10. [Front Matter Defaults](https://www.youtube.com/watch?v=CLCaJJ1zUHU&index=10&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +11. [Themes](https://www.youtube.com/watch?v=NoRS2D-cyko&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=11) +12. [Layouts](https://www.youtube.com/watch?v=bDQsGdCWv4I&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=12) +13. [Variables](https://www.youtube.com/watch?v=nLJBF2KiOZw&index=13&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +14. [Includes](https://www.youtube.com/watch?v=HfcJeRby2a8&index=14&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +15. [Looping Through Posts](https://www.youtube.com/watch?v=6N1X5XffuUA&index=15&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +16. [Conditionals](https://www.youtube.com/watch?v=iNZBEki_x6o&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=16) +17. [Data Files](https://www.youtube.com/watch?v=M6b0KmLB-pM&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=17) +18. [Static Files](https://www.youtube.com/watch?v=knWjmVlVpso&index=18&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB) +19. [Hosting on Github Pages](https://www.youtube.com/watch?v=fqFjuX4VZmU&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=19) + + diff --git a/docs/community/index.md b/docs/community/index.md index 3df84c37590..fb3c8e408f6 100644 --- a/docs/community/index.md +++ b/docs/community/index.md @@ -4,9 +4,11 @@ title: Community permalink: /community/ --- +## Jekyllconf + [JekyllConf](http://jekyllconf.com) is a free, online conference for all things Jekyll hosted by [CloudCannon](http://cloudcannon.com). Each year members of the Jekyll community speak about interesting use cases, tricks they've learned, or meta Jekyll topics. -## Featured +### Featured {% assign random = site.time | date: "%s%N" | modulo: site.data.jekyllconf-talks.size %} {% assign featured = site.data.jekyllconf-talks[random] %} @@ -17,7 +19,7 @@ permalink: /community/ {% assign talks = site.data.jekyllconf-talks | group_by: 'year' %} {% for year in talks reversed %} -## {{ year.name }} +### {{ year.name }} {% for talk in year.items %} * [{{ talk.topic }}](https://youtu.be/{{ talk.youtube_id }}) - [{{ talk.speaker }}](https://twitter.com/{{ talk.twitter_handle }}) {% endfor %} diff --git a/docs/img/twitter-card.png b/docs/img/twitter-card.png new file mode 100644 index 00000000000..23143a5c68f Binary files /dev/null and b/docs/img/twitter-card.png differ diff --git a/docs/latest_version.txt b/docs/latest_version.txt index 87ce492908a..b72762837ea 100644 --- a/docs/latest_version.txt +++ b/docs/latest_version.txt @@ -1 +1 @@ -3.5.2 +3.6.2 diff --git a/features/layout_data.feature b/features/layout_data.feature index c2af5b70ebe..8a10ce87f83 100644 --- a/features/layout_data.feature +++ b/features/layout_data.feature @@ -3,6 +3,26 @@ Feature: Layout data I want to be able to embed data into my layouts In order to make the layouts slightly dynamic + Scenario: Use custom layout data + Given I have a _layouts directory + And I have a "_layouts/999.html" file with content: + """ + --- + --- + {{ content }} layout content + """ + And I have an "index.html" page with layout "custom" that contains "page content" + And I have an "index.html" file with content: + """ + --- + layout: 999 + --- + page content + """ + When I run jekyll build + Then the "_site/index.html" file should exist + And I should see "page content layout content" in "_site/index.html" + Scenario: Use custom layout data Given I have a _layouts directory And I have a "_layouts/custom.html" file with content: diff --git a/features/rendering.feature b/features/rendering.feature index 1d9f2aa949b..e6b80d9e2a6 100644 --- a/features/rendering.feature +++ b/features/rendering.feature @@ -49,7 +49,7 @@ Feature: Rendering And I should not see "Ahoy, indeed!" in "_site/index.css" And I should not see "Ahoy, indeed!" in "_site/index.js" - Scenario: Ignore defaults and don't place documents with layout set to 'none' + Scenario: Ignore defaults and don't place pages and documents with layout set to 'none' Given I have a "index.md" page with layout "none" that contains "Hi there, {{ site.author }}!" And I have a _trials directory And I have a "_trials/no-layout.md" page with layout "none" that contains "Hi there, {{ site.author }}!" @@ -67,9 +67,11 @@ Feature: Rendering And I should not see "Welcome!" in "_site/trials/no-layout.html" And I should not see "Check this out!" in "_site/trials/no-layout.html" But I should see "Check this out!" in "_site/trials/test.html" - And I should see "Welcome!" in "_site/index.html" + And I should see "Hi there, John Doe!" in "_site/index.html" + And I should not see "Welcome!" in "_site/index.html" + And I should not see "Build Warning:" in the build output - Scenario: Don't place documents with layout set to 'none' + Scenario: Don't place pages and documents with layout set to 'none' Given I have a "index.md" page with layout "none" that contains "Hi there, {{ site.author }}!" And I have a _trials directory And I have a "_trials/no-layout.md" page with layout "none" that contains "Hi there, {{ site.author }}!" @@ -84,8 +86,10 @@ Feature: Rendering Then I should get a zero exit status And the _site directory should exist And I should not see "Welcome!" in "_site/trials/no-layout.html" + And I should not see "Welcome!" in "_site/index.html" But I should see "Check this out!" in "_site/trials/test.html" - And I should see "Welcome!" in "_site/index.html" + And I should see "Hi there, John Doe!" in "_site/index.html" + And I should not see "Build Warning:" in the build output Scenario: Render liquid in Sass Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }" diff --git a/features/step_definitions.rb b/features/step_definitions.rb index 7396959fe6f..4bdb877de78 100644 --- a/features/step_definitions.rb +++ b/features/step_definitions.rb @@ -157,7 +157,7 @@ When(%r!^I run jekyll(.*)$!) do |args| run_jekyll(args) if args.include?("--verbose") || ENV["DEBUG"] - $stderr.puts "\n#{jekyll_run_output}\n" + warn "\n#{jekyll_run_output}\n" end end @@ -166,7 +166,7 @@ When(%r!^I run bundle(.*)$!) do |args| run_bundle(args) if args.include?("--verbose") || ENV["DEBUG"] - $stderr.puts "\n#{jekyll_run_output}\n" + warn "\n#{jekyll_run_output}\n" end end @@ -175,7 +175,7 @@ When(%r!^I run gem(.*)$!) do |args| run_rubygem(args) if args.include?("--verbose") || ENV["DEBUG"] - $stderr.puts "\n#{jekyll_run_output}\n" + warn "\n#{jekyll_run_output}\n" end end diff --git a/features/support/formatter.rb b/features/support/formatter.rb index 745c74ec905..091353ac920 100644 --- a/features/support/formatter.rb +++ b/features/support/formatter.rb @@ -59,7 +59,7 @@ def before_feature(_feature) # def feature_element_timing_key(feature_element) - "\"#{feature_element.name.to_s.sub("Scenario: ", "")}\" (#{feature_element.location})" + "\"#{feature_element.name}\" (#{feature_element.location})" end # @@ -173,16 +173,8 @@ def after_test_step(test_step, result) # - private - def print_feature_element_name(keyword, name, source_line, _indent) - @io.puts - - names = name.empty? ? [name] : name.each_line.to_a - line = " #{keyword}: #{names[0]}" - - @io.print(source_line) if @options[:source] - @io.print(line) - @io.print " " + def print_feature_element_name(feature_element) + @io.print "\n#{feature_element.location} Scenario: #{feature_element.name} " @io.flush end @@ -214,3 +206,20 @@ def print_summary(features) end end end + +AfterConfiguration do |config| + f = Jekyll::Cucumber::Formatter.new(nil, $stdout, {}) + + config.on_event :test_case_started do |event| + f.print_feature_element_name(event.test_case) + f.before_feature_element(event.test_case) + end + + config.on_event :test_case_finished do |event| + f.after_feature_element(event.test_case) + end + + config.on_event :test_run_finished do + f.print_worst_offenders + end +end diff --git a/jekyll.gemspec b/jekyll.gemspec index 606d09daae4..98fd53824f4 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -1,4 +1,3 @@ -# coding: utf-8 # frozen_string_literal: true lib = File.expand_path("lib", __dir__) @@ -33,13 +32,14 @@ Gem::Specification.new do |s| s.add_runtime_dependency("addressable", "~> 2.4") s.add_runtime_dependency("colorator", "~> 1.0") + s.add_runtime_dependency("i18n", "~> 0.7") s.add_runtime_dependency("jekyll-sass-converter", "~> 1.0") s.add_runtime_dependency("jekyll-watch", "~> 1.1") s.add_runtime_dependency("kramdown", "~> 1.14") s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - rouge_versions = ENV["ROUGE_VERSION"] ? ["~> #{ENV["ROUGE_VERSION"]}"] : [">= 1.7", "< 3"] + rouge_versions = ENV["ROUGE_VERSION"] ? ["~> #{ENV["ROUGE_VERSION"]}"] : [">= 1.7", "< 4"] s.add_runtime_dependency("rouge", *rouge_versions) s.add_runtime_dependency("safe_yaml", "~> 1.0") end diff --git a/lib/jekyll.rb b/lib/jekyll.rb index fb5db3d43e1..733796cc2af 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -32,8 +32,10 @@ def require_all(path) require "liquid" require "kramdown" require "colorator" +require "i18n" SafeYAML::OPTIONS[:suppress_warnings] = true +I18n.config.available_locales = :en module Jekyll # internal requires @@ -119,7 +121,7 @@ def configuration(override = {}) # timezone - the IANA Time Zone # # Returns nothing - # rubocop:disable Style/AccessorMethodName + # rubocop:disable Naming/AccessorMethodName def set_timezone(timezone) ENV["TZ"] = if Utils::Platforms.really_windows? Utils::WinTZ.calculate(timezone) @@ -127,7 +129,7 @@ def set_timezone(timezone) timezone end end - # rubocop:enable Style/AccessorMethodName + # rubocop:enable Naming/AccessorMethodName # Public: Fetch the logger instance for this Jekyll process. # diff --git a/lib/jekyll/cleaner.rb b/lib/jekyll/cleaner.rb index fee6418a99c..cbcedcecf81 100644 --- a/lib/jekyll/cleaner.rb +++ b/lib/jekyll/cleaner.rb @@ -24,7 +24,9 @@ def cleanup! # # Returns an Array of the file and directory paths def obsolete_files - (existing_files - new_files - new_dirs + replaced_files).to_a + out = (existing_files - new_files - new_dirs + replaced_files).to_a + Jekyll::Hooks.trigger :clean, :on_obsolete, out + out end # Private: The metadata file storing dependency tree and build history diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb index 2e812678b2a..fb0daf85230 100644 --- a/lib/jekyll/collection.rb +++ b/lib/jekyll/collection.rb @@ -100,7 +100,9 @@ def filtered_entries # Returns a String containing the directory name where the collection # is stored on the filesystem. def relative_directory - @relative_directory ||= "_#{label}" + @relative_directory ||= Pathname.new(directory).relative_path_from( + Pathname.new(site.source) + ).to_s end # The full path to the directory containing the collection. @@ -108,7 +110,9 @@ def relative_directory # Returns a String containing th directory name where the collection # is stored on the filesystem. def directory - @directory ||= site.in_source_dir(relative_directory) + @directory ||= site.in_source_dir( + File.join(site.config["collections_dir"], "_#{label}") + ) end # The full path to the directory containing the collection, with diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 1bd176b8be4..96a48cdfd6c 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -96,7 +96,7 @@ def watch(site, options) ) end end - end # end of class << self + end end end end diff --git a/lib/jekyll/commands/clean.rb b/lib/jekyll/commands/clean.rb index 1c3e40bf6c4..1ef65db22db 100644 --- a/lib/jekyll/commands/clean.rb +++ b/lib/jekyll/commands/clean.rb @@ -22,7 +22,7 @@ def process(options) options = configuration_from_options(options) destination = options["destination"] metadata_file = File.join(options["source"], ".jekyll-metadata") - sass_cache = File.join(options["source"], ".sass-cache") + sass_cache = ".sass-cache" remove(destination, :checker_func => :directory?) remove(metadata_file, :checker_func => :file?) diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index 1ef87e714d5..960ee9f9cd3 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -86,7 +86,7 @@ def fsnotify_buggy?(_site) def urls_only_differ_by_case(site) urls_only_differ_by_case = false urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest) - urls.each do |_case_insensitive_url, real_urls| + urls.each_value do |real_urls| next unless real_urls.uniq.size > 1 urls_only_differ_by_case = true Jekyll.logger.warn "Warning:", "The following URLs only differ" \ @@ -135,7 +135,9 @@ def url_exists?(url) def url_valid?(url) Addressable::URI.parse(url) true - rescue + # Addressable::URI#parse only raises a TypeError + # https://git.io/vFfbx + rescue TypeError Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\ "check the value of `url` in your config file." false diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index b1c8bb0bc4b..197f93c8ad2 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -128,7 +128,12 @@ def scaffold_path def after_install(path, options = {}) unless options["blank"] || options["skip-bundle"] - bundle_install path + begin + require "bundler" + bundle_install path + rescue LoadError + Jekyll.logger.info "Could not load Bundler. Bundle install skipped." + end end Jekyll.logger.info "New jekyll site installed in #{path.cyan}." @@ -136,13 +141,15 @@ def after_install(path, options = {}) end def bundle_install(path) - Jekyll::External.require_with_graceful_fail "bundler" Jekyll.logger.info "Running bundle install in #{path.cyan}..." Dir.chdir(path) do - process, output = Jekyll::Utils::Exec.run("bundle", "install") + exe = Gem.bin_path("bundler", "bundle") + process, output = Jekyll::Utils::Exec.run("ruby", exe, "install") + output.to_s.each_line do |line| Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty? end + raise SystemExit unless process.success? end end diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 53973b66cb4..892749a8119 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -85,7 +85,7 @@ def webrick_opts(opts) :StartCallback => start_callback(opts["detach"]), :BindAddress => opts["host"], :Port => opts["port"], - :DirectoryIndex => %W( + :DirectoryIndex => %w( index.htm index.html index.rhtml diff --git a/lib/jekyll/commands/serve/servlet.rb b/lib/jekyll/commands/serve/servlet.rb index b661940c30a..2e41b697524 100644 --- a/lib/jekyll/commands/serve/servlet.rb +++ b/lib/jekyll/commands/serve/servlet.rb @@ -27,7 +27,7 @@ def search_file(req, res, basename) super || super(req, res, ".html") || super(req, res, "#{basename}.html") end - # rubocop:disable Style/MethodName + # rubocop:disable Naming/MethodName def do_GET(req, res) rtn = super validate_and_ensure_charset(req, res) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index a9965d29f5b..087fdf78f6f 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll @@ -9,6 +8,7 @@ class Configuration < Hash # Where things are "source" => Dir.pwd, "destination" => File.join(Dir.pwd, "_site"), + "collections_dir" => "", "plugins_dir" => "_plugins", "layouts_dir" => "_layouts", "data_dir" => "_data", @@ -164,8 +164,7 @@ def config_files(override) config_files = Jekyll.sanitized_path(source(override), "_config.#{default}") @default_config_file = true end - config_files = [config_files] unless config_files.is_a? Array - config_files + Array(config_files) end # Public: Read configuration and return merged Hash @@ -207,7 +206,7 @@ def read_config_files(files) rescue ArgumentError => err Jekyll.logger.warn "WARNING:", "Error reading configuration. " \ "Using defaults (and options)." - $stderr.puts err + warn err end configuration.fix_common_issues.backwards_compatibilize.add_default_collections diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 3e53992104d..17d102ff038 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -27,7 +27,7 @@ def setup # Rubocop does not allow reader methods to have names starting with `get_` # To ensure compatibility, this check has been disabled on this method # - # rubocop:disable Style/AccessorMethodName + # rubocop:disable Naming/AccessorMethodName def get_processor case @config["markdown"].downcase when "redcarpet" then return RedcarpetParser.new(@config) @@ -37,14 +37,14 @@ def get_processor custom_processor end end - # rubocop:enable Style/AccessorMethodName + # rubocop:enable Naming/AccessorMethodName # Public: Provides you with a list of processors, the ones we # support internally and the ones that you have provided to us (if you # are not in safe mode.) def valid_processors - %W(rdiscount kramdown redcarpet) + third_party_processors + %w(rdiscount kramdown redcarpet) + third_party_processors end # Public: A list of processors that you provide via plugins. diff --git a/lib/jekyll/converters/markdown/kramdown_parser.rb b/lib/jekyll/converters/markdown/kramdown_parser.rb index d1f93c63f09..ea8053db1bc 100644 --- a/lib/jekyll/converters/markdown/kramdown_parser.rb +++ b/lib/jekyll/converters/markdown/kramdown_parser.rb @@ -1,5 +1,4 @@ # Frozen-string-literal: true -# Encoding: utf-8 module Jekyll module Converters @@ -42,12 +41,14 @@ def convert(content) end private + # rubocop:disable Performance/HashEachMethods def make_accessible(hash = @config) hash.keys.each do |key| hash[key.to_sym] = hash[key] make_accessible(hash[key]) if hash[key].is_a?(Hash) end end + # rubocop:enable Performance/HashEachMethods # config[kramdown][syntax_higlighter] > # config[kramdown][enable_coderay] > diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index 35c6e5feef7..7a8c6ec5923 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -47,7 +47,7 @@ def block_code(code, lang) end module WithRouge - def block_code(code, lang) + def block_code(_code, lang) code = "
    #{super}
    " "
    #{add_code_tags(code, lang)}
    " diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index aea33fdcb86..1236d9d1662 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true require "set" @@ -50,7 +49,7 @@ def read_yaml(base, name, opts = {}) rescue SyntaxError => e Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}" raise e if self.site.config["strict_front_matter"] - rescue => e + rescue StandardError => e Jekyll.logger.warn "Error reading file #{filename}: #{e.message}" raise e if self.site.config["strict_front_matter"] end @@ -173,9 +172,10 @@ def render_with_liquid? # Determine whether the file should be placed into layouts. # - # Returns false if the document is an asset file. + # Returns false if the document is an asset file or if the front matter + # specifies `layout: none` def place_in_layout? - !asset_file? + !(asset_file? || no_layout?) end # Checks if the layout specified in the document actually exists @@ -245,8 +245,13 @@ def [](property) end private + def _renderer @_renderer ||= Jekyll::Renderer.new(site, self) end + + def no_layout? + data["layout"] == "none" + end end end diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index d42e544c62f..5bb255666ea 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll @@ -267,7 +266,7 @@ def read(opts = {}) merge_defaults read_content(opts) read_post_data - rescue => e + rescue SyntaxError, StandardError, Errors::FatalException => e handle_read_error(e) end end diff --git a/lib/jekyll/drops/collection_drop.rb b/lib/jekyll/drops/collection_drop.rb index 2c9c01320ea..e1d7da95978 100644 --- a/lib/jekyll/drops/collection_drop.rb +++ b/lib/jekyll/drops/collection_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/document_drop.rb b/lib/jekyll/drops/document_drop.rb index 7796980c7a4..727997810f3 100644 --- a/lib/jekyll/drops/document_drop.rb +++ b/lib/jekyll/drops/document_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/drop.rb b/lib/jekyll/drops/drop.rb index 09623ef9ac0..92978af1962 100644 --- a/lib/jekyll/drops/drop.rb +++ b/lib/jekyll/drops/drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll @@ -55,6 +54,7 @@ def [](key) fallback_data[key] end end + alias_method :invoke_drop, :[] # Set a field in the Drop. If mutable, sets in the mutations and # returns. If not mutable, checks first if it's trying to override a @@ -103,11 +103,9 @@ def content_methods # # Returns true if the given key is present def key?(key) - if self.class.mutable - @mutations.key?(key) - else - !key.nil? && (respond_to?(key) || fallback_data.key?(key)) - end + return false if key.nil? + return true if self.class.mutable? && @mutations.key?(key) + respond_to?(key) || fallback_data.key?(key) end # Generates a list of keys with user content as their values. diff --git a/lib/jekyll/drops/excerpt_drop.rb b/lib/jekyll/drops/excerpt_drop.rb index 06f8ae7d016..0362d9304ee 100644 --- a/lib/jekyll/drops/excerpt_drop.rb +++ b/lib/jekyll/drops/excerpt_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/jekyll_drop.rb b/lib/jekyll/drops/jekyll_drop.rb index 1686da418f1..8a56b9ee76d 100644 --- a/lib/jekyll/drops/jekyll_drop.rb +++ b/lib/jekyll/drops/jekyll_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/site_drop.rb b/lib/jekyll/drops/site_drop.rb index 20b0332a43c..632f81ce118 100644 --- a/lib/jekyll/drops/site_drop.rb +++ b/lib/jekyll/drops/site_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/unified_payload_drop.rb b/lib/jekyll/drops/unified_payload_drop.rb index 833443a46f9..52647f98bf6 100644 --- a/lib/jekyll/drops/unified_payload_drop.rb +++ b/lib/jekyll/drops/unified_payload_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/drops/url_drop.rb b/lib/jekyll/drops/url_drop.rb index e67d24d47b8..0571558bf4e 100644 --- a/lib/jekyll/drops/url_drop.rb +++ b/lib/jekyll/drops/url_drop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 35ed4d9f63e..686995e195f 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -335,19 +335,26 @@ def inspect(input) end private + + # Sort the input Enumerable by the given property. + # If the property doesn't exist, return the sort order respective of + # which item doesn't have the property. + # We also utilize the Schwartzian transform to make this more efficient. def sort_input(input, property, order) - input.sort do |apple, orange| - apple_property = item_property(apple, property) - orange_property = item_property(orange, property) - - if !apple_property.nil? && orange_property.nil? - - order - elsif apple_property.nil? && !orange_property.nil? - + order - else - apple_property <=> orange_property + input.map { |item| [item_property(item, property), item] } + .sort! do |apple_info, orange_info| + apple_property = apple_info.first + orange_property = orange_info.first + + if !apple_property.nil? && orange_property.nil? + - order + elsif apple_property.nil? && !orange_property.nil? + + order + else + apple_property <=> orange_property + end end - end + .map!(&:last) end private diff --git a/lib/jekyll/filters/url_filters.rb b/lib/jekyll/filters/url_filters.rb index 151c4e71a55..9d86a0fb431 100644 --- a/lib/jekyll/filters/url_filters.rb +++ b/lib/jekyll/filters/url_filters.rb @@ -20,13 +20,16 @@ def absolute_url(input) ).normalize.to_s end - # Produces a URL relative to the domain root based on site.baseurl. + # Produces a URL relative to the domain root based on site.baseurl + # unless it is already an absolute url with an authority (host). # # input - the URL to make relative to the domain root # # Returns a URL relative to the domain root as a String. def relative_url(input) return if input.nil? + return input if Addressable::URI.parse(input.to_s).absolute? + parts = [sanitized_baseurl, input] Addressable::URI.parse( parts.compact.map { |part| ensure_leading_slash(part.to_s) }.join diff --git a/lib/jekyll/frontmatter_defaults.rb b/lib/jekyll/frontmatter_defaults.rb index fc1bcc2d867..f6b89f6bb60 100644 --- a/lib/jekyll/frontmatter_defaults.rb +++ b/lib/jekyll/frontmatter_defaults.rb @@ -100,12 +100,27 @@ def applies?(scope, path, type) def applies_path?(scope, path) return true if !scope.key?("path") || scope["path"].empty? - scope_path = Pathname.new(scope["path"]) - Pathname.new(sanitize_path(path)).ascend do |ascended_path| - if ascended_path.to_s == scope_path.to_s + sanitized_path = Pathname.new(sanitize_path(path)) + + site_path = Pathname.new(@site.source) + rel_scope_path = Pathname.new(scope["path"]) + abs_scope_path = File.join(@site.source, rel_scope_path) + Dir.glob(abs_scope_path).each do |scope_path| + scope_path = Pathname.new(scope_path).relative_path_from site_path + return true if path_is_subpath?(sanitized_path, scope_path) + end + + path_is_subpath?(sanitized_path, rel_scope_path) + end + + def path_is_subpath?(path, parent_path) + path.ascend do |ascended_path| + if ascended_path.to_s == parent_path.to_s return true end end + + false end # Determines whether the scope applies to type. diff --git a/lib/jekyll/hooks.rb b/lib/jekyll/hooks.rb index 8007edff59c..64496b53119 100644 --- a/lib/jekyll/hooks.rb +++ b/lib/jekyll/hooks.rb @@ -39,6 +39,9 @@ module Hooks :post_render => [], :post_write => [], }, + :clean => { + :on_obsolete => [], + }, } # map of all hooks and their priorities diff --git a/lib/jekyll/liquid_renderer.rb b/lib/jekyll/liquid_renderer.rb index a79f06bd3c8..547fa4c7f3d 100644 --- a/lib/jekyll/liquid_renderer.rb +++ b/lib/jekyll/liquid_renderer.rb @@ -22,19 +22,16 @@ def file(filename) ) LiquidRenderer::File.new(self, filename).tap do - @stats[filename] ||= {} - @stats[filename][:count] ||= 0 + @stats[filename] ||= new_profile_hash @stats[filename][:count] += 1 end end def increment_bytes(filename, bytes) - @stats[filename][:bytes] ||= 0 @stats[filename][:bytes] += bytes end def increment_time(filename, time) - @stats[filename][:time] ||= 0.0 @stats[filename][:time] += time end @@ -45,5 +42,10 @@ def stats_table(n = 50) def self.format_error(e, path) "#{e.message} in #{path}" end + + private + def new_profile_hash + Hash.new { |hash, key| hash[key] = 0 } + end end end diff --git a/lib/jekyll/reader.rb b/lib/jekyll/reader.rb index 5804d1f963a..7b5c3b158ea 100644 --- a/lib/jekyll/reader.rb +++ b/lib/jekyll/reader.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true require "csv" @@ -25,7 +24,7 @@ def read # Sorts posts, pages, and static files. def sort_files! - site.collections.values.each { |c| c.docs.sort! } + site.collections.each_value { |c| c.docs.sort! } site.pages.sort_by!(&:name) site.static_files.sort_by!(&:relative_path) end diff --git a/lib/jekyll/readers/collection_reader.rb b/lib/jekyll/readers/collection_reader.rb index 7d605f421c4..77c700976f7 100644 --- a/lib/jekyll/readers/collection_reader.rb +++ b/lib/jekyll/readers/collection_reader.rb @@ -14,7 +14,7 @@ def initialize(site) # # Returns nothing. def read - site.collections.each do |_, collection| + site.collections.each_value do |collection| collection.read unless SPECIAL_COLLECTIONS.include?(collection.label) end end diff --git a/lib/jekyll/readers/post_reader.rb b/lib/jekyll/readers/post_reader.rb index 510192793b0..b0dc30326b5 100644 --- a/lib/jekyll/readers/post_reader.rb +++ b/lib/jekyll/readers/post_reader.rb @@ -36,10 +36,15 @@ def read_posts(dir) def read_publishable(dir, magic_dir, matcher) read_content(dir, magic_dir, matcher).tap { |docs| docs.each(&:read) } .select do |doc| - site.publisher.publish?(doc).tap do |will_publish| - if !will_publish && site.publisher.hidden_in_the_future?(doc) - Jekyll.logger.debug "Skipping:", "#{doc.relative_path} has a future date" + if doc.content.valid_encoding? + site.publisher.publish?(doc).tap do |will_publish| + if !will_publish && site.publisher.hidden_in_the_future?(doc) + Jekyll.logger.debug "Skipping:", "#{doc.relative_path} has a future date" + end end + else + Jekyll.logger.debug "Skipping:", "#{doc.relative_path} is not valid UTF-8" + false end end end diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb index 5a2d32a8d27..71e5b87c317 100644 --- a/lib/jekyll/renderer.rb +++ b/lib/jekyll/renderer.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true module Jekyll @@ -97,7 +96,7 @@ def convert(content) converters.reduce(content) do |output, converter| begin converter.convert output - rescue => e + rescue StandardError => e Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error while "\ "converting '#{document.relative_path}':" @@ -144,7 +143,7 @@ def invalid_layout?(layout) # Returns String rendered content def place_in_layouts(content, payload, info) output = content.dup - layout = layouts[document.data["layout"]] + layout = layouts[document.data["layout"].to_s] validate_layout(layout) used = Set.new([layout]) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 54155d0c8e2..ebf78b1564d 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true require "csv" @@ -85,11 +84,11 @@ def print_stats # # Returns nothing def reset - if config["time"] - self.time = Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.") - else - self.time = Time.now - end + self.time = if config["time"] + Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.") + else + Time.now + end self.layouts = {} self.pages = [] self.static_files = [] @@ -238,7 +237,7 @@ def post_attr_hash(post_attr) posts.docs.each do |p| p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr] end - hash.values.each { |posts| posts.sort!.reverse! } + hash.each_value { |posts| posts.sort!.reverse! } hash end @@ -445,11 +444,12 @@ def configure_include_paths def configure_file_read_opts self.file_read_opts = {} self.file_read_opts[:encoding] = config["encoding"] if config["encoding"] + self.file_read_opts = Jekyll::Utils.merged_file_read_opts(self, {}) end private def render_docs(payload) - collections.each do |_, collection| + collections.each_value do |collection| collection.docs.each do |document| if regenerator.regenerate?(document) document.output = Jekyll::Renderer.new(self, document, payload).run diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 687f9b717b3..683e3b2b456 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -18,13 +18,13 @@ def initialize(tag_name, markup, tokens) @lang = Regexp.last_match(1).downcase @highlight_options = parse_options(Regexp.last_match(2)) else - raise SyntaxError, <<-eos + raise SyntaxError, <<-MSG Syntax Error in tag 'highlight' while parsing the following markup: #{markup} Valid syntax: highlight [linenos] -eos +MSG end end @@ -95,14 +95,14 @@ def render_pygments(code, is_safe) ) if highlighted_code.nil? - Jekyll.logger.error < e - raise Jekyll::Errors::PostURLError, <<-eos + rescue StandardError => e + raise Jekyll::Errors::PostURLError, <<-MSG Could not parse name of post "#{@orig_post}" in tag 'post_url'. Make sure the post exists and the name is correct. #{e.class}: #{e.message} -eos +MSG end end @@ -90,11 +90,11 @@ def render(context) return p.url end - raise Jekyll::Errors::PostURLError, <<-eos + raise Jekyll::Errors::PostURLError, <<-MSG Could not find post "#{@orig_post}" in tag 'post_url'. Make sure the post exists and the name is correct. -eos +MSG end end end diff --git a/lib/jekyll/theme.rb b/lib/jekyll/theme.rb index 031c61b1e7a..cf9829ea322 100644 --- a/lib/jekyll/theme.rb +++ b/lib/jekyll/theme.rb @@ -16,7 +16,8 @@ def root # Otherwise, Jekyll.sanitized path with prepend the unresolved root @root ||= File.realpath(gemspec.full_gem_path) rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP - nil + raise "Path #{gemspec.full_gem_path} does not exist, is not accessible "\ + "or includes a symbolic link loop" end def includes_path diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 70605a34c18..55cf9be1e28 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true module Jekyll @@ -6,12 +5,13 @@ module Utils extend self autoload :Ansi, "jekyll/utils/ansi" autoload :Exec, "jekyll/utils/exec" + autoload :Internet, "jekyll/utils/internet" autoload :Platforms, "jekyll/utils/platforms" autoload :Rouge, "jekyll/utils/rouge" autoload :WinTZ, "jekyll/utils/win_tz" # Constants for use in #slugify - SLUGIFY_MODES = %w(raw default pretty ascii).freeze + SLUGIFY_MODES = %w(raw default pretty ascii latin).freeze SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze SLUGIFY_DEFAULT_REGEXP = Regexp.new("[^[:alnum:]]+").freeze SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze @@ -169,6 +169,10 @@ def has_yaml_header?(file) # When mode is "ascii", some everything else except ASCII characters # a-z (lowercase), A-Z (uppercase) and 0-9 (numbers) are not replaced with hyphen. # + # When mode is "latin", the input string is first preprocessed so that + # any letters with accents are replaced with the plain letter. Afterwards, + # it follows the "default" mode of operation. + # # If cased is true, all uppercase letters in the result string are # replaced with their lowercase counterparts. # @@ -183,7 +187,10 @@ def has_yaml_header?(file) # # => "The-_config.yml file" # # slugify("The _config.yml file", "ascii") - # # => "the-config.yml-file" + # # => "the-config-yml-file" + # + # slugify("The _config.yml file", "latin") + # # => "the-config-yml-file" # # Returns the slugified string. def slugify(string, mode: nil, cased: false) @@ -194,26 +201,10 @@ def slugify(string, mode: nil, cased: false) return cased ? string : string.downcase end - # Replace each character sequence with a hyphen - re = - case mode - when "raw" - SLUGIFY_RAW_REGEXP - when "default" - SLUGIFY_DEFAULT_REGEXP - when "pretty" - # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL - # and is allowed in both extN and NTFS. - SLUGIFY_PRETTY_REGEXP - when "ascii" - # For web servers not being able to handle Unicode, the safe - # method is to ditch anything else but latin letters and numeric - # digits. - SLUGIFY_ASCII_REGEXP - end + # Drop accent marks from latin characters. Everything else turns to ? + string = ::I18n.transliterate(string) if mode == "latin" - # Strip according to the mode - slug = string.gsub(re, "-") + slug = replace_character_sequence_with_hyphen(string, :mode => mode) # Remove leading/trailing hyphen slug.gsub!(%r!^\-|\-$!i, "") @@ -301,6 +292,9 @@ def safe_glob(dir, patterns, flags = 0) # and a given param def merged_file_read_opts(site, opts) merged = (site ? site.file_read_opts : {}).merge(opts) + if merged[:encoding] && !merged[:encoding].start_with?("bom|") + merged[:encoding] = "bom|#{merged[:encoding]}" + end if merged["encoding"] && !merged["encoding"].start_with?("bom|") merged["encoding"] = "bom|#{merged["encoding"]}" end @@ -333,5 +327,32 @@ def duplicate_frozen_values(target) target[key] = val.dup if val.frozen? && duplicable?(val) end end + + # Replace each character sequence with a hyphen. + # + # See Utils#slugify for a description of the character sequence specified + # by each mode. + private + def replace_character_sequence_with_hyphen(string, mode: "default") + replaceable_char = + case mode + when "raw" + SLUGIFY_RAW_REGEXP + when "pretty" + # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL + # and is allowed in both extN and NTFS. + SLUGIFY_PRETTY_REGEXP + when "ascii" + # For web servers not being able to handle Unicode, the safe + # method is to ditch anything else but latin letters and numeric + # digits. + SLUGIFY_ASCII_REGEXP + else + SLUGIFY_DEFAULT_REGEXP + end + + # Strip according to the mode + string.gsub(replaceable_char, "-") + end end end diff --git a/lib/jekyll/utils/ansi.rb b/lib/jekyll/utils/ansi.rb index 8bdd2322168..b680528eb95 100644 --- a/lib/jekyll/utils/ansi.rb +++ b/lib/jekyll/utils/ansi.rb @@ -1,6 +1,4 @@ # Frozen-string-literal: true -# Copyright: 2015 Jekyll - MIT License -# Encoding: utf-8 module Jekyll module Utils diff --git a/lib/jekyll/utils/internet.rb b/lib/jekyll/utils/internet.rb new file mode 100644 index 00000000000..f895596c548 --- /dev/null +++ b/lib/jekyll/utils/internet.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Jekyll + module Utils + module Internet + + # Public: Determine whether the present device has a connection to + # the Internet. This allows plugin writers which require the outside + # world to have a neat fallback mechanism for offline building. + # + # Example: + # if Internet.connected? + # Typhoeus.get("https://pages.github.com/versions.json") + # else + # Jekyll.logger.warn "Warning:", "Version check has been disabled." + # Jekyll.logger.warn "", "Connect to the Internet to enable it." + # nil + # end + # + # Returns true if a DNS call can successfully be made, or false if not. + module_function + def connected? + !dns("example.com").nil? + end + + private + module_function + def dns(domain) + require "resolv" + Resolv::DNS.open do |resolver| + resolver.getaddress(domain) + end + rescue Resolv::ResolvError, Resolv::ResolvTimeout + nil + end + + end + end +end diff --git a/lib/jekyll/version.rb b/lib/jekyll/version.rb index 3a69700216e..6e0c1cf6ca6 100644 --- a/lib/jekyll/version.rb +++ b/lib/jekyll/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Jekyll - VERSION = "3.6.0.pre.beta1".freeze + VERSION = "3.6.0".freeze end diff --git a/rake/site.rake b/rake/site.rake index 15680b15afe..10d48c52651 100644 --- a/rake/site.rake +++ b/rake/site.rake @@ -7,7 +7,7 @@ ############################################################################# namespace :site do - task :generated_pages => [:history, :version_file, :conduct, :contributing] + task :generated_pages => [:history, :version_file, :conduct, :contributing, :support] desc "Generate and view the site locally" task :preview => :generated_pages do @@ -77,6 +77,11 @@ namespace :site do siteify_file(".github/CONTRIBUTING.markdown", "title" => "Contributing") end + desc "Copy the support file" + task :support do + siteify_file(".github/SUPPORT.markdown", "title" => "Support") + end + desc "Write the site latest_version.txt file" task :version_file do File.open("#{docs_folder}/latest_version.txt", "wb") { |f| f.puts(version) } unless version =~ %r!(beta|rc|alpha)!i diff --git a/script/cucumber b/script/cucumber index 0f0ef0f7da1..8a419d61941 100755 --- a/script/cucumber +++ b/script/cucumber @@ -1,4 +1,4 @@ #!/usr/bin/env bash time ruby -S bundle exec cucumber \ - -f Jekyll::Cucumber::Formatter "$@" + --format progress "$@" diff --git a/script/fmt b/script/fmt index e7c6b7cb29b..9585262831d 100755 --- a/script/fmt +++ b/script/fmt @@ -1,3 +1,8 @@ #!/bin/bash echo "Rubocop $(bundle exec rubocop --version)" bundle exec rubocop -D $@ +success=$? +if ((success != 0)); then + echo -e "\nTry running \`script/fmt -a\` to automatically fix errors" +fi +exit $success diff --git a/test/source/_encodings/UTF8CRLFandBOM.md b/test/source/_encodings/UTF8CRLFandBOM.md new file mode 100755 index 00000000000..36390cc3464 --- /dev/null +++ b/test/source/_encodings/UTF8CRLFandBOM.md @@ -0,0 +1,11 @@ +--- +layout: post +title: "UTF8CRLFandBOM" +date: 2017-04-05 16:16:01 -0800 +categories: bom +--- +This file was created with CR/LFs, and encoded as UTF8 with a BOM + +You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `bundle exec jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. + +To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works. diff --git a/test/source/_encodings/Unicode16LECRLFandBOM.md b/test/source/_encodings/Unicode16LECRLFandBOM.md new file mode 100755 index 00000000000..8941716a1d0 Binary files /dev/null and b/test/source/_encodings/Unicode16LECRLFandBOM.md differ diff --git a/test/test_ansi.rb b/test/test_ansi.rb index 9b4fd01668c..e780e0dd521 100644 --- a/test/test_ansi.rb +++ b/test/test_ansi.rb @@ -8,7 +8,7 @@ class TestAnsi < JekyllUnitTest @subject = Jekyll::Utils::Ansi end - Jekyll::Utils::Ansi::COLORS.each do |color, _val| + Jekyll::Utils::Ansi::COLORS.each_key do |color| should "respond_to? #{color}" do assert @subject.respond_to?(color) end diff --git a/test/test_convertible.rb b/test/test_convertible.rb index cc5be8785a7..f05cb4fb2c7 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -38,7 +38,7 @@ class TestConvertible < JekyllUnitTest should "raise for broken front matter with `strict_front_matter` set" do name = "broken_front_matter2.erb" @convertible.site.config["strict_front_matter"] = true - assert_raises do + assert_raises(Psych::SyntaxError) do @convertible.read_yaml(@base, name) end end diff --git a/test/test_document.rb b/test/test_document.rb index 42ba3c5748b..6ce71230680 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -7,6 +7,15 @@ def assert_equal_value(key, one, other) assert_equal(one[key], other[key]) end + def setup_encoded_document(filename) + site = fixture_site("collections" => ["encodings"]) + site.process + Document.new(site.in_source_dir(File.join("_encodings", filename)), { + :site => site, + :collection => site.collections["encodings"], + }).tap(&:read) + end + context "a document in a collection" do setup do @site = fixture_site({ @@ -529,4 +538,24 @@ def assert_equal_value(key, one, other) assert_equal true, File.file?(@dest_file) end end + + context "a document with UTF-8 CLRF" do + setup do + @document = setup_encoded_document "UTF8CRLFandBOM.md" + end + + should "not throw an error" do + Jekyll::Renderer.new(@document.site, @document).render_document + end + end + + context "a document with UTF-16LE CLRF" do + setup do + @document = setup_encoded_document "Unicode16LECRLFandBOM.md" + end + + should "not throw an error" do + Jekyll::Renderer.new(@document.site, @document).render_document + end + end end diff --git a/test/test_drop.rb b/test/test_drop.rb index eb23feb0f20..5c46d81dc77 100644 --- a/test/test_drop.rb +++ b/test/test_drop.rb @@ -2,8 +2,20 @@ require "helper" +class DropFixture < Jekyll::Drops::Drop + mutable true + + def foo + "bar" + end + + def fallback_data + @fallback_data ||= { "baz" => "buzz" } + end +end + class TestDrop < JekyllUnitTest - context "a document drop" do + context "Drops" do setup do @site = fixture_site({ "collections" => ["methods"], @@ -12,37 +24,96 @@ class TestDrop < JekyllUnitTest @document = @site.collections["methods"].docs.detect do |d| d.relative_path == "_methods/configuration.md" end - @drop = @document.to_liquid + @document_drop = @document.to_liquid + @drop = DropFixture.new({}) end should "reject 'nil' key" do refute @drop.key?(nil) end - should "raise KeyError if key is not found and no default provided" do - assert_raises KeyError do - @drop.fetch("not_existing_key") - end + should "return values for #[]" do + assert_equal "bar", @drop["foo"] end - should "fetch value without default" do - assert_equal "Jekyll.configuration", @drop.fetch("title") + should "return values for #invoke_drop" do + assert_equal "bar", @drop.invoke_drop("foo") end - should "fetch default if key is not found" do - assert_equal "default", @drop.fetch("not_existing_key", "default") - end + context "mutations" do + should "return mutations for #[]" do + @drop["foo"] = "baz" + assert_equal "baz", @drop["foo"] + end - should "fetch default boolean value correctly" do - assert_equal false, @drop.fetch("bar", false) + should "return mutations for #invoke_drop" do + @drop["foo"] = "baz" + assert_equal "baz", @drop.invoke_drop("foo") + end end - should "fetch default value from block if key is not found" do - assert_equal "default bar", @drop.fetch("bar") { |el| "default #{el}" } + context "a document drop" do + context "fetch" do + should "raise KeyError if key is not found and no default provided" do + assert_raises KeyError do + @document_drop.fetch("not_existing_key") + end + end + + should "fetch value without default" do + assert_equal "Jekyll.configuration", @document_drop.fetch("title") + end + + should "fetch default if key is not found" do + assert_equal "default", @document_drop.fetch("not_existing_key", "default") + end + + should "fetch default boolean value correctly" do + assert_equal false, @document_drop.fetch("bar", false) + end + + should "fetch default value from block if key is not found" do + assert_equal "default bar", @document_drop.fetch("bar") { |el| "default #{el}" } + end + + should "fetch default value from block first if both argument and block given" do + assert_equal "baz", @document_drop.fetch("bar", "default") { "baz" } + end + + should "not change mutability when fetching" do + assert @drop.class.mutable? + @drop["foo"] = "baz" + assert_equal "baz", @drop.fetch("foo") + assert @drop.class.mutable? + end + end end - should "fetch default value from block first if both argument and block given" do - assert_equal "baz", @drop.fetch("bar", "default") { "baz" } + context "key?" do + context "a mutable drop" do + should "respond true for native methods" do + assert @drop.key? "foo" + end + + should "respond true for mutable keys" do + @drop["bar"] = "baz" + assert @drop.key? "bar" + end + + should "return true for fallback data" do + assert @drop.key? "baz" + end + end + + context "a document drop" do + should "respond true for native methods" do + assert @document_drop.key? "collection" + end + + should "return true for fallback data" do + assert @document_drop.key? "title" + end + end end end end diff --git a/test/test_filters.rb b/test/test_filters.rb index 0499b73c2df..39f7a66f3b9 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -1,4 +1,3 @@ -# coding: utf-8 # frozen_string_literal: true require "helper" @@ -527,6 +526,21 @@ def select; end filter = make_filter_mock({ "baseurl" => Value.new(proc { "/baseurl/" }) }) assert_equal "/baseurl#{page_url}", filter.relative_url(page_url) end + + should "transform protocol-relative url" do + url = "//example.com/" + assert_equal "/base//example.com/", @filter.relative_url(url) + end + + should "not modify an absolute url with scheme" do + url = "file:///file.html" + assert_equal url, @filter.relative_url(url) + end + + should "not normalize absolute international URLs" do + url = "https://example.com/错误" + assert_equal "https://example.com/错误", @filter.relative_url(url) + end end context "strip_index filter" do diff --git a/test/test_front_matter_defaults.rb b/test/test_front_matter_defaults.rb index 9bf9629a9ed..b1773ba0ecb 100644 --- a/test/test_front_matter_defaults.rb +++ b/test/test_front_matter_defaults.rb @@ -27,6 +27,30 @@ class TestFrontMatterDefaults < JekyllUnitTest end end + context "A site with full front matter defaults (glob)" do + setup do + @site = fixture_site({ + "defaults" => [{ + "scope" => { + "path" => "contacts/*.html", + "type" => "page", + }, + "values" => { + "key" => "val", + }, + },], + }) + @site.process + @affected = @site.pages.find { |page| page.relative_path == "contacts/bar.html" } + @not_affected = @site.pages.find { |page| page.relative_path == "about.html" } + end + + should "affect only the specified path and type" do + assert_equal @affected.data["key"], "val" + assert_nil @not_affected.data["key"] + end + end + context "A site with front matter type pages and an extension" do setup do @site = fixture_site({ diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index e1bf15a4b4e..2a12a09074b 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # frozen_string_literal: true require "helper" diff --git a/test/test_site.rb b/test/test_site.rb index f50990e0511..a9ef16e3af2 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -3,6 +3,22 @@ require "helper" class TestSite < JekyllUnitTest + def with_image_as_post + tmp_image_path = File.join(source_dir, "_posts", "2017-09-01-jekyll-sticker.jpg") + FileUtils.cp File.join(Dir.pwd, "docs", "img", "jekyll-sticker.jpg"), tmp_image_path + yield + ensure + FileUtils.rm tmp_image_path + end + + def read_posts + @site.posts.docs.concat(PostReader.new(@site).read_posts("")) + posts = Dir[source_dir("_posts", "**", "*")] + posts.delete_if do |post| + File.directory?(post) && !(post =~ Document::DATE_FILENAME_MATCHER) + end + end + context "configuring sites" do should "have an array for plugins by default" do site = Site.new default_configuration @@ -227,14 +243,18 @@ def generate(site) end should "read posts" do - @site.posts.docs.concat(PostReader.new(@site).read_posts("")) - posts = Dir[source_dir("_posts", "**", "*")] - posts.delete_if do |post| - File.directory?(post) && !(post =~ Document::DATE_FILENAME_MATCHER) - end + posts = read_posts assert_equal posts.size - @num_invalid_posts, @site.posts.size end + should "skip posts with invalid encoding" do + with_image_as_post do + posts = read_posts + num_invalid_posts = @num_invalid_posts + 1 + assert_equal posts.size - num_invalid_posts, @site.posts.size + end + end + should "read pages with YAML front matter" do abs_path = File.expand_path("about.html", @site.source) assert_equal true, Utils.has_yaml_header?(abs_path) @@ -288,7 +308,7 @@ def generate(site) "collections" => ["broken"], "strict_front_matter" => true )) - assert_raises do + assert_raises(Psych::SyntaxError) do site.process end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 8a7ed7d0e6e..43d83464362 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -1,4 +1,3 @@ -# coding: utf-8 # frozen_string_literal: true require "helper" diff --git a/test/test_theme.rb b/test/test_theme.rb index 69628dde1ba..bc1f8de6821 100644 --- a/test/test_theme.rb +++ b/test/test_theme.rb @@ -64,6 +64,27 @@ def setup end end + context "invalid theme" do + context "initializing" do + setup do + stub_gemspec = Object.new + + # the directory for this theme should not exist + allow(stub_gemspec).to receive(:full_gem_path) + .and_return(File.expand_path("test/fixtures/test-non-existent-theme", __dir__)) + + allow(Gem::Specification).to receive(:find_by_name) + .with("test-non-existent-theme") + .and_return(stub_gemspec) + end + + should "raise when getting theme root" do + error = assert_raises(RuntimeError) { Theme.new("test-non-existent-theme") } + assert_match(%r!fixtures\/test-non-existent-theme does not exist!, error.message) + end + end + end + should "retrieve the gemspec" do assert_equal "test-theme-0.1.0", @theme.send(:gemspec).full_name end diff --git a/test/test_utils.rb b/test/test_utils.rb index 1b4d4813b66..844ef825d35 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -207,6 +207,17 @@ class TestUtils < JekyllUnitTest Utils.slugify("fürtive glance!!!!", :mode => "ascii") end + should "map accented latin characters to ASCII characters" do + assert_equal "the-config-yml-file", + Utils.slugify("The _config.yml file?", :mode => "latin") + assert_equal "furtive-glance", + Utils.slugify("fürtive glance!!!!", :mode => "latin") + assert_equal "aaceeiioouu", + Utils.slugify("àáçèéíïòóúü", :mode => "latin") + assert_equal "a-z", + Utils.slugify("Aあわれ鬱господинZ", :mode => "latin") + end + should "only replace whitespace if mode is raw" do assert_equal( "the-_config.yml-file?", @@ -386,16 +397,27 @@ class TestUtils < JekyllUnitTest should "ignore encoding if it's not there" do opts = Utils.merged_file_read_opts(nil, {}) assert_nil opts["encoding"] + assert_nil opts[:encoding] end should "add bom to encoding" do - opts = Utils.merged_file_read_opts(nil, { "encoding" => "utf-8" }) - assert_equal "bom|utf-8", opts["encoding"] + opts = { "encoding" => "utf-8", :encoding => "utf-8" } + merged = Utils.merged_file_read_opts(nil, opts) + assert_equal "bom|utf-8", merged["encoding"] + assert_equal "bom|utf-8", merged[:encoding] end should "preserve bom in encoding" do - opts = Utils.merged_file_read_opts(nil, { "encoding" => "bom|utf-8" }) - assert_equal "bom|utf-8", opts["encoding"] + opts = { "encoding" => "bom|another", :encoding => "bom|another" } + merged = Utils.merged_file_read_opts(nil, opts) + assert_equal "bom|another", merged["encoding"] + assert_equal "bom|another", merged[:encoding] + end + end + + context "Utils::Internet.connected?" do + should "return true if there's internet" do + assert Utils::Internet.connected? end end end