Merge branch 'master' into liquid-4
This commit is contained in:
commit
31178bfe69
|
@ -66,6 +66,26 @@ You can find the documentation for jekyllrb.com in the [docs](https://github.com
|
|||
|
||||
One gotcha, all pull requests should be directed at the `master` branch (the default branch).
|
||||
|
||||
### Updating FontAwesome iconset for jekyllrb.com
|
||||
|
||||
We use a custom version of FontAwesome which contains just the icons we use.
|
||||
|
||||
If you ever need to update our documentation with an icon that is not already available in our custom iconset, you'll have to regenerate the iconset using Icomoon's Generator:
|
||||
|
||||
1. Go to <https://icomoon.io/app/>.
|
||||
2. Click `Import Icons` on the top-horizontal-bar and upload the existing `<jekyll>/docs/icomoon-selection.json`.
|
||||
3. Click `Add Icons from Library..` further down on the page, and add 'Font Awesome'.
|
||||
4. Select the required icon(s) from the Library (make sure its the 'FontAwesome' library instead of 'IcoMoon-Free' library).
|
||||
5. Click `Generate Font` on the bottom-horizontal-bar.
|
||||
6. Inspect the included icons and proceed by clicking `Download`.
|
||||
7. Extract the font files and adapt the CSS to the paths we use in Jekyll:
|
||||
- Copy the entire `fonts` directory over and overwrite existing ones at `<jekyll>/docs/`.
|
||||
- Copy the contents of `selection.json` and overwrite existing content inside `<jekyll>/docs/icomoon-selection.json`.
|
||||
- Copy the entire `@font-face {}` declaration and only the **new-icon(s)' css declarations** further below, to update the
|
||||
`<jekyll>/docs/_sass/_font-awesome.scss` sass partial.
|
||||
- Fix paths in the `@font-face {}` declaration by adding `../` before `fonts/FontAwesome.*` like so:
|
||||
`('../fonts/Fontawesome.woff?9h6hxj')`.
|
||||
|
||||
### Adding plugins
|
||||
|
||||
If you want to add your plugin to the [list of plugins](https://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](https://github.com/jekyll/jekyll/blob/master/docs/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
|
||||
|
|
56
Gemfile
56
Gemfile
|
@ -1,10 +1,10 @@
|
|||
source "https://rubygems.org"
|
||||
gemspec :name => "jekyll"
|
||||
|
||||
gem "rake", "~> 11.0"
|
||||
gem "rake", "~> 12.0"
|
||||
|
||||
# Dependency of jekyll-mentions. RubyGems in Ruby 2.1 doesn't shield us from this.
|
||||
gem "activesupport", "~> 4.2", :groups => [:test_legacy, :site] if RUBY_VERSION < '2.2.2'
|
||||
gem "activesupport", "~> 4.2", :groups => [:test_legacy, :site] if RUBY_VERSION < "2.2.2"
|
||||
|
||||
group :development do
|
||||
gem "launchy", "~> 2.3"
|
||||
|
@ -18,15 +18,15 @@ end
|
|||
#
|
||||
|
||||
group :test do
|
||||
gem "rubocop", "~> 0.44.1"
|
||||
gem "codeclimate-test-reporter", "~> 0.6.0"
|
||||
gem "cucumber", "~> 2.1"
|
||||
gem "jekyll_test_plugin"
|
||||
gem "jekyll_test_plugin_malicious"
|
||||
gem "codeclimate-test-reporter", "~> 0.6.0"
|
||||
gem "rspec-mocks"
|
||||
gem "nokogiri"
|
||||
gem "rspec"
|
||||
gem "test-theme", path: File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.44.1"
|
||||
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))
|
||||
|
||||
gem "jruby-openssl" if RUBY_ENGINE == "jruby"
|
||||
end
|
||||
|
@ -34,54 +34,54 @@ end
|
|||
#
|
||||
|
||||
group :test_legacy do
|
||||
if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
||||
gem 'test-unit'
|
||||
if RUBY_PLATFORM =~ %r!cygwin! || RUBY_VERSION.start_with?("2.2")
|
||||
gem "test-unit"
|
||||
end
|
||||
|
||||
gem "redgreen"
|
||||
gem "simplecov"
|
||||
gem "minitest-reporters"
|
||||
gem "minitest-profile"
|
||||
gem "minitest"
|
||||
gem "minitest-profile"
|
||||
gem "minitest-reporters"
|
||||
gem "redgreen"
|
||||
gem "shoulda"
|
||||
gem "simplecov"
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
group :benchmark do
|
||||
if ENV["BENCHMARK"]
|
||||
gem "ruby-prof"
|
||||
gem "benchmark-ips"
|
||||
gem "stackprof"
|
||||
gem "rbtrace"
|
||||
gem "ruby-prof"
|
||||
gem "stackprof"
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
group :jekyll_optional_dependencies do
|
||||
gem "toml", "~> 0.1.0"
|
||||
gem "coderay", "~> 1.1.0"
|
||||
gem "jekyll-docs", :path => '../docs' if Dir.exist?('../docs') && ENV['JEKYLL_VERSION']
|
||||
gem "jekyll-gist"
|
||||
gem "jekyll-feed"
|
||||
gem "jekyll-coffeescript"
|
||||
gem "jekyll-redirect-from"
|
||||
gem "jekyll-docs", :path => "../docs" if Dir.exist?("../docs") && ENV["JEKYLL_VERSION"]
|
||||
gem "jekyll-feed"
|
||||
gem "jekyll-gist"
|
||||
gem "jekyll-paginate"
|
||||
gem "mime-types", "~> 3.0"
|
||||
gem "jekyll-redirect-from"
|
||||
gem "kramdown", "~> 1.9"
|
||||
gem "mime-types", "~> 3.0"
|
||||
gem "rdoc", "~> 4.2"
|
||||
gem "toml", "~> 0.1.0"
|
||||
|
||||
platform :ruby, :mswin, :mingw, :x64_mingw do
|
||||
gem "rdiscount", "~> 2.0"
|
||||
gem "pygments.rb", "~> 0.6.0"
|
||||
gem "redcarpet", "~> 3.2", ">= 3.2.3"
|
||||
gem "classifier-reborn", "~> 2.0"
|
||||
gem "classifier-reborn", "~> 2.1.0"
|
||||
gem "liquid-c", "~> 3.0"
|
||||
gem "pygments.rb", "~> 0.6.0"
|
||||
gem "rdiscount", "~> 2.0"
|
||||
gem "redcarpet", "~> 3.2", ">= 3.2.3"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
gem "tzinfo-data", :platforms => [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -91,9 +91,9 @@ group :site do
|
|||
gem "html-proofer", "~> 2.0"
|
||||
end
|
||||
|
||||
gem "jemoji", "0.5.1"
|
||||
gem "jekyll-sitemap"
|
||||
gem "jekyll-seo-tag"
|
||||
gem "jekyll-avatar"
|
||||
gem "jekyll-mentions"
|
||||
gem "jekyll-seo-tag"
|
||||
gem "jekyll-sitemap"
|
||||
gem "jemoji", "0.5.1"
|
||||
end
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
## HEAD
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* Add connector param to `array_to_sentence_string` filter (#5597)
|
||||
* Adds `group_by_exp` filter (#5513)
|
||||
* Use the current year for the LICENSE of theme (#5712)
|
||||
* Update License (#5713)
|
||||
* Use Addressable instead of URI to decode (#5726)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Escaped regular expressions when using `post_url`. (#5605)
|
||||
* fix date parsing in file names to be stricter (#5609)
|
||||
* Add a module to re-define `ENV["TZ"]` in Windows (#5612)
|
||||
* Use each instead of map to actually return nothing (#5668)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
* Remove instructions to install Jekyll 2 on Windows (#5582)
|
||||
|
@ -11,23 +26,25 @@
|
|||
* Use only the used Font Awesome icons. (#5530)
|
||||
* Switch to `https` when possible. (#5611)
|
||||
* Update `_font-awesome.scss` to move .woff file before .ttf (#5614)
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* Add connector param to array_to_sentence_string filter (#5597)
|
||||
* Adds group_by_exp filter (#5513)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Escaped regular expressions when using post_url. (#5605)
|
||||
* fix date parsing in file names to be stricter (#5609)
|
||||
* Add a module to re-define `ENV["TZ"]` in Windows (#5612)
|
||||
* Update documentation on updating FontAwesome Iconset (#5655)
|
||||
* Improve quickstart docs (#5689)
|
||||
* Add Jekyll-Post to list of plugins (#5705)
|
||||
* Add jekyll-numbered-headings (#5688)
|
||||
* Docs: move permalinks from documents into config (#5544)
|
||||
* Sort gems in `docs/_config.yml` (#5746)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* clean unit-test names in `test/test_tags.rb` (#5608)
|
||||
* Add cucumber feature to test for bonafide theme gems (#5384)
|
||||
* Use `assert_nil` instead of `assert_equal nil` (#5652)
|
||||
* Rubocop -a on lib/jekyll (#5666)
|
||||
* Bump to rake 12.0 (#5670)
|
||||
* Rubocop Gemfile (#5671)
|
||||
* update Classifier-Reborn to 2.1.0 (#5711)
|
||||
* Rubocop: fix Rakefile and gemspec (#5745)
|
||||
* Use `assert_nil` (#5725)
|
||||
* Sort gems in `jekyll.gemspec` (#5746)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
@ -37,6 +54,15 @@
|
|||
* Improve Permalinks documentation. (#5653)
|
||||
* Fix typo in Variables doc page (#5657)
|
||||
* Fix a couple of typos in the docs (#5658)
|
||||
* Update windows.md (#5683)
|
||||
* Improve permalinks docs (#5693)
|
||||
* Document --unpublished build option (#5720)
|
||||
* Improve pages docs (#5692)
|
||||
* Added new includes.md topic to docs (#5696)
|
||||
* Replace a dead link with a web-archived one (#5738)
|
||||
* Remove duplicate paragraph. (#5740)
|
||||
* Addition of a sample "typical post" (#5473)
|
||||
* Fix a minor grammatical mistake on themes' document (#5748)
|
||||
|
||||
## 3.3.1 / 2016-11-14
|
||||
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2008-2016 Tom Preston-Werner
|
||||
Copyright (c) 2008-2017 Tom Preston-Werner and Jekyll contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
68
Rakefile
68
Rakefile
|
@ -1,13 +1,13 @@
|
|||
require 'rubygems'
|
||||
require 'rake'
|
||||
require 'rdoc'
|
||||
require 'date'
|
||||
require 'yaml'
|
||||
require "rubygems"
|
||||
require "rake"
|
||||
require "rdoc"
|
||||
require "date"
|
||||
require "yaml"
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
|
||||
require 'jekyll/version'
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
||||
require "jekyll/version"
|
||||
|
||||
Dir.glob('rake/**.rake').each { |f| import f }
|
||||
Dir.glob("rake/**.rake").each { |f| import f }
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
|
@ -36,21 +36,21 @@ def gemspec_file
|
|||
end
|
||||
|
||||
def gem_file
|
||||
"#{name}-#{Gem::Version.new(version).to_s}.gem"
|
||||
"#{name}-#{Gem::Version.new(version)}.gem"
|
||||
end
|
||||
|
||||
def normalize_bullets(markdown)
|
||||
markdown.gsub(/\n\s{2}\*{1}/, "\n-")
|
||||
markdown.gsub(%r!\n\s{2}\*{1}!, "\n-")
|
||||
end
|
||||
|
||||
def linkify_prs(markdown)
|
||||
markdown.gsub(/#(\d+)/) do |word|
|
||||
markdown.gsub(%r!#(\d+)!) do |word|
|
||||
"[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
|
||||
end
|
||||
end
|
||||
|
||||
def linkify_users(markdown)
|
||||
markdown.gsub(/(@\w+)/) do |username|
|
||||
markdown.gsub(%r!(@\w+)!) do |username|
|
||||
"[#{username}](https://github.com/#{username.delete("@")})"
|
||||
end
|
||||
end
|
||||
|
@ -60,13 +60,13 @@ def linkify(markdown)
|
|||
end
|
||||
|
||||
def liquid_escape(markdown)
|
||||
markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
|
||||
markdown.gsub(%r!(`{[{%].+[}%]}`)!, "{% raw %}\\1{% endraw %}")
|
||||
end
|
||||
|
||||
def custom_release_header_anchors(markdown)
|
||||
header_regexp = /^(\d{1,2})\.(\d{1,2})\.(\d{1,2}) \/ \d{4}-\d{2}-\d{2}/
|
||||
section_regexp = /^### \w+ \w+$/
|
||||
markdown.split(/^##\s/).map do |release_notes|
|
||||
header_regexp = %r!^(\d{1,2})\.(\d{1,2})\.(\d{1,2}) \/ \d{4}-\d{2}-\d{2}!
|
||||
section_regexp = %r!^### \w+ \w+$!
|
||||
markdown.split(%r!^##\s!).map do |release_notes|
|
||||
_, major, minor, patch = *release_notes.match(header_regexp)
|
||||
release_notes
|
||||
.gsub(header_regexp, "\\0\n{: #v\\1-\\2-\\3}")
|
||||
|
@ -75,11 +75,11 @@ def custom_release_header_anchors(markdown)
|
|||
end
|
||||
|
||||
def sluffigy(header)
|
||||
header.gsub(/#/, '').strip.downcase.gsub(/\s+/, '-')
|
||||
header.delete("#").strip.downcase.gsub(%r!\s+!, "-")
|
||||
end
|
||||
|
||||
def remove_head_from_history(markdown)
|
||||
index = markdown =~ /^##\s+\d+\.\d+\.\d+/
|
||||
index = markdown =~ %r!^##\s+\d+\.\d+\.\d+!
|
||||
markdown[index..-1]
|
||||
end
|
||||
|
||||
|
@ -88,13 +88,17 @@ def converted_history(markdown)
|
|||
custom_release_header_anchors(
|
||||
liquid_escape(
|
||||
linkify(
|
||||
normalize_bullets(markdown)))))
|
||||
normalize_bullets(markdown)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
def siteify_file(file, overrides_front_matter = {})
|
||||
abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file)
|
||||
abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exist?(file)
|
||||
title = begin
|
||||
File.read(file).match(/\A# (.*)$/)[1]
|
||||
File.read(file).match(%r!\A# (.*)$!)[1]
|
||||
rescue
|
||||
File.basename(file, ".*").downcase.capitalize
|
||||
end
|
||||
|
@ -115,7 +119,7 @@ def content_for(file)
|
|||
when "History.markdown"
|
||||
converted_history(contents)
|
||||
else
|
||||
contents.gsub(/\A# .*\n\n?/, "")
|
||||
contents.gsub(%r!\A# .*\n\n?!, "")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -128,23 +132,23 @@ end
|
|||
multitask :default => [:test, :features]
|
||||
|
||||
task :spec => :test
|
||||
require 'rake/testtask'
|
||||
require "rake/testtask"
|
||||
Rake::TestTask.new(:test) do |test|
|
||||
test.libs << 'lib' << 'test'
|
||||
test.pattern = 'test/**/test_*.rb'
|
||||
test.libs << "lib" << "test"
|
||||
test.pattern = "test/**/test_*.rb"
|
||||
test.verbose = true
|
||||
end
|
||||
|
||||
require 'rdoc/task'
|
||||
require "rdoc/task"
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.rdoc_dir = "rdoc"
|
||||
rdoc.title = "#{name} #{version}"
|
||||
rdoc.rdoc_files.include('README*')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
rdoc.rdoc_files.include("README*")
|
||||
rdoc.rdoc_files.include("lib/**/*.rb")
|
||||
end
|
||||
|
||||
begin
|
||||
require 'cucumber/rake/task'
|
||||
require "cucumber/rake/task"
|
||||
Cucumber::Rake::Task.new(:features) do |t|
|
||||
t.profile = "travis"
|
||||
end
|
||||
|
@ -152,9 +156,9 @@ begin
|
|||
t.profile = "html_report"
|
||||
end
|
||||
rescue LoadError
|
||||
desc 'Cucumber rake task not available'
|
||||
desc "Cucumber rake task not available"
|
||||
task :features do
|
||||
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
||||
abort "Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ timezone: America/Los_Angeles
|
|||
|
||||
collections:
|
||||
docs:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
posts:
|
||||
permalink: /news/:year/:month/:day/:title/
|
||||
|
@ -27,14 +28,14 @@ twitter:
|
|||
logo: /img/logo-2x.png
|
||||
|
||||
gems:
|
||||
- jekyll-feed
|
||||
- jekyll-redirect-from
|
||||
- jemoji
|
||||
- jekyll-sitemap
|
||||
- jekyll-seo-tag
|
||||
- jekyll-avatar
|
||||
- jekyll-feed
|
||||
- jekyll-mentions
|
||||
- jekyll-redirect-from
|
||||
- jekyll-seo-tag
|
||||
- jekyll-sitemap
|
||||
- jemoji
|
||||
|
||||
exclude:
|
||||
- README.md
|
||||
- .gitignore
|
||||
- README.md
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
- title: Customization
|
||||
docs:
|
||||
- templates
|
||||
- includes
|
||||
- permalinks
|
||||
- pagination
|
||||
- plugins
|
||||
|
|
|
@ -221,6 +221,16 @@ class="flag">flags</code> (specified on the command-line) that control them.
|
|||
<p><code class="flag">--future</code></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="setting">
|
||||
<td>
|
||||
<p class="name"><strong>Unpublished</strong></p>
|
||||
<p class="description">Render posts that were marked as unpublished.</p>
|
||||
</td>
|
||||
<td class="align-center">
|
||||
<p><code class="option">unpublished: BOOL</code></p>
|
||||
<p><code class="flag">--unpublished</code></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="setting">
|
||||
<td>
|
||||
<p class="name"><strong>LSI</strong></p>
|
||||
|
|
|
@ -71,6 +71,26 @@ You can find the documentation for jekyllrb.com in the [docs](https://github.com
|
|||
|
||||
One gotcha, all pull requests should be directed at the `master` branch (the default branch).
|
||||
|
||||
### Updating FontAwesome iconset for jekyllrb.com
|
||||
|
||||
We use a custom version of FontAwesome which contains just the icons we use.
|
||||
|
||||
If you ever need to update our documentation with an icon that is not already available in our custom iconset, you'll have to regenerate the iconset using Icomoon's Generator:
|
||||
|
||||
1. Go to <https://icomoon.io/app/>.
|
||||
2. Click `Import Icons` on the top-horizontal-bar and upload the existing `<jekyll>/docs/icomoon-selection.json`.
|
||||
3. Click `Add Icons from Library..` further down on the page, and add 'Font Awesome'.
|
||||
4. Select the required icon(s) from the Library (make sure its the 'FontAwesome' library instead of 'IcoMoon-Free' library).
|
||||
5. Click `Generate Font` on the bottom-horizontal-bar.
|
||||
6. Inspect the included icons and proceed by clicking `Download`.
|
||||
7. Extract the font files and adapt the CSS to the paths we use in Jekyll:
|
||||
- Copy the entire `fonts` directory over and overwrite existing ones at `<jekyll>/docs/`.
|
||||
- Copy the contents of `selection.json` and overwrite existing content inside `<jekyll>/docs/icomoon-selection.json`.
|
||||
- Copy the entire `@font-face {}` declaration and only the **new-icon(s)' css declarations** further below, to update the
|
||||
`<jekyll>/docs/_sass/_font-awesome.scss` sass partial.
|
||||
- Fix paths in the `@font-face {}` declaration by adding `../` before `fonts/FontAwesome.*` like so:
|
||||
`('../fonts/Fontawesome.woff?9h6hxj')`.
|
||||
|
||||
### Adding plugins
|
||||
|
||||
If you want to add your plugin to the [list of plugins](https://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](https://github.com/jekyll/jekyll/blob/master/docs/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
|
||||
|
|
|
@ -15,7 +15,7 @@ Kramdown comes with optional support for LaTeX to PNG rendering via [MathJax](ht
|
|||
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
For more information about getting started, check out [this excellent blog post](http://gastonsanchez.com/opinion/2014/02/16/Mathjax-with-jekyll/).
|
||||
For more information about getting started, check out [this excellent blog post](https://web.archive.org/web/20160522225559/http://gastonsanchez.com/opinion/2014/02/16/Mathjax-with-jekyll).
|
||||
|
||||
## Alternative Markdown Processors
|
||||
|
||||
|
|
|
@ -132,11 +132,11 @@ stored in a specially named `gh-pages` branch or in a `docs` folder on the
|
|||
will become available under a subpath of your user pages subdomain, such as
|
||||
`username.github.io/project` (unless a custom domain is specified).
|
||||
|
||||
The Jekyll project repository itself is a perfect example: the
|
||||
[master branch]({{ site.repository }}) contains the actual software project
|
||||
for Jekyll, however the Jekyll website (that you’re looking at right now) is
|
||||
contained in the [docs folder]({{ site.repository }}/tree/master/docs) of the
|
||||
same repository.
|
||||
The Jekyll project repository itself is a perfect example of this branch
|
||||
structure—the [master branch]({{ site.repository }}) contains the
|
||||
actual software project for Jekyll, and the Jekyll website that you’re
|
||||
looking at right now is contained in the [docs
|
||||
folder]({{ site.repository }}/tree/master/docs) of the same repository.
|
||||
|
||||
Please refer to GitHub official documentation on
|
||||
[user, organization and projets pages](https://help.github.com/articles/user-organization-and-project-pages/)
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
---
|
||||
layout: docs
|
||||
title: Includes
|
||||
permalink: /docs/includes/
|
||||
---
|
||||
|
||||
The `include` tag allows you to include the content from another file stored in the `_includes` folder:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% 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.
|
||||
|
||||
### Including files relative to another file
|
||||
|
||||
You can choose to include file fragments relative to the current file by using the `include_relative` tag:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% 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,
|
||||
if `_posts/2014-09-03-my-file.markdown` uses the `include_relative` tag, the included file
|
||||
must be within the `_posts` directory or one of its subdirectories.
|
||||
|
||||
Note that you cannot use the `../` syntax to specify an include location that refers to a higher-level directory.
|
||||
|
||||
All the other capabilities of the `include` tag are available to the `include_relative` tag,
|
||||
such as variables.
|
||||
|
||||
### Using variables names for the include file
|
||||
|
||||
The name of the file you want to embed can be specified as a variable instead of an actual file name. For example, suppose you defined a variable in your page's front matter like this:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: My page
|
||||
my_variable: footer_company_a.html
|
||||
---
|
||||
```
|
||||
|
||||
You could then reference that variable in your include:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% 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.
|
||||
|
||||
### Passing parameters to includes
|
||||
|
||||
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:
|
||||
|
||||
```liquid
|
||||
{% raw %}<div markdown="span" class="alert alert-info" role="alert">
|
||||
<i class="fa fa-info-circle"></i> <b>Note:</b>
|
||||
{{ include.content }}
|
||||
</div>{% 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:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% 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.
|
||||
|
||||
Passing parameters to includes is especially helpful when you want to hide away complex formatting from your Markdown content.
|
||||
|
||||
For example, suppose you have a special image syntax with complex formatting, and you don't want your authors to remember the complex formatting. As a result, you decide to simplify the formatting by using an include with parameters. Here's an example of the special image syntax you might want to populate with an include:
|
||||
|
||||
```html
|
||||
<figure>
|
||||
<a href="http://jekyllrb.com">
|
||||
<img src="logo.png" style="max-width: 200px;"
|
||||
alt="Jekyll logo" />
|
||||
<figcaption>This is the Jekyll logo</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
You could templatize this content in your include and make each value available as a parameter, like this:
|
||||
|
||||
```liquid
|
||||
{% raw %}<figure>
|
||||
<a href="{{ include.url }}">
|
||||
<img src="{{ include.file }}" style="max-width: {{ include.max-width }};"
|
||||
alt="{{ include.alt }}"/>
|
||||
<figcaption>{{ include.caption }}</figcaption>
|
||||
</figure>{% endraw %}
|
||||
```
|
||||
|
||||
This include contains 5 parameters:
|
||||
|
||||
* `url`
|
||||
* `max-width`
|
||||
* `file`
|
||||
* `alt`
|
||||
* `caption`
|
||||
|
||||
Here's an example that passes all the parameters to this include (the include file is named `image.html`):
|
||||
|
||||
```liquid
|
||||
{% raw %}{% include image.html url="http://jekyllrb.com"
|
||||
max-width="200px" file="logo.png" alt="Jekyll logo"
|
||||
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).
|
||||
|
||||
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.)
|
||||
|
||||
### Passing parameter variables to includes
|
||||
|
||||
Suppose the parameter you want to pass to the include is a variable rather than a string. For example, you might be using {% raw %}`{{ site.product_name }}`{% endraw %} to refer to every instance of your product rather than the actual hard-coded name. (In this case, your `_config.yml` file would have a key called `product_name` with a value of your product's name.)
|
||||
|
||||
The string you pass to your include parameter can't contain curly braces. For example, you can't pass a parameter that contains this: {% raw %}`"The latest version of {{ site.product_name }} is now available."`{% endraw %}
|
||||
|
||||
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:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% 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):
|
||||
|
||||
```liquid
|
||||
{% raw %}{% include note.html content=download_note %}{% endraw %}
|
||||
```
|
||||
|
||||
### Passing references to YAML files as parameter values
|
||||
|
||||
Instead of passing string variables to the include, you can pass a reference to a YAML data file stored in the `_data` folder.
|
||||
|
||||
Here's an example. In the `_data` folder, suppose you have a YAML file called `profiles.yml`. Its content looks like this:
|
||||
|
||||
```yaml
|
||||
- name: John Doe
|
||||
login_age: old
|
||||
image: johndoe.jpg
|
||||
|
||||
- name: Jane Doe
|
||||
login_age: new
|
||||
image: janedoe.jpg
|
||||
```
|
||||
|
||||
In the `_includes` folder, assume you have a file called `spotlight.html` with this code:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% for person in {{ include.participants }} %}
|
||||
{% if person.login_age == "new" %}
|
||||
{{ person.name }}
|
||||
{% endif %}
|
||||
{% endfor %}{% endraw %}
|
||||
```
|
||||
|
||||
Now when you insert the `spotlight.html` include file, you can submit the YAML file as a parameter:
|
||||
|
||||
```
|
||||
{% raw %}{% include spotlight.html participants=site.data.profiles %}{% 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`.
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Affinity Team Captains
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/affinity-team-captain/
|
||||
---
|
||||
|
||||
**This guide is for affinity team captains.** These special people are **team maintainers** of one of our [affinity teams][] and help triage and evaluate the issues and contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Avoiding Burnout"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/avoiding-burnout/
|
||||
---
|
||||
|
||||
**This guide is for maintainers.** These special people have **write access** to one or more of Jekyll's repositories and help merge the contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Becoming a Maintainer"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/becoming-a-maintainer/
|
||||
---
|
||||
|
||||
**This guide is for contributors.** These special people have contributed to one or more of Jekyll's repositories, but do not yet have write access to any. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
@ -37,4 +36,4 @@ We would love to expand the team and look forward to many more community members
|
|||
|
||||
# Helping Out Elsewhere
|
||||
|
||||
In addition to maintainers of our core and plugin code, the Jekyll team is comprised of moderators for our forums. These helpful community members take a look at the topics posted to https://talk.jekyllrb.com and ensure they are properly categorized and are acceptable under our Code of Conduct. If you would like to be a moderator, email one of the maintainers with links to where you have answered questions and a request to be added as a moderator. More help is always welcome.
|
||||
In addition to maintainers of our core and plugin code, the Jekyll team is comprised of moderators for our forums. These helpful community members take a look at the topics posted to [https://talk.jekyllrb.com](https://talk.jekyllrb.com) and ensure they are properly categorized and are acceptable under our Code of Conduct. If you would like to be a moderator, email one of the maintainers with links to where you have answered questions and a request to be added as a moderator. More help is always welcome.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Merging a Pull Request"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/merging-a-pull-request/
|
||||
---
|
||||
|
||||
**This guide is for maintainers.** These special people have **write access** to one or more of Jekyll's repositories and help merge the contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Reviewing a Pull Request"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/reviewing-a-pull-request/
|
||||
---
|
||||
|
||||
**This guide is for maintainers.** These special people have **write access** to one or more of Jekyll's repositories and help merge the contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Special Labels"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/special-labels/
|
||||
---
|
||||
|
||||
**This guide is for maintainers.** These special people have **write access** to one or more of Jekyll's repositories and help merge the contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: "Triaging an Issue"
|
||||
layout: docs
|
||||
permalink: /docs/maintaining/triaging-an-issue/
|
||||
---
|
||||
|
||||
**This guide is for maintainers.** These special people have **write access** to one or more of Jekyll's repositories and help merge the contributions of others. You may find what is written here interesting, but it’s definitely not for everyone.
|
||||
|
|
|
@ -4,9 +4,7 @@ title: Creating pages
|
|||
permalink: /docs/pages/
|
||||
---
|
||||
|
||||
In addition to [writing posts](../posts/), another thing you may want to do
|
||||
with your Jekyll site is create static pages. By taking advantage of the way
|
||||
Jekyll copies files and directories, this is easy to do.
|
||||
In addition to [writing posts](../posts/), you might also want to add static pages (content that isn't date-based) to your Jekyll site. By taking advantage of the way Jekyll copies files and directories, this is easy to do.
|
||||
|
||||
## Homepage
|
||||
|
||||
|
@ -28,16 +26,14 @@ homepage of your Jekyll-generated site.
|
|||
## Where additional pages live
|
||||
|
||||
Where you put HTML or [Markdown](https://daringfireball.net/projects/markdown/)
|
||||
files for pages depends on how you want the pages to work.
|
||||
There are two main ways of creating pages:
|
||||
files for pages depends on how you want the pages to work. There are two main ways of creating pages:
|
||||
|
||||
- Place named HTML or [Markdown](https://daringfireball.net/projects/markdown/)
|
||||
files for each page in your site's root folder.
|
||||
- Create a folder in the site's root for each page, and place an index.html
|
||||
or index.md file in each page folder.
|
||||
- Place pages inside folders and subfolders named whatever you want.
|
||||
|
||||
Both methods work fine (and can be used in conjunction with each other),
|
||||
with the only real difference being the resulting URLs.
|
||||
with the only real difference being the resulting URLs. By default, pages retain the same folder structure in `_site` as they do in the source directory.
|
||||
|
||||
### Named HTML files
|
||||
|
||||
|
@ -59,42 +55,21 @@ and associated URLs might look like:
|
|||
└── contact.html # => http://example.com/contact.html
|
||||
```
|
||||
|
||||
### Named folders containing index HTML files
|
||||
If you have a lot of pages, you can organize those pages into subfolders. The same subfolders that are used to group your pages in our project's source will exist in the `_site` folder when your site builds.
|
||||
|
||||
There is nothing wrong with the above method. However, some people like to keep
|
||||
their URLs free from things like filename extensions. To achieve clean URLs for
|
||||
pages using Jekyll, you simply need to create a folder for each top-level page
|
||||
you want, and then place an `index.html` file in each page’s folder. This way
|
||||
the page URL ends up being the folder name, and the web server will serve up
|
||||
the respective `index.html` file. Here's an example of what this structure
|
||||
might look like:
|
||||
## Flattening pages from subfolders into the root directory
|
||||
|
||||
```sh
|
||||
.
|
||||
├── _config.yml
|
||||
├── _includes/
|
||||
├── _layouts/
|
||||
├── _posts/
|
||||
├── _site/
|
||||
├── about/
|
||||
| └── index.html # => http://example.com/about/
|
||||
├── contact/
|
||||
| └── index.html # => http://example.com/contact/
|
||||
|── other/
|
||||
| └── index.md # => http://example.com/other/
|
||||
└── index.html # => http://example.com/
|
||||
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:
|
||||
|
||||
```
|
||||
---
|
||||
title: My page
|
||||
permalink: mypageurl.html
|
||||
---
|
||||
```
|
||||
|
||||
This approach may not suit everyone, but for people who like clean URLs it’s
|
||||
simple and it works. In the end, the decision is yours!
|
||||
### Named folders containing index HTML files
|
||||
|
||||
<div class="note">
|
||||
<h5>ProTip™: Use permalink Front Matter Variable</h5>
|
||||
<p>
|
||||
Clean URLs can also be achieved using the <code>permalink</code> front
|
||||
matter variable. In the example above, using the first method, you can
|
||||
get URL <code>http://example.com/other</code> for the file
|
||||
<code>other.md</code> by setting this at the top of the file:
|
||||
<code>permalink: /other</code>
|
||||
</p>
|
||||
</div>
|
||||
If you don't want file extensions (`.html`) to appear in your page URLs (file extensions are the default), you can choose a [permalink style](../permalinks/#builtinpermalinkstyles) that has a trailing slash instead of a file extension.
|
||||
|
||||
Note if you want to view your site offline *without the Jekyll preview server*, your browser will need the file extension to display the page, and all assets will need to be relative links that function without the server baseurl.
|
||||
|
|
|
@ -4,27 +4,54 @@ title: Permalinks
|
|||
permalink: /docs/permalinks/
|
||||
---
|
||||
|
||||
Jekyll supports a flexible way to build your site’s URLs. You can specify the
|
||||
permalinks for your site through the [Configuration](../configuration/) or in
|
||||
the [YAML Front Matter](../frontmatter/) for each post. You’re free to choose
|
||||
one of the built-in styles to create your links or craft your own. The default
|
||||
style is `date`.
|
||||
Permalinks refer to the URLs (excluding the domain name or directory folder) for your pages, posts, or collections.
|
||||
Jekyll supports a flexible way to build permalinks, allowing you to leverage various template variables or choose built-in permalink styles (such as `date`) that automatically use a template-variable pattern.
|
||||
|
||||
Permalinks are constructed by creating a template URL where dynamic elements
|
||||
are represented by colon-prefixed keywords. For example, the default `date`
|
||||
permalink is defined according to the format `/:categories/:year/:month/:day/:title.html`.
|
||||
You construct permalinks by creating a template URL where dynamic elements are represented by colon-prefixed keywords. The default template permalink is `/:categories/:year/:month/:day/:title.html`. Each of the colon-prefixed keywords is a template variable.
|
||||
|
||||
<div class="note info">
|
||||
<h5>Specifying permalinks through the YAML Front Matter</h5>
|
||||
<p>
|
||||
Built-in permalink styles are not recognized in YAML Front Matter. So
|
||||
<code>permalink: pretty</code> will not work, but the equivalent
|
||||
<code>/:categories/:year/:month/:day/:title/</code>
|
||||
using template variables will.
|
||||
</p>
|
||||
</div>
|
||||
## Where to configure permalinks
|
||||
|
||||
## Template variables
|
||||
You can configure your site's permalinks through the [Configuration]({% link _docs/configuration.md %}) file or in the [Front Matter]({% link _docs/frontmatter.md %}) for each post, page, or collection.
|
||||
|
||||
Setting permalink styles in your configuration file applies the setting globally in your project. You configure permalinks in your `_config.yml` file like this:
|
||||
|
||||
```yaml
|
||||
permalink: /:categories/:year/:month/:day/:title.html
|
||||
```
|
||||
|
||||
If you don't specify any permalink setting, Jekyll uses the above pattern as the default.
|
||||
|
||||
The permalink can also be set using a built-in permalink style:
|
||||
|
||||
```yaml
|
||||
permalink: date
|
||||
```
|
||||
|
||||
`date` is the same as `:categories/:year/:month/:day/:title.html`, the default. See [Built-in Permalink Styles](#builtinpermalinkstyles) below for more options.
|
||||
|
||||
Setting the permalink in your post, page, or collection's front matter overrides any global settings. Here's an example:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: My page title
|
||||
permalink: /mypageurl/
|
||||
---
|
||||
```
|
||||
|
||||
Even if your configuration file specifies the `date` style, the URL for this page would be `http://somedomain.com/mypageurl/`.
|
||||
|
||||
When you use permalinks that omit the `.html` file extension (called "pretty URLs") Jekyll builds the file as index.html placed inside a folder with the page's name. For example:
|
||||
|
||||
```
|
||||
├── mypageurl
|
||||
│ └── index.html
|
||||
```
|
||||
|
||||
With a URL such as `/mypageurl/`, servers automatically load the index.html file inside the folder, so users can simply navigate to `http://somedomain.com/mypageurl/` to get to `mypageurl/index.html`.
|
||||
|
||||
## Template variables for permalinks {#template-variables}
|
||||
|
||||
The following table lists the template variables available for permalinks. You can use these variables in the `permalink` property in your config file.
|
||||
|
||||
<div class="mobile-side-scroller">
|
||||
<table>
|
||||
|
@ -40,7 +67,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>year</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Year from the Post’s filename</p>
|
||||
<p>Year from the post's filename</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -48,7 +75,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>month</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Month from the Post’s filename</p>
|
||||
<p>Month from the post's filename</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -56,7 +83,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>i_month</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Month from the Post’s filename without leading zeros.</p>
|
||||
<p>Month from the post's filename without leading zeros.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -64,7 +91,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>day</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Day from the Post’s filename</p>
|
||||
<p>Day from the post's filename</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -72,7 +99,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>i_day</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Day from the Post’s filename without leading zeros.</p>
|
||||
<p>Day from the post's filename without leading zeros.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -80,7 +107,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
<p><code>short_year</code></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Year from the Post’s filename without the century.</p>
|
||||
<p>Year from the post's filename without the century.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -89,7 +116,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Hour of the day, 24-hour clock, zero-padded from the post’s <code>date</code> front matter. (00..23)
|
||||
Hour of the day, 24-hour clock, zero-padded from the post's <code>date</code> front matter. (00..23)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -99,7 +126,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Minute of the hour from the post’s <code>date</code> front matter. (00..59)
|
||||
Minute of the hour from the post's <code>date</code> front matter. (00..59)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -109,7 +136,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Second of the minute from the post’s <code>date</code> front matter. (00..59)
|
||||
Second of the minute from the post's <code>date</code> front matter. (00..59)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -130,8 +157,8 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Slugified title from the document’s filename ( any character
|
||||
except numbers and letters is replaced as hyphen ). May be
|
||||
Slugified title from the document’s filename (any character
|
||||
except numbers and letters is replaced as hyphen). May be
|
||||
overridden via the document’s <code>slug</code> YAML front matter.
|
||||
</p>
|
||||
</td>
|
||||
|
@ -142,7 +169,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The specified categories for this Post. If a post has multiple
|
||||
The specified categories for this post. If a post has multiple
|
||||
categories, Jekyll will create a hierarchy (e.g. <code>/category1/category2</code>).
|
||||
Also Jekyll automatically parses out double slashes in the URLs,
|
||||
so if no categories are present, it will ignore this.
|
||||
|
@ -153,10 +180,11 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
|
|||
</table>
|
||||
</div>
|
||||
|
||||
## Built-in permalink styles
|
||||
Note that all template variables relating to time or categories are available to posts only.
|
||||
|
||||
While you can specify a custom permalink style using [template variables](#template-variables),
|
||||
Jekyll also provides the following built-in styles for convenience.
|
||||
## Built-in permalink styles {#builtinpermalinkstyles}
|
||||
|
||||
Although you can specify a custom permalink pattern using [template variables](#template-variables), Jekyll also provides the following built-in styles for convenience.
|
||||
|
||||
<div class="mobile-side-scroller">
|
||||
<table>
|
||||
|
@ -203,26 +231,16 @@ Jekyll also provides the following built-in styles for convenience.
|
|||
</table>
|
||||
</div>
|
||||
|
||||
## Pages and collections
|
||||
Rather than typing `permalink: /:categories/:year/:month/:day/:title/`, you can just type `permalink: date`.
|
||||
|
||||
The `permalink` configuration setting specifies the permalink style used for
|
||||
posts. Pages and collections each have their own default permalink style; the
|
||||
default style for pages is `/:path/:basename` and the default for collections is
|
||||
`/:collection/:path`.
|
||||
<div class="note info">
|
||||
<h5>Specifying permalinks through the YAML Front Matter</h5>
|
||||
<p>Built-in permalink styles are not recognized in YAML Front Matter. As a result, <code>permalink: pretty</code> will not work.</p>
|
||||
</div>
|
||||
|
||||
These styles are modified to match the suffix style specified in the post
|
||||
permalink setting. For example, a permalink style of `pretty`, which contains a
|
||||
trailing slash, will update page permalinks to also contain a trailing slash:
|
||||
`/:path/:basename/`. A permalink style of `date`, which contains a trailing
|
||||
file extension, will update page permalinks to also contain a file extension:
|
||||
`/:path/:basename:output_ext`. The same is true for any custom permalink style.
|
||||
## Permalink style examples with posts {#permalink-style-examples}
|
||||
|
||||
The permalink for an individual page or collection document can always be
|
||||
overridden in the [YAML Front Matter](../frontmatter/) for the page or document.
|
||||
Additionally, permalinks for a given collection can be customized [in the
|
||||
collections configuration](../collections/).
|
||||
|
||||
## Permalink style examples
|
||||
Here are a few examples to clarify how permalink styles get applied with posts.
|
||||
|
||||
Given a post named: `/2009-04-29-slap-chop.md`
|
||||
|
||||
|
@ -270,7 +288,7 @@ Given a post named: `/2009-04-29-slap-chop.md`
|
|||
<tr>
|
||||
<td>
|
||||
<p><code>/:year/:month/:title</code></p>
|
||||
<p>See <a href="#extensionless-permalinks">extensionless permalinks</a> for details.</p>
|
||||
<p>See <a href="#extensionless-permalinks">Extensionless permalinks with no trailing slashes</a> for details.</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><code>/2009/04/slap-chop</code></p>
|
||||
|
@ -280,24 +298,58 @@ Given a post named: `/2009-04-29-slap-chop.md`
|
|||
</table>
|
||||
</div>
|
||||
|
||||
## Extensionless permalinks
|
||||
## Permalink settings for pages and collections {#pages-and-collections}
|
||||
|
||||
Jekyll supports permalinks that contain neither a trailing slash nor a file
|
||||
extension, but this requires additional support from the web server to properly
|
||||
serve. When using extensionless permalinks, output files written to disk will
|
||||
still have the proper file extension (typically `.html`), so the web server
|
||||
must be able to map requests without file extensions to these files.
|
||||
The permalink setting in your configuration file specifies the permalink style used for posts, pages, and collections. However, because pages and collections don't have time or categories, these aspects of the permalink style are ignored with pages and collections.
|
||||
|
||||
Both [GitHub Pages](../github-pages/) and the Jekyll's built-in WEBrick server
|
||||
handle these requests properly without any additional work.
|
||||
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 `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.
|
||||
|
||||
## Permalinks and default paths
|
||||
|
||||
The path to the post or page in the built site differs for posts, pages, and collections:
|
||||
|
||||
### Posts
|
||||
|
||||
The subfolders into which you may have organized your posts inside the `_posts` directory will not be part of the permalink.
|
||||
|
||||
If you use a permalink style that omits the `.html` file extension, each post is rendered as an `index.html` file inside a folder with the post's name (for example, `categoryname/2016/12/01/mypostname/index.html`).
|
||||
|
||||
### Pages
|
||||
|
||||
Unlike posts, pages by default mimic the source directory structure exactly. (The only exception is if your page has a `permalink` declared its front matter — in that case, the structure honors the permalink setting instead of the source folder structure.)
|
||||
|
||||
As with posts, if you use a permalink style that omits the `.html` file extension, each page is rendered as an `index.html` file inserted inside a folder with the page's name (for example, `mypage/index.html`).
|
||||
|
||||
### Collections
|
||||
|
||||
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.
|
||||
|
||||
## 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:
|
||||
|
||||
```
|
||||
---
|
||||
title: My page
|
||||
permalink: mypageurl.html
|
||||
---
|
||||
```
|
||||
|
||||
## Extensionless permalinks with no trailing slashes {#extensionless-permalinks}
|
||||
|
||||
Jekyll supports permalinks that contain neither a trailing slash nor a file extension, but this requires additional support from the web server to properly serve. When using these types of permalinks, output files written to disk will still have the proper file extension (typically `.html`), so the web server must be able to map requests without file extensions to these files.
|
||||
|
||||
Both [GitHub Pages](../github-pages/) and the Jekyll's built-in WEBrick server handle these requests properly without any additional work.
|
||||
|
||||
### Apache
|
||||
|
||||
The Apache web server has very extensive support for content negotiation and can
|
||||
handle extensionless URLs by setting the [multiviews][] option in your
|
||||
`httpd.conf` or `.htaccess` file:
|
||||
|
||||
[multiviews]: https://httpd.apache.org/docs/current/content-negotiation.html#multiviews
|
||||
The Apache web server has extensive support for content negotiation and can handle extensionless URLs by setting the [multiviews](https://httpd.apache.org/docs/current/content-negotiation.html#multiviews) option in your `httpd.conf` or `.htaccess` file:
|
||||
|
||||
{% highlight apache %}
|
||||
Options +MultiViews
|
||||
|
@ -305,13 +357,12 @@ Options +MultiViews
|
|||
|
||||
### Nginx
|
||||
|
||||
The [try_files][] directive allows you to specify a list of files to search for
|
||||
to process a request. The following configuration will instruct nginx to search
|
||||
for a file with an `.html` extension if an exact match for the requested URI is
|
||||
not found.
|
||||
|
||||
[try_files]: http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
|
||||
The [try_files](http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files) directive allows you to specify a list of files to search for to process a request. The following configuration will instruct nginx to search for a file with an `.html` extension if an exact match for the requested URI is not found.
|
||||
|
||||
{% highlight nginx %}
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
{% endhighlight %}
|
||||
|
||||
## Linking without regard to permalink styles
|
||||
|
||||
You can create links in your topics to other posts, pages, or collection items in a way that is valid no matter what permalink configuration you choose. By using the `link` tag, if you change your permalinks, your links won't break. See [Linking to pages](../templates#link) in Templates for more details.
|
||||
|
|
|
@ -771,7 +771,6 @@ LESS.js files during generation.
|
|||
- [Markdown References by Olov Lassus](https://github.com/olov/jekyll-references): Keep all your markdown reference-style link definitions in one \_references.md file.
|
||||
- [Stylus Converter](https://gist.github.com/988201): Convert .styl to .css.
|
||||
- [ReStructuredText Converter](https://github.com/xdissent/jekyll-rst): Converts ReST documents to HTML with Pygments syntax highlighting.
|
||||
- [Jekyll-pandoc-plugin](https://github.com/dsanson/jekyll-pandoc-plugin): Use pandoc for rendering markdown.
|
||||
- [Jekyll-pandoc-multiple-formats](https://github.com/fauno/jekyll-pandoc-multiple-formats) by [edsl](https://github.com/edsl): Use pandoc to generate your site in multiple formats. Supports pandoc’s markdown extensions.
|
||||
- [Transform Layouts](https://gist.github.com/1472645): Allows HAML layouts (you need a HAML Converter plugin for this to work).
|
||||
- [Org-mode Converter](https://gist.github.com/abhiyerra/7377603): Org-mode converter for Jekyll.
|
||||
|
@ -918,6 +917,8 @@ LESS.js files during generation.
|
|||
- [jekyll-data](https://github.com/ashmaroli/jekyll-data): Read data files within Jekyll Theme Gems.
|
||||
- [jekyll-pinboard](https://github.com/snaptortoise/jekyll-pinboard-plugin): Access your Pinboard bookmarks within your Jekyll theme.
|
||||
- [jekyll-migrate-permalink](https://github.com/mpchadwick/jekyll-migrate-permalink): Adds a `migrate-permalink` sub-command to help deal with side effects of changing your permalink.
|
||||
- [Jekyll-Post](https://github.com/robcrocombe/jekyll-post): A CLI tool to easily draft, edit, and publish Jekyll posts.
|
||||
- [jekyll-numbered-headings](https://github.com/muratayusuke/jekyll-numbered-headings): Adds ordered number to headings.
|
||||
|
||||
#### Editors
|
||||
|
||||
|
|
|
@ -111,6 +111,24 @@ Linking to a PDF for readers to download:
|
|||
</p>
|
||||
</div>
|
||||
|
||||
## 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 an Title, Layout, Publishing Date, and Categories might look like this:
|
||||
|
||||
```
|
||||
---
|
||||
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."
|
||||
|
||||
## Displaying an index of posts
|
||||
|
||||
It’s all well and good to have posts in a folder, but a blog is no use unless
|
||||
|
|
|
@ -4,25 +4,42 @@ title: Quick-start guide
|
|||
permalink: /docs/quickstart/
|
||||
---
|
||||
|
||||
For the impatient, here's how to get a boilerplate Jekyll site up and running.
|
||||
If you already have [Ruby](https://www.ruby-lang.org/en/downloads/) and [RubyGems](https://rubygems.org/pages/download) installed (see Jekyll's [requirements](/docs/installation/#requirements/)), you can create a new Jekyll site by doing the following:
|
||||
|
||||
```sh
|
||||
# Install Jekyll and Bundler gems through RubyGems
|
||||
~ $ gem install jekyll bundler
|
||||
|
||||
# Create a new Jekyll site at ./myblog
|
||||
~ $ jekyll new myblog
|
||||
|
||||
# Change into your new directory
|
||||
~ $ cd myblog
|
||||
|
||||
# Build the site on the preview server
|
||||
~/myblog $ bundle exec jekyll serve
|
||||
# => Now browse to http://localhost:4000
|
||||
|
||||
# Now browse to http://localhost:4000
|
||||
```
|
||||
|
||||
The `jekyll new` command now automatically initiates `bundle install` and installs the dependencies required. To skip this, pass `--skip-bundle` option like so `jekyll new myblog --skip-bundle`.
|
||||
## About Bundler
|
||||
|
||||
If you wish to install jekyll into an existing directory, you can do so by running `jekyll new .` from within the directory instead of creating a new one. If the existing directory isn't empty, you'll also have to pass the `--force` option like so `jekyll new . --force`.
|
||||
`gem install jekyll bundler` installs the [jekyll](https://rubygems.org/gems/jekyll/) and [bundler](https://rubygems.org/gems/bundler) gems through [RubyGems](https://rubygems.org/). You need only to install the gems one time — not every time you create a new Jekyll project. Here are some additional details:
|
||||
|
||||
That's nothing, though. The real magic happens when you start creating blog
|
||||
posts, using the front matter to control templates and layouts, and taking
|
||||
advantage of all the awesome configuration options Jekyll makes available.
|
||||
* `bundler` is a gem that manages other Ruby gems. It makes sure your gems and gem versions are compatible, and that you have all necessary dependencies each gem requires.
|
||||
* The `Gemfile` and `Gemfile.lock` files inform Bundler about the gem requirements in your site. If your site doesn't have these Gemfiles, you can omit `bundle exec` and just run `jekyll serve`.
|
||||
|
||||
If you're running into problems, ensure you have all the [requirements
|
||||
installed][Installation].
|
||||
* When you run `bundle exec jekyll serve`, Bundler uses the gems and versions as specified in `Gemfile.lock` to ensure your Jekyll site builds with no compatibility or dependency conflicts.
|
||||
|
||||
[Installation]: /docs/installation/
|
||||
## Options for creating a new site with Jekyll
|
||||
|
||||
`jekyll new <PATH>` installs a new Jekyll site at the path specified (relative to current directory). In this case, Jekyll will be installed in a directory called `myblog`. Here are some additional details:
|
||||
|
||||
* To install the Jekyll site into the directory you're currently in, run `jekyll new .` If the existing directory isn't empty, you can pass the `--force` option with `jekyll new . --force`.
|
||||
* `jekyll new` automatically initiates `bundle install` to install the dependencies required. (If you don't want Bundler to install the gems, use `jekyll new myblog --skip-bundle`.)
|
||||
* By default, the Jekyll site installed by `jekyll new` uses a gem-based theme called [Minima](https://github.com/jekyll/minima). With [gem-based themes](../themes), some of the directories and files are stored in the theme-gem, hidden from your immediate view.
|
||||
* To learn about other parameters you can include with `jekyll new`, type `jekyll new --help`.
|
||||
|
||||
## Next steps
|
||||
|
||||
Building a Jekyll site with the default theme is just the first step. The real magic happens when you start creating blog posts, using the front matter to control templates and layouts, and taking advantage of all the awesome configuration options Jekyll makes available.
|
||||
|
|
|
@ -67,7 +67,7 @@ Add your template files in the corresponding folders, complete the `.gemspec` an
|
|||
|
||||
Theme layouts and includes work just like they work in any Jekyll site. Place layouts in your theme's `/_layouts` folder, and place includes in your themes `/_includes` folder.
|
||||
|
||||
For example, if your theme has a `/_layouts/page.html` file, and a page has `layout: page` in its YAML front matter, Jekyll will first look to the site's `_layouts` folder for a the `page` layout, and if none exists, will use your theme's `page` layout.
|
||||
For example, if your theme has a `/_layouts/page.html` file, and a page has `layout: page` in its YAML front matter, Jekyll will first look to the site's `_layouts` folder for the `page` layout, and if none exists, will use your theme's `page` layout.
|
||||
|
||||
### Assets
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ A quick way to install Jekyll is to follow the [installation instructions by Dav
|
|||
2. Install Ruby via Chocolatey: `choco install ruby -y`
|
||||
3. Reopen a command prompt and install Jekyll: `gem install jekyll`
|
||||
|
||||
Updates in the infrastructure of Ruby may cause SSL errors when attempting to use `gem install` with versions of the RubyGems package older than 2.6. (The RubyGems package installed via the Chocolatey tool is version 2.3) If you have installed an older version, you can update the RubyGems package using the directions [here.][ssl-certificate-update]
|
||||
[ssl-certificate-update]: http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
|
||||
|
||||
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].
|
||||
|
||||
[windows-installjekyll3]: https://labs.sverrirs.com/jekyll/
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
lib = File.expand_path("../lib", __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'jekyll/version'
|
||||
require "jekyll/version"
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
||||
s.rubygems_version = '2.2.2'
|
||||
s.required_ruby_version = '>= 2.0.0'
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.rubygems_version = "2.2.2"
|
||||
s.required_ruby_version = ">= 2.0.0"
|
||||
|
||||
s.name = 'jekyll'
|
||||
s.name = "jekyll"
|
||||
s.version = Jekyll::VERSION
|
||||
s.license = 'MIT'
|
||||
s.license = "MIT"
|
||||
|
||||
s.summary = 'A simple, blog aware, static site generator.'
|
||||
s.description = 'Jekyll is a simple, blog aware, static site generator.'
|
||||
s.summary = "A simple, blog aware, static site generator."
|
||||
s.description = "Jekyll is a simple, blog aware, static site generator."
|
||||
|
||||
s.authors = ['Tom Preston-Werner']
|
||||
s.email = 'tom@mojombo.com'
|
||||
s.homepage = 'https://github.com/jekyll/jekyll'
|
||||
s.authors = ["Tom Preston-Werner"]
|
||||
s.email = "tom@mojombo.com"
|
||||
s.homepage = "https://github.com/jekyll/jekyll"
|
||||
|
||||
all_files = `git ls-files -z`.split("\x0")
|
||||
s.files = all_files.grep(%r{^(exe|lib)/|^.rubocop.yml$})
|
||||
s.executables = all_files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||
s.files = all_files.grep(%r!^(exe|lib)/|^.rubocop.yml$!)
|
||||
s.executables = all_files.grep(%r!^exe/!) { |f| File.basename(f) }
|
||||
s.bindir = "exe"
|
||||
s.require_paths = ['lib']
|
||||
s.require_paths = ["lib"]
|
||||
|
||||
s.rdoc_options = ['--charset=UTF-8']
|
||||
s.extra_rdoc_files = %w[README.markdown LICENSE]
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.extra_rdoc_files = %w(README.markdown LICENSE)
|
||||
|
||||
s.add_runtime_dependency('liquid', '~> 4.0')
|
||||
s.add_runtime_dependency('kramdown', '~> 1.3')
|
||||
s.add_runtime_dependency('mercenary', '~> 0.3.3')
|
||||
s.add_runtime_dependency('safe_yaml', '~> 1.0')
|
||||
s.add_runtime_dependency('colorator', '~> 1.0')
|
||||
s.add_runtime_dependency('rouge', '~> 1.7')
|
||||
s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0')
|
||||
s.add_runtime_dependency('jekyll-watch', '~> 1.1')
|
||||
s.add_runtime_dependency("pathutil", "~> 0.9")
|
||||
s.add_runtime_dependency('addressable', '~> 2.4')
|
||||
s.add_runtime_dependency("addressable", "~> 2.4")
|
||||
s.add_runtime_dependency("colorator", "~> 1.0")
|
||||
s.add_runtime_dependency("jekyll-sass-converter", "~> 1.0")
|
||||
s.add_runtime_dependency("jekyll-watch", "~> 1.1")
|
||||
s.add_runtime_dependency("kramdown", "~> 1.3")
|
||||
s.add_runtime_dependency("liquid", "~> 4.0")
|
||||
s.add_runtime_dependency("mercenary", "~> 0.3.3")
|
||||
s.add_runtime_dependency("pathutil", "~> 0.9")
|
||||
s.add_runtime_dependency("rouge", "~> 1.7")
|
||||
s.add_runtime_dependency("safe_yaml", "~> 1.0")
|
||||
end
|
||||
|
|
|
@ -32,8 +32,8 @@ module Jekyll
|
|||
# Override of method_missing to check in @data for the key.
|
||||
def method_missing(method, *args, &blck)
|
||||
if docs.respond_to?(method.to_sym)
|
||||
Jekyll.logger.warn "Deprecation:", "#{label}.#{method} should be changed to" \
|
||||
"#{label}.docs.#{method}."
|
||||
Jekyll.logger.warn "Deprecation:",
|
||||
"#{label}.#{method} should be changed to #{label}.docs.#{method}."
|
||||
Jekyll.logger.warn "", "Called by #{caller.first}."
|
||||
docs.public_send(method.to_sym, *args, &blck)
|
||||
else
|
||||
|
@ -197,6 +197,7 @@ module Jekyll
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def read_document(full_path)
|
||||
doc = Jekyll::Document.new(full_path, :site => site, :collection => self)
|
||||
doc.read
|
||||
|
@ -208,14 +209,20 @@ module Jekyll
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def read_static_file(file_path, full_path)
|
||||
relative_dir = Jekyll.sanitized_path(
|
||||
relative_directory,
|
||||
File.dirname(file_path)
|
||||
).chomp("/.")
|
||||
|
||||
files << StaticFile.new(site, site.source, relative_dir,
|
||||
File.basename(full_path), self)
|
||||
files << StaticFile.new(
|
||||
site,
|
||||
site.source,
|
||||
relative_dir,
|
||||
File.basename(full_path),
|
||||
self
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,8 +30,7 @@ module Jekyll
|
|||
@data
|
||||
end
|
||||
|
||||
def trigger_hooks(*)
|
||||
end
|
||||
def trigger_hooks(*); end
|
||||
|
||||
# 'Path' of the excerpt.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "uri"
|
||||
require "addressable/uri"
|
||||
require "json"
|
||||
require "date"
|
||||
require "liquid"
|
||||
|
@ -152,7 +152,7 @@ module Jekyll
|
|||
#
|
||||
# Returns the escaped String.
|
||||
def uri_escape(input)
|
||||
URI.escape(input)
|
||||
Addressable::URI.encode(input)
|
||||
end
|
||||
|
||||
# Replace any whitespace in the input string with a single space
|
||||
|
|
|
@ -71,7 +71,7 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def retrieve_dirs(_base, dir, dot_dirs)
|
||||
dot_dirs.map do |file|
|
||||
dot_dirs.each do |file|
|
||||
dir_path = site.in_source_dir(dir, file)
|
||||
rel_path = File.join(dir, file)
|
||||
unless @site.dest.sub(%r!/$!, "") == dir_path
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "uri"
|
||||
require "addressable/uri"
|
||||
|
||||
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
||||
#
|
||||
|
@ -145,7 +145,8 @@ module Jekyll
|
|||
# pct-encoded = "%" HEXDIG HEXDIG
|
||||
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
# / "*" / "+" / "," / ";" / "="
|
||||
URI.escape(path, %r{[^a-zA-Z\d\-._~!$&'()*+,;=:@\/]}).encode("utf-8")
|
||||
path = Addressable::URI.encode(path)
|
||||
path.encode("utf-8").sub("#", "%23")
|
||||
end
|
||||
|
||||
# Unescapes a URL path segment
|
||||
|
@ -159,7 +160,7 @@ module Jekyll
|
|||
#
|
||||
# Returns the unescaped path.
|
||||
def self.unescape_path(path)
|
||||
URI.unescape(path.encode("utf-8"))
|
||||
Addressable::URI.unencode(path.encode("utf-8"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 <%= user_name %>
|
||||
Copyright (c) <%= Time.now.year %> <%= user_name %>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -10,13 +10,17 @@ esac
|
|||
export BENCHMARK=true
|
||||
command -v stackprof > /dev/null || script/bootstrap
|
||||
|
||||
TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site'})"
|
||||
TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'docs'})"
|
||||
PROF_OUTPUT_FILE=tmp/stackprof-${STACKPROF_MODE}-$(date +%Y%m%d%H%M).dump
|
||||
|
||||
GC_BEFORE="puts 'GC Stats:'; puts JSON.pretty_generate(GC.stat); GC.disable"
|
||||
GC_AFTER="puts 'GC Stats:'; GC.start(full_mark: true, immediate_sweep: false); puts JSON.pretty_generate(GC.stat);"
|
||||
|
||||
echo Stackprof Mode: $STACKPROF_MODE
|
||||
test -f "$PROF_OUTPUT_FILE" || {
|
||||
bundle exec ruby -r./lib/jekyll -rstackprof \
|
||||
-e "StackProf.run(mode: :${STACKPROF_MODE}, interval: 100, out: '${PROF_OUTPUT_FILE}') { ${TEST_SCRIPT} }"
|
||||
bundle exec ruby -r./lib/jekyll -rstackprof -rjson \
|
||||
-e "StackProf.run(mode: :${STACKPROF_MODE}, interval: 100, out: '${PROF_OUTPUT_FILE}') { ${GC_BEFORE}; ${TEST_SCRIPT}; ${GC_AFTER}; }"
|
||||
}
|
||||
|
||||
bundle exec stackprof $PROF_OUTPUT_FILE $@
|
||||
set -x
|
||||
bundle exec stackprof $PROF_OUTPUT_FILE $@ --sort-total
|
||||
|
|
|
@ -21,7 +21,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
|
||||
should "affect only the specified path and type" do
|
||||
assert_equal @affected.data["key"], "val"
|
||||
assert_equal @not_affected.data["key"], nil
|
||||
assert_nil @not_affected.data["key"]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
|
||||
should "affect only the specified path" do
|
||||
assert_equal @affected.data["key"], "val"
|
||||
assert_equal @not_affected.data["key"], nil
|
||||
assert_nil @not_affected.data["key"]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -69,7 +69,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
|
||||
should "affect only the specified path and all types" do
|
||||
assert_equal @affected.data["key"], "val"
|
||||
assert_equal @not_affected.data["key"], nil
|
||||
assert_nil @not_affected.data["key"]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue