Merge remote-tracking branch 'jekyll/master' into patch-1

This commit is contained in:
Heng Kwokfu 2016-09-24 08:46:24 +08:00
commit db53213d16
85 changed files with 1165 additions and 606 deletions

View File

@ -4,18 +4,21 @@
and check.) If there is no need for certain fields like output and redirection, please delete and check.) If there is no need for certain fields like output and redirection, please delete
those headers before submitting. We know not all tickets require those steps. those headers before submitting. We know not all tickets require those steps.
Otherwise, please try to be as detailed as possible. Otherwise, please try to be as detailed as possible.
If you are unsure this is a bug in Jekyll, or this is a bug caused If you are unsure this is a bug in Jekyll, or this is a bug caused
by a plugin that isn't directly related to Jekyll, or if this is just by a plugin that isn't directly related to Jekyll, or if this is just
a generic usage question, please consider asking your question at a generic usage question, please consider asking your question at
https://talk.jekyllrb.com where non-bug questions go. https://talk.jekyllrb.com where non-bug questions go.
Please make sure to mention an affinity team whose responsibilities
most closely align with your issue.
Thanks! Thanks!
--> -->
- [ ] I believe this to be a bug, not a question about using Jekyll. - [ ] I believe this to be a bug, not a question about using Jekyll.
- [ ] I Updated to the latest Jekyll (or) if on Github Pages to the latest `github-pages` - [ ] I updated to the latest Jekyll (or) if on GitHub Pages to the latest `github-pages`
- [ ] I Read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/ - [ ] I read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
- [ ] This is a feature request. - [ ] This is a feature request.
--- ---
@ -38,20 +41,20 @@
- [ ] I was trying to install. - [ ] I was trying to install.
- [ ] There is a broken Plugin API. - [ ] There is a broken Plugin API.
- [ ] I had an error on Github Pages, and I have not tested locally. - [ ] I had an error on GitHub Pages, and I have reproduced it locally.
- [ ] I had an error on Github Pages, and Github Support said it was a Jekyll Bug. - [ ] I had an error on GitHub Pages, and GitHub Support said it was a Jekyll Bug.
- [ ] I had an error on Github Pages and I did not test it locally. - [ ] I had an error on GitHub Pages and I did not test it locally.
- [ ] I was trying to build. - [ ] I was trying to build.
- [ ] It was another bug. - [ ] It was another bug.
## My Reproduction Steps ## My Reproduction Steps
<!-- <!--
If this error occured on Github Pages, please try to provide us with logs, If this error occured on GitHub Pages, please try to provide us with logs,
and look at them yourself, to determine if this is an actual Jekyll bug. In and look at them yourself, to determine if this is an actual Jekyll bug. In
the event you are unsure, file a ticket, however, when you do please provide the event you are unsure, file a ticket, however, when you do please provide
the logs (strip them of personal information.) the logs (strip them of personal information.)
If you have trouble finding your logs, please email support@github.com and If you have trouble finding your logs, please email support@github.com and
they will happily help you. If you cannot find logs, please try your best to they will happily help you. If you cannot find logs, please try your best to
replicate it locally because we cannot fix a problem if we do not know replicate it locally because we cannot fix a problem if we do not know
@ -62,17 +65,18 @@
Insert the steps you took to for this problem to exist. Such as the Insert the steps you took to for this problem to exist. Such as the
directories you created and, the full command you ran, and include any directories you created and, the full command you ran, and include any
plugins you have installed, this is very important. plugins you have installed, this is very important.
If your steps are complicated, you can also submit a Github If your steps are complicated, you can also submit a GitHub
repository (please no zips, they will be removed and rejected by maintainers,) repository (please no zips, they will be removed and rejected by maintainers,)
and just supply a command for us to reproduce it ourselves. and just supply a command for us to reproduce it ourselves.
--> -->
## The Output I Wanted ## The Output I Wanted
<!-- <!--
Insert the output from the command. Alter it as little as you can. Insert the output from the command. Alter it as little as you can.
The minimum should be personal information. Though we normally don't log The minimum should be personal information. Though we normally don't log
anything like that so there should be no need to alter it. anything like that so there should be no need to alter it.
--> -->
/cc include any Jekyll affinity teams here (see https://teams.jekyllrb.com/ for more info)

View File

@ -4,8 +4,6 @@ AllCops:
Include: Include:
- lib/**/*.rb - lib/**/*.rb
Exclude: Exclude:
- lib/jekyll/convertible.rb
- lib/jekyll/document.rb
- lib/jekyll/renderer.rb - lib/jekyll/renderer.rb
- bin/**/* - bin/**/*
- benchmark/**/* - benchmark/**/*
@ -18,14 +16,14 @@ Lint/UnreachableCode:
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
Enabled: false Enabled: false
Metrics/AbcSize: Metrics/AbcSize:
Max: 20 Max: 21
Metrics/ClassLength: Metrics/ClassLength:
Exclude: Exclude:
- !ruby/regexp /features\/.*.rb$/ - !ruby/regexp /features\/.*.rb$/
- !ruby/regexp /test\/.*.rb$/ - !ruby/regexp /test\/.*.rb$/
Max: 300 Max: 300
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 8 Max: 9
Metrics/LineLength: Metrics/LineLength:
Exclude: Exclude:
- !ruby/regexp /features\/.*.rb/ - !ruby/regexp /features\/.*.rb/

View File

@ -1,8 +1,31 @@
## HEAD ## HEAD
### Minor Enhancements
* Colorize interpolated output in logger.info (#5239)
* Site template: exclude Gemfile and Gemfile.lock in site config (#5293)
* Fix #5233: Increase our ability to detect Windows. (#5235)
* update gitignore template to ignore theme gems built by user (#5326)
* Adds ability to link to all files (#5199)
* Exclude vendor by default (#5361)
* Add ThemeAssetsReader which reads assets from a theme (#5364)
* Add bundle install to jekyll new command (#5237)
* Add absolute_url and relative_url filters. (#5399)
* Site template: remove `css/` from new site scaffolding (#5402)
### Bug Fixes
* Use jekyll-feed to generate the default site's RSS feed (#5196)
* Site#configure_theme: do not set theme unless it's a string (#5189)
* Convertible: set self.output in #render_all_layouts and #do_layout (#5337)
* Only complain about `kramdown.coderay` if it is actually in the config (#5380)
* Clarify documentation in theme gem's README template (#5376)
* Allow underscore in highlighter language (#5375)
* Site template: set empty url in config file by default (#5338)
### Site Enhancements ### Site Enhancements
* Document for to_integer and inspect filters (#5185) * Document `to_integer` and `inspect` filters (#5185)
* Fix path in the prompt (#5194) * Fix path in the prompt (#5194)
* need subcommand build (#5190) * need subcommand build (#5190)
* Add the Jekyll Cloudinary plugin (#5183) * Add the Jekyll Cloudinary plugin (#5183)
@ -11,23 +34,46 @@
* Remove mention of page for link tag in release post (#5214) * Remove mention of page for link tag in release post (#5214)
* fixed typo (#5226) * fixed typo (#5226)
* Add missing comma (#5222) * Add missing comma (#5222)
* Maintain aspect ratio with height: auto; (#5254) * Maintain aspect ratio with `height: auto;` (#5254)
* Fix a link in deployment-methods.md (#5244) * Fix a link in deployment-methods.md (#5244)
* Documentation: improve highlight in `Creating a theme` (#5249) * Documentation: improve highlight in `Creating a theme` (#5249)
* Bundler isn't installed by default (#5258)
* Update troubleshooting documentation to include fix for issue with vendored gems (#5271)
* Link `--lsi` option's description to Wikipedia docs on LSI (#5274)
* Document `--profile` option on the configuration page (#5279)
* Update homepage to sync with merge of #5258 (#5287)
* Add post about Jekyll Admin initial release (#5291)
* Replace liquid highlight tag with backticks (#5262)
* Word update (#5294)
* Site documentation section links always point to https://jekyllrb.com (#5281)
* Missing `:site, :post_render` payload documentation on site (#5280)
* Site: exclude README.md and .gitignore (#5304)
* Add link to Staticman (#5224)
* Update url for OpenShift (#5320)
* [docs] add help for missing static_file e.g. on heroku (#5334)
* Add a line about updating theme-gems in the docs (#5318)
* Explain how to copy a theme's files (#5335)
* [docs] .md as default extension in examples (#5316)
* Fix small typo in docs (#5347)
* Add missing period to sentence in first paragraph. (#5372)
* added jekyll-spotify plugin (#5369)
* Add jekyll-menus to the list of plugins. (#5397)
### Development Fixes ### Development Fixes
* Update appveyor.yml and fix optional deps for Ruby x64 (#5180) * Update appveyor.yml and fix optional deps for Ruby x64 (#5180)
* Improve tests for Jekyll::PluginManager (#5167) * Improve tests for Jekyll::PluginManager (#5167)
* Update Ruby versions in travis.yml (#5221) * Update Ruby versions in travis.yml (#5221)
* Avoid installing unecessary gems for site testing (#5272)
### Bug Fixes * Proposal: Affinity teams and their captains (#5273)
* Replace duplicate with postive local test in issue template (#5286)
* Use jekyll-feed to generate the default site's RSS feed (#5196) * Update AppVeyor config. (#5240)
* Execute jekyll from clone instead of defined binary when running 'script/default-site' (#5295)
### Minor Enhancements * rubocop: lib/jekyll/document.rb complexity fixes (#5045)
* Proxy a number of Convertible methods to Renderer (#5308)
* Colorize interpolated output in logger.info (#5239) * Run executable for Cucumber via Ruby instead of Shell (#5383)
* Appease Rubocop (#5381)
* remove features' directories on windows with proper access (#5389)
## 3.2.1 / 2016-08-02 ## 3.2.1 / 2016-08-02

View File

@ -1,5 +1,3 @@
# https://www.appveyor.com/docs/appveyor-yml
version: "{build}" version: "{build}"
clone_depth: 10 clone_depth: 10
@ -13,31 +11,24 @@ build: off
install: install:
- SET PATH=C:\Ruby%RUBY_FOLDER_VER%\bin;%PATH% - SET PATH=C:\Ruby%RUBY_FOLDER_VER%\bin;%PATH%
- bundle install --retry 5 - bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS% --clean --path vendor\bundle
environment: environment:
BUNDLE_WITHOUT: "benchmark:site:development" BUNDLE_WITHOUT: "benchmark:site:development"
matrix: matrix:
- RUBY_FOLDER_VER: "23" - RUBY_FOLDER_VER: "23"
GEMS_FOLDER_VER: "2.3.0"
TEST_SUITE: "test" TEST_SUITE: "test"
- RUBY_FOLDER_VER: "23" - RUBY_FOLDER_VER: "23"
GEMS_FOLDER_VER: "2.3.0"
TEST_SUITE: "cucumber" TEST_SUITE: "cucumber"
- RUBY_FOLDER_VER: "23" - RUBY_FOLDER_VER: "23"
GEMS_FOLDER_VER: "2.3.0"
TEST_SUITE: "fmt" TEST_SUITE: "fmt"
- RUBY_FOLDER_VER: "23" - RUBY_FOLDER_VER: "23"
GEMS_FOLDER_VER: "2.3.0"
TEST_SUITE: "default-site" TEST_SUITE: "default-site"
- RUBY_FOLDER_VER: "23-x64" - RUBY_FOLDER_VER: "23-x64"
GEMS_FOLDER_VER: "2.3.0"
TEST_SUITE: "test" TEST_SUITE: "test"
- RUBY_FOLDER_VER: "22" - RUBY_FOLDER_VER: "22"
GEMS_FOLDER_VER: "2.2.0"
TEST_SUITE: "test" TEST_SUITE: "test"
- RUBY_FOLDER_VER: "21" - RUBY_FOLDER_VER: "21"
GEMS_FOLDER_VER: "2.1.0"
TEST_SUITE: "test" TEST_SUITE: "test"
test_script: test_script:
@ -48,5 +39,4 @@ test_script:
cache: cache:
# If one of the files after the right arrow changes, cache will be skipped # If one of the files after the right arrow changes, cache will be skipped
- C:\Ruby%RUBY_FOLDER_VER%\bin -> Gemfile,jekyll.gemspec,appveyor.yml - 'vendor\bundle -> appveyor.yml,Gemfile,jekyll.gemspec'
- C:\Ruby%RUBY_FOLDER_VER%\lib\ruby\gems\%GEMS_FOLDER_VER% -> Gemfile,jekyll.gemspec,appveyor.yml

View File

@ -0,0 +1,25 @@
# Affinity Team Captains
**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 its definitely not for everyone.
## Affinity teams & their captains
The Jekyll project uses [affinity teams][] to help break up the work of incoming issues and pull requests from community members. We receive a sizeable number of issues and pull requests each week; the use of affinity teams helps distribute this load across a number of specialized groups instead of pushing it all onto @jekyll/core.
## Responsibilities of Team Captains
Each affinity team has a few captains who manage the issues and pull requests for that team. When an issue or PR is opened with a `/cc` for a given affinity team, @jekyllbot automatically assigns a random affinity team captain to the issue to triage it. They have access to add labels, reassign the issue, give LGTM's, and so forth. While they do not merge PR's today, they are still asked to review PR's for parts of the codebase under their purview.
## How do I become a team captain?
Just ask! Feel free to open an issue on `jekyll/jekyll` and add `/cc @jekyll/core`. We can add you. :smile:
Alternatively, you can email or otherwise reach out to [@parkr](https://github.com/parkr) directly if you prefer the more private route.
## Ugh, I'm tired and don't have time to be a captain anymore. What now?
No sweat at all! Email [@parkr](https://github.com/parkr) and ask to be removed. Alternatively, you should be able to go to your team's page on GitHub.com (go to https://github.com/jekyll, click "Teams", click the link to your team) and change your status to either "member" or leave the team.
We realize that being a captain is no easy feat so we want to make it a great experience. As always, communicate as much as you can with us about what is working, and what isn't. Thanks for dedicating some time to Jekyll! :sparkles:
[affinity teams]: https://teams.jekyllrb.com/

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
STDOUT.sync = true STDOUT.sync = true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w(.. lib))) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "jekyll" require "jekyll"
require "mercenary" require "mercenary"

View File

@ -1,4 +1,5 @@
Before do Before do
FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist?
FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory? FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory?
Dir.chdir(Paths.test_dir) Dir.chdir(Paths.test_dir)
end end
@ -6,7 +7,7 @@ end
# #
After do After do
Paths.test_dir.rmtree if Paths.test_dir.exist? FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist?
Paths.output_file.delete if Paths.output_file.exist? Paths.output_file.delete if Paths.output_file.exist?
Paths.status_file.delete if Paths.status_file.exist? Paths.status_file.delete if Paths.status_file.exist?
Dir.chdir(Paths.test_dir.parent) Dir.chdir(Paths.test_dir.parent)

View File

@ -90,7 +90,7 @@ end
def run_jekyll(args) def run_jekyll(args)
args = args.strip.split(" ") # Shellwords? args = args.strip.split(" ") # Shellwords?
process = run_in_shell(Paths.jekyll_bin.to_s, *args, "--trace") process = run_in_shell("ruby", Paths.jekyll_bin.to_s, *args, "--trace")
process.exitstatus.zero? process.exitstatus.zero?
end end

View File

@ -17,7 +17,7 @@ Feature: Writing themes
Scenario: A theme with SCSS Scenario: A theme with SCSS
Given I have a configuration file with "theme" set to "test-theme" Given I have a configuration file with "theme" set to "test-theme"
And I have a css directory And I have a css directory
And I have a "css/main.scss" page that contains "@import 'style';" And I have a "css/main.scss" page that contains "@import 'test-theme-black';"
When I run jekyll build When I run jekyll build
Then I should get a zero exit status Then I should get a zero exit status
And the _site directory should exist And the _site directory should exist

View File

@ -55,6 +55,7 @@ module Jekyll
autoload :PostReader, "jekyll/readers/post_reader" autoload :PostReader, "jekyll/readers/post_reader"
autoload :PageReader, "jekyll/readers/page_reader" autoload :PageReader, "jekyll/readers/page_reader"
autoload :StaticFileReader, "jekyll/readers/static_file_reader" autoload :StaticFileReader, "jekyll/readers/static_file_reader"
autoload :ThemeAssetsReader, "jekyll/readers/theme_assets_reader"
autoload :LogAdapter, "jekyll/log_adapter" autoload :LogAdapter, "jekyll/log_adapter"
autoload :Page, "jekyll/page" autoload :Page, "jekyll/page"
autoload :PluginManager, "jekyll/plugin_manager" autoload :PluginManager, "jekyll/plugin_manager"

View File

@ -71,12 +71,23 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def watch(site, options) def watch(site, options)
External.require_with_graceful_fail "jekyll-watch" if Utils::Platforms.windows?
watch_method = Jekyll::Watcher.method(:watch) Jekyll.logger.warn "", "--watch arg is unsupported on Windows. "
if watch_method.parameters.size == 1 Jekyll.logger.warn "", "If you are on Windows Bash, please see: " \
watch_method.call(options) "https://github.com/Microsoft/BashOnWindows/issues/216"
else else
watch_method.call(options, site) External.require_with_graceful_fail "jekyll-watch"
watch_method = Jekyll::Watcher.method(:watch)
if watch_method.parameters.size == 1
watch_method.call(
options
)
else
watch_method.call(
options, site
)
end
end end
end end
end # end of class << self end # end of class << self

View File

@ -11,6 +11,7 @@ module Jekyll
c.option "force", "--force", "Force creation even if PATH already exists" c.option "force", "--force", "Force creation even if PATH already exists"
c.option "blank", "--blank", "Creates scaffolding but with empty files" c.option "blank", "--blank", "Creates scaffolding but with empty files"
c.option "skip-bundle", "--skip-bundle", "Skip 'bundle install'"
c.action do |args, options| c.action do |args, options|
Jekyll::Commands::New.process(args, options) Jekyll::Commands::New.process(args, options)
@ -34,7 +35,7 @@ module Jekyll
create_site new_blog_path create_site new_blog_path
end end
Jekyll.logger.info "New jekyll site installed in #{new_blog_path.cyan}." after_install(new_blog_path, options)
end end
def create_blank_site(path) def create_blank_site(path)
@ -114,6 +115,27 @@ RUBY
def scaffold_path def scaffold_path
"_posts/0000-00-00-welcome-to-jekyll.markdown.erb" "_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
end end
# After a new blog has been created, print a success notification and
# then automatically execute bundle install from within the new blog dir
# unless the user opts to generate a blank blog or skip 'bundle install'.
def after_install(path, options = {})
Jekyll.logger.info "New jekyll site installed in #{path.cyan}."
Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"]
unless options["blank"] || options["skip-bundle"]
bundle_install path
end
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
system("bundle", "install")
end
end
end end
end end
end end

View File

@ -17,7 +17,7 @@ module Jekyll
# Handling Reading # Handling Reading
"safe" => false, "safe" => false,
"include" => [".htaccess"], "include" => [".htaccess"],
"exclude" => [], "exclude" => ["vendor"],
"keep_files" => [".git", ".svn"], "keep_files" => [".git", ".svn"],
"encoding" => "utf-8", "encoding" => "utf-8",
"markdown_ext" => "markdown,mkdown,mkdn,mkd,md", "markdown_ext" => "markdown,mkdown,mkdn,mkd,md",

View File

@ -104,7 +104,7 @@ module Jekyll
private private
def modernize_coderay_config def modernize_coderay_config
if highlighter == "coderay" unless @config["coderay"].empty?
Jekyll::Deprecator.deprecation_message( Jekyll::Deprecator.deprecation_message(
"You are using 'kramdown.coderay' in your configuration, " \ "You are using 'kramdown.coderay' in your configuration, " \
"please use 'syntax_highlighter_opts' instead." "please use 'syntax_highlighter_opts' instead."

View File

@ -35,6 +35,7 @@ module Jekyll
# opts - optional parameter to File.read, default at site configs # opts - optional parameter to File.read, default at site configs
# #
# Returns nothing. # Returns nothing.
# rubocop:disable Metrics/AbcSize
def read_yaml(base, name, opts = {}) def read_yaml(base, name, opts = {})
filename = File.join(base, name) filename = File.join(base, name)
@ -58,6 +59,7 @@ module Jekyll
self.data self.data
end end
# rubocop:enable Metrics/AbcSize
def validate_data!(filename) def validate_data!(filename)
unless self.data.is_a?(Hash) unless self.data.is_a?(Hash)
@ -76,18 +78,7 @@ module Jekyll
# #
# Returns the transformed contents. # Returns the transformed contents.
def transform def transform
converters.reduce(content) do |output, converter| _renderer.transform
begin
converter.convert output
rescue => e
Jekyll.logger.error(
"Conversion error:",
"#{converter.class} encountered an error while converting '#{path}':"
)
Jekyll.logger.error("", e.to_s)
raise e
end
end
end end
# Determine the extension depending on content_type. # Determine the extension depending on content_type.
@ -95,7 +86,7 @@ module Jekyll
# Returns the String extension for the output file. # Returns the String extension for the output file.
# e.g. ".html" for an HTML output file. # e.g. ".html" for an HTML output file.
def output_ext def output_ext
Jekyll::Renderer.new(site, self).output_ext _renderer.output_ext
end end
# Determine which converter to use based on this convertible's # Determine which converter to use based on this convertible's
@ -103,7 +94,7 @@ module Jekyll
# #
# Returns the Converter instance. # Returns the Converter instance.
def converters def converters
@converters ||= site.converters.select { |c| c.matches(ext) }.sort _renderer.converters
end end
# Render Liquid in the content # Render Liquid in the content
@ -114,17 +105,7 @@ module Jekyll
# #
# Returns the converted content # Returns the converted content
def render_liquid(content, payload, info, path) def render_liquid(content, payload, info, path)
template = site.liquid_renderer.file(path).parse(content) _renderer.render_liquid(content, payload, info, path)
template.warnings.each do |e|
Jekyll.logger.warn "Liquid Warning:",
LiquidRenderer.format_error(e, path || self.path)
end
template.render!(payload, info)
# rubocop: disable RescueException
rescue Exception => e
Jekyll.logger.error "Liquid Exception:",
LiquidRenderer.format_error(e, path || self.path)
raise e
end end
# rubocop: enable RescueException # rubocop: enable RescueException
@ -211,40 +192,10 @@ module Jekyll
# #
# Returns nothing # Returns nothing
def render_all_layouts(layouts, payload, info) def render_all_layouts(layouts, payload, info)
# recursively render layouts _renderer.layouts = layouts
layout = layouts[data["layout"]] self.output = _renderer.place_in_layouts(output, payload, info)
ensure
Jekyll.logger.warn( @_renderer = nil # this will allow the modifications above to disappear
"Build Warning:",
"Layout '#{data["layout"]}' requested in #{path} does not exist."
) if invalid_layout? layout
used = Set.new([layout])
# Reset the payload layout data to ensure it starts fresh for each page.
payload["layout"] = nil
while layout
Jekyll.logger.debug "Rendering Layout:", path
payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
self.output = render_liquid(layout.content,
payload,
info,
layout.relative_path)
# Add layout to dependency tree
site.regenerator.add_dependency(
site.in_source_dir(path),
site.in_source_dir(layout.path)
)
if (layout = layouts[layout.data["layout"]])
break if used.include?(layout)
used << layout
end
end
end end
# Add any necessary layouts to this convertible document. # Add any necessary layouts to this convertible document.
@ -254,32 +205,15 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def do_layout(payload, layouts) def do_layout(payload, layouts)
Jekyll.logger.debug "Rendering:", self.relative_path self.output = _renderer.tap do |renderer|
renderer.layouts = layouts
renderer.payload = payload
end.run
Jekyll.logger.debug "Pre-Render Hooks:", self.relative_path
Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
info = {
:filters => [Jekyll::Filters],
:registers => { :site => site, :page => payload["page"] }
}
# render and transform content (this becomes the final content of the object)
payload["highlighter_prefix"] = converters.first.highlighter_prefix
payload["highlighter_suffix"] = converters.first.highlighter_suffix
if render_with_liquid?
Jekyll.logger.debug "Rendering Liquid:", self.relative_path
self.content = render_liquid(content, payload, info, path)
end
Jekyll.logger.debug "Rendering Markup:", self.relative_path
self.content = transform
# output keeps track of what will finally be written
self.output = content
render_all_layouts(layouts, payload, info) if place_in_layout?
Jekyll.logger.debug "Post-Render Hooks:", self.relative_path Jekyll.logger.debug "Post-Render Hooks:", self.relative_path
Jekyll::Hooks.trigger hook_owner, :post_render, self Jekyll::Hooks.trigger hook_owner, :post_render, self
ensure
@_renderer = nil # this will allow the modifications above to disappear
end end
# Write the generated page file to the destination directory. # Write the generated page file to the destination directory.
@ -306,5 +240,10 @@ module Jekyll
data[property] data[property]
end end
end end
private
def _renderer
@_renderer ||= Jekyll::Renderer.new(site, self)
end
end end
end end

View File

@ -51,19 +51,9 @@ module Jekyll
# #
# Returns the merged data. # Returns the merged data.
def merge_data!(other, source: "YAML front matter") def merge_data!(other, source: "YAML front matter")
if other.key?("categories") && !other["categories"].nil? merge_categories!(other)
if other["categories"].is_a?(String)
other["categories"] = other["categories"].split(" ").map(&:strip)
end
other["categories"] = (data["categories"] || []) | other["categories"]
end
Utils.deep_merge_hashes!(data, other) Utils.deep_merge_hashes!(data, other)
if data.key?("date") && !data["date"].is_a?(Time) merge_date!(source)
data["date"] = Utils.parse_date(
data["date"].to_s,
"Document '#{relative_path}' does not have a valid date in the #{source}."
)
end
data data
end end
@ -90,8 +80,7 @@ module Jekyll
# Returns a String path which represents the relative path # Returns a String path which represents the relative path
# from the site source to this document # from the site source to this document
def relative_path def relative_path
@relative_path ||= Pathname.new(path) @relative_path ||= Pathutil.new(path).relative_path_from(site.source).to_s
.relative_path_from(Pathname.new(site.source)).to_s
end end
# The output extension of the document. # The output extension of the document.
@ -264,20 +253,9 @@ module Jekyll
@data = SafeYAML.load_file(path) @data = SafeYAML.load_file(path)
else else
begin begin
defaults = @site.frontmatter_defaults.all( merge_defaults
relative_path, read_content(opts)
collection.label.to_sym read_post_data
)
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load(Regexp.last_match(1))
merge_data!(data_file, :source => "YAML front matter") if data_file
end
post_read
rescue SyntaxError => e rescue SyntaxError => e
Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}" Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
rescue => e rescue => e
@ -287,56 +265,6 @@ module Jekyll
end end
end end
def post_read
if relative_path =~ DATE_FILENAME_MATCHER
date, slug, ext = Regexp.last_match.captures
if !data["date"] || data["date"].to_i == site.time.to_i
merge_data!({ "date" => date }, :source => "filename")
end
elsif relative_path =~ DATELESS_FILENAME_MATCHER
slug, ext = Regexp.last_match.captures
end
# Try to ensure the user gets a title.
data["title"] ||= Utils.titleize_slug(slug)
# Only overwrite slug & ext if they aren't specified.
data["slug"] ||= slug
data["ext"] ||= ext
populate_categories
populate_tags
generate_excerpt
end
# Add superdirectories of the special_dir to categories.
# In the case of es/_posts, 'es' is added as a category.
# In the case of _posts/es, 'es' is NOT added as a category.
#
# Returns nothing.
def categories_from_path(special_dir)
superdirs = relative_path.sub(%r!#{special_dir}(.*)!, "")
.split(File::SEPARATOR)
.reject do |c|
c.empty? || c.eql?(special_dir) || c.eql?(basename)
end
merge_data!({ "categories" => superdirs }, :source => "file path")
end
def populate_categories
merge_data!({
"categories" => (
Array(data["categories"]) +
Utils.pluralized_array_from_hash(data, "category", "categories")
).map(&:to_s).flatten.uniq
})
end
def populate_tags
merge_data!({
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
})
end
# Create a Liquid-understandable version of this Document. # Create a Liquid-understandable version of this Document.
# #
# Returns a Hash representing this Document's data. # Returns a Hash representing this Document's data.
@ -443,7 +371,116 @@ module Jekyll
end end
end end
private # :nodoc: def respond_to_missing?(method, *)
data.key?(method.to_s) || super
end
private
def merge_categories!(other)
if other.key?("categories") && !other["categories"].nil?
if other["categories"].is_a?(String)
other["categories"] = other["categories"].split(%r!\s+!).map(&:strip)
end
other["categories"] = (data["categories"] || []) | other["categories"]
end
end
private
def merge_date!(source)
if data.key?("date") && !data["date"].is_a?(Time)
data["date"] = Utils.parse_date(
data["date"].to_s,
"Document '#{relative_path}' does not have a valid date in the #{source}."
)
end
end
private
def merge_defaults
defaults = @site.frontmatter_defaults.all(
relative_path,
collection.label.to_sym
)
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
end
private
def read_content(opts)
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load(Regexp.last_match(1))
merge_data!(data_file, :source => "YAML front matter") if data_file
end
end
private
def read_post_data
populate_title
populate_categories
populate_tags
generate_excerpt
end
private
def populate_title
if relative_path =~ DATE_FILENAME_MATCHER
date, slug, ext = Regexp.last_match.captures
modify_date(date)
elsif relative_path =~ DATELESS_FILENAME_MATCHER
slug, ext = Regexp.last_match.captures
end
# Try to ensure the user gets a title.
data["title"] ||= Utils.titleize_slug(slug)
# Only overwrite slug & ext if they aren't specified.
data["slug"] ||= slug
data["ext"] ||= ext
end
private
def modify_date(date)
if !data["date"] || data["date"].to_i == site.time.to_i
merge_data!({ "date" => date }, :source => "filename")
end
end
# Add superdirectories of the special_dir to categories.
# In the case of es/_posts, 'es' is added as a category.
# In the case of _posts/es, 'es' is NOT added as a category.
#
# Returns nothing.
private
def categories_from_path(special_dir)
superdirs = relative_path.sub(%r!#{special_dir}(.*)!, "")
.split(File::SEPARATOR)
.reject do |c|
c.empty? || c == special_dir || c == basename
end
merge_data!({ "categories" => superdirs }, :source => "file path")
end
private
def populate_categories
merge_data!({
"categories" => (
Array(data["categories"]) + Utils.pluralized_array_from_hash(
data,
"category",
"categories"
)
).map(&:to_s).flatten.uniq
})
end
private
def populate_tags
merge_data!({
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
})
end
private
def generate_excerpt def generate_excerpt
if generate_excerpt? if generate_excerpt?
data["excerpt"] ||= Jekyll::Excerpt.new(self) data["excerpt"] ||= Jekyll::Excerpt.new(self)

View File

@ -3,8 +3,11 @@ require "json"
require "date" require "date"
require "liquid" require "liquid"
require_all "jekyll/filters"
module Jekyll module Jekyll
module Filters module Filters
include URLFilters
# Convert a Markdown string into HTML output. # Convert a Markdown string into HTML output.
# #
# input - The Markdown String to convert. # input - The Markdown String to convert.

View File

@ -0,0 +1,38 @@
module Jekyll
module Filters
module URLFilters
# Produces an absolute URL based on site.url and site.baseurl.
#
# input - the URL to make absolute.
#
# Returns the absolute URL as a String.
def absolute_url(input)
return if input.nil?
site = @context.registers[:site]
return relative_url(input).to_s if site.config["url"].nil?
URI(site.config["url"] + relative_url(input)).to_s
end
# Produces a URL relative to the domain root based on site.baseurl.
#
# 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?
site = @context.registers[:site]
return ensure_leading_slash(input.to_s) if site.config["baseurl"].nil?
URI(
ensure_leading_slash(site.config["baseurl"]) + ensure_leading_slash(input.to_s)
).to_s
end
private
def ensure_leading_slash(input)
return input if input.nil? || input.empty? || input.start_with?("/")
"/#{input}"
end
end
end
end

View File

@ -54,7 +54,7 @@ module Jekyll
# Ensure the priority is a Fixnum # Ensure the priority is a Fixnum
def self.priority_value(priority) def self.priority_value(priority)
return priority if priority.is_a?(Fixnum) return priority if priority.is_a?(Integer)
PRIORITY_MAP[priority] || DEFAULT_PRIORITY PRIORITY_MAP[priority] || DEFAULT_PRIORITY
end end

View File

@ -40,7 +40,11 @@ module Jekyll
@base = base @base = base
@dir = dir @dir = dir
@name = name @name = name
@path = site.in_source_dir(base, dir, name) @path = if site.in_theme_dir(base) == base # we're in a theme
site.in_theme_dir(base, dir, name)
else
site.in_source_dir(base, dir, name)
end
process(name) process(name)
read_yaml(File.join(base, dir), name) read_yaml(File.join(base, dir), name)

View File

@ -18,6 +18,7 @@ module Jekyll
sort_files! sort_files!
@site.data = DataReader.new(site).read(site.config["data_dir"]) @site.data = DataReader.new(site).read(site.config["data_dir"])
CollectionReader.new(site).read CollectionReader.new(site).read
ThemeAssetsReader.new(site).read
end end
# Sorts posts, pages, and static files. # Sorts posts, pages, and static files.

View File

@ -0,0 +1,47 @@
module Jekyll
class ThemeAssetsReader
attr_reader :site
def initialize(site)
@site = site
end
def read
return unless site.theme && site.theme.assets_path
Find.find(site.theme.assets_path) do |path|
next if File.directory?(path)
if File.symlink?(path)
Jekyll.logger.warn "Theme reader:", "Ignored symlinked asset: #{path}"
else
read_theme_asset(path)
end
end
end
private
def read_theme_asset(path)
base = site.theme.root
dir = File.dirname(path.sub("#{site.theme.root}/", ""))
name = File.basename(path)
if Utils.has_yaml_header?(path)
append_unless_exists site.pages,
Jekyll::Page.new(site, base, dir, name)
else
append_unless_exists site.static_files,
Jekyll::StaticFile.new(site, base, dir, name)
end
end
def append_unless_exists(haystack, new_item)
if haystack.any? { |file| file.relative_path == new_item.relative_path }
Jekyll.logger.debug "Theme:",
"Ignoring #{new_item.relative_path} in theme due to existing file " \
"with that path in site."
return
end
haystack << new_item
end
end
end

View File

@ -2,12 +2,32 @@
module Jekyll module Jekyll
class Renderer class Renderer
attr_reader :document, :site, :payload attr_reader :document, :site
attr_writer :layouts, :payload
def initialize(site, document, site_payload = nil) def initialize(site, document, site_payload = nil)
@site = site @site = site
@document = document @document = document
@payload = site_payload || site.site_payload @payload = site_payload
end
# Fetches the payload used in Liquid rendering.
# It can be written with #payload=(new_payload)
# Falls back to site.site_payload if no payload is set.
#
# Returns a Jekyll::Drops::UnifiedPayloadDrop
def payload
@payload ||= site.site_payload
end
# The list of layouts registered for this Renderer.
# It can be written with #layouts=(new_layouts)
# Falls back to site.layouts if no layouts are registered.
#
# Returns a Hash of String => Jekyll::Layout identified
# as basename without the extension name.
def layouts
@layouts || site.layouts
end end
# Determine which converters to use based on this document's # Determine which converters to use based on this document's
@ -15,7 +35,7 @@ module Jekyll
# #
# Returns an array of Converter instances. # Returns an array of Converter instances.
def converters def converters
@converters ||= site.converters.select { |c| c.matches(document.extname) } @converters ||= site.converters.select { |c| c.matches(document.extname) }.sort
end end
# Determine the extname the outputted file should have # Determine the extname the outputted file should have
@ -126,7 +146,7 @@ module Jekyll
# #
# Returns true if the layout is invalid, false if otherwise # Returns true if the layout is invalid, false if otherwise
def invalid_layout?(layout) def invalid_layout?(layout)
!document.data["layout"].nil? && layout.nil? !document.data["layout"].nil? && layout.nil? && !(document.is_a? Jekyll::Excerpt)
end end
# Render layouts and place given content inside. # Render layouts and place given content inside.
@ -137,7 +157,7 @@ module Jekyll
# Returns the content placed in the Liquid-rendered layouts # Returns the content placed in the Liquid-rendered layouts
def place_in_layouts(content, payload, info) def place_in_layouts(content, payload, info)
output = content.dup output = content.dup
layout = site.layouts[document.data["layout"]] layout = layouts[document.data["layout"]]
Jekyll.logger.warn( Jekyll.logger.warn(
"Build Warning:", "Build Warning:",
@ -167,7 +187,7 @@ module Jekyll
site.in_source_dir(layout.path) site.in_source_dir(layout.path)
) if document.write? ) if document.write?
if (layout = site.layouts[layout.data["layout"]]) if (layout = layouts[layout.data["layout"]])
break if used.include?(layout) break if used.include?(layout)
used << layout used << layout
end end

View File

@ -424,7 +424,16 @@ module Jekyll
private private
def configure_theme def configure_theme
self.theme = nil self.theme = nil
self.theme = Jekyll::Theme.new(config["theme"]) if config["theme"] return if config["theme"].nil?
self.theme =
if config["theme"].is_a?(String)
Jekyll::Theme.new(config["theme"])
else
Jekyll.logger.warn "Theme:", "value of 'theme' in config should be " \
"String to use gem-based themes, but got #{config["theme"].class}"
nil
end
end end
private private

View File

@ -8,7 +8,7 @@ module Jekyll
# forms: name, name=value, or name="<quoted list>" # forms: name, name=value, or name="<quoted list>"
# #
# <quoted list> is a space-separated list of numbers # <quoted list> is a space-separated list of numbers
SYNTAX = %r!^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$! SYNTAX = %r!^([a-zA-Z0-9.+#_-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$!
def initialize(tag_name, markup, tokens) def initialize(tag_name, markup, tokens)
super super

View File

@ -16,8 +16,10 @@ module Jekyll
def render(context) def render(context)
site = context.registers[:site] site = context.registers[:site]
site.docs_to_write.each do |document| site.each_site_file do |item|
return document.url if document.relative_path == @relative_path return item.url if item.relative_path == @relative_path
# This takes care of the case for static files that have a leading /
return item.url if item.relative_path == "/#{@relative_path}"
end end
raise ArgumentError, <<eos raise ArgumentError, <<eos

View File

@ -18,15 +18,19 @@ module Jekyll
end end
def includes_path def includes_path
path_for :includes path_for "_includes".freeze
end end
def layouts_path def layouts_path
path_for :layouts path_for "_layouts".freeze
end end
def sass_path def sass_path
path_for :sass path_for "_sass".freeze
end
def assets_path
path_for "assets".freeze
end end
def configure_sass def configure_sass
@ -43,7 +47,7 @@ module Jekyll
end end
def realpath_for(folder) def realpath_for(folder)
File.realpath(Jekyll.sanitized_path(root, "_#{folder}")) File.realpath(Jekyll.sanitized_path(root, folder.to_s))
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
nil nil
end end

View File

@ -1,6 +1,6 @@
class Jekyll::ThemeBuilder class Jekyll::ThemeBuilder
SCAFFOLD_DIRECTORIES = %w( SCAFFOLD_DIRECTORIES = %w(
_layouts _includes _sass assets _layouts _includes _sass
).freeze ).freeze
attr_reader :name, :path, :code_of_conduct attr_reader :name, :path, :code_of_conduct

View File

@ -6,10 +6,11 @@ module Jekyll
autoload :Ansi, "jekyll/utils/ansi" autoload :Ansi, "jekyll/utils/ansi"
# Constants for use in #slugify # Constants for use in #slugify
SLUGIFY_MODES = %w(raw default pretty).freeze SLUGIFY_MODES = %w(raw default pretty ascii).freeze
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
SLUGIFY_DEFAULT_REGEXP = Regexp.new("[^[:alnum:]]+").freeze SLUGIFY_DEFAULT_REGEXP = Regexp.new("[^[:alnum:]]+").freeze
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
SLUGIFY_ASCII_REGEXP = Regexp.new("[^[A-Za-z0-9]]+").freeze
# Takes an indented string and removes the preceding spaces on each line # Takes an indented string and removes the preceding spaces on each line
@ -160,6 +161,9 @@ module Jekyll
# When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@) # When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@)
# are not replaced with hyphen. # are not replaced with hyphen.
# #
# 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.
#
# If cased is true, all uppercase letters in the result string are # If cased is true, all uppercase letters in the result string are
# replaced with their lowercase counterparts. # replaced with their lowercase counterparts.
# #
@ -173,6 +177,9 @@ module Jekyll
# slugify("The _config.yml file", "pretty", true) # slugify("The _config.yml file", "pretty", true)
# # => "The-_config.yml file" # # => "The-_config.yml file"
# #
# slugify("The _config.yml file", "ascii")
# # => "the-config.yml-file"
#
# Returns the slugified string. # Returns the slugified string.
def slugify(string, mode: nil, cased: false) def slugify(string, mode: nil, cased: false)
mode ||= "default" mode ||= "default"
@ -193,6 +200,11 @@ module Jekyll
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS. # and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP 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 end
# Strip according to the mode # Strip according to the mode

View File

@ -13,18 +13,55 @@ module Jekyll
end end
end end
# --
# Allows you to detect "real" Windows, or what we would consider
# "real" Windows. That is, that we can pass the basic test and the
# /proc/version returns nothing to us.
# --
def really_windows?
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i && \
!proc_version
end
#
def windows?
RbConfig::CONFIG["host_os"] =~ %r!mswin|mingw|cygwin!i || \
proc_version =~ %r!microsoft!i
end
#
def linux?
RbConfig::CONFIG["host_os"] =~ %r!linux! && \
proc_version !~ %r!microsoft!i
end
# Provides windows?, linux?, osx?, unix? so that we can detect # Provides windows?, linux?, osx?, unix? so that we can detect
# platforms. This is mostly useful for `jekyll doctor` and for testing # platforms. This is mostly useful for `jekyll doctor` and for testing
# where we kick off certain tests based on the platform. # where we kick off certain tests based on the platform.
{ :windows? => %r!mswin|mingw|cygwin!, :linux? => %r!linux!, \ { :osx? => %r!darwin|mac os!, :unix? => %r!solaris|bsd! }.each do |k, v|
:osx? => %r!darwin|mac os!, :unix? => %r!solaris|bsd! }.each do |k, v|
define_method k do define_method k do
!!( !!(
RbConfig::CONFIG["host_os"] =~ v RbConfig::CONFIG["host_os"] =~ v
) )
end end
end end
#
private
def proc_version
@cached_proc_version ||= begin
Pathutil.new(
"/proc/version"
).read
rescue Errno::ENOENT
nil
end
end
end end
end end
end end

View File

@ -20,7 +20,7 @@ description: > # this means to ignore newlines until "baseurl:"
line in _config.yml. It will appear in your document head meta (for line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description. Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog baseurl: "" # the subpath of your site, e.g. /blog
url: "http://example.com" # the base hostname & protocol for your site url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: jekyllrb twitter_username: jekyllrb
github_username: jekyll github_username: jekyll
@ -29,3 +29,6 @@ markdown: kramdown
theme: minima theme: minima
gems: gems:
- jekyll-feed - jekyll-feed
exclude:
- Gemfile
- Gemfile.lock

View File

@ -1,39 +0,0 @@
---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";
// Our variables
$base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
$base-font-size: 16px;
$base-font-weight: 400;
$small-font-size: $base-font-size * 0.875;
$base-line-height: 1.5;
$spacing-unit: 30px;
$text-color: #111;
$background-color: #fdfdfd;
$brand-color: #2a7ae2;
$grey-color: #828282;
$grey-color-light: lighten($grey-color, 40%);
$grey-color-dark: darken($grey-color, 25%);
// Width of the content area
$content-width: 800px;
$on-palm: 600px;
$on-laptop: 800px;
// Minima also includes a mixin for defining media queries.
// Use media queries like this:
// @include media-query($on-palm) {
// .wrapper {
// padding-right: $spacing-unit / 2;
// padding-left: $spacing-unit / 2;
// }
// }
// Import partials from the `minima` theme.
@import "minima";

View File

@ -12,7 +12,7 @@ Add this line to your Jekyll site's Gemfile:
gem <%= theme_name.inspect %> gem <%= theme_name.inspect %>
``` ```
And add this line to your Jekyll site: And add this line to your Jekyll site's `_config.yml`:
```yaml ```yaml
theme: <%= theme_name %> theme: <%= theme_name %>

View File

@ -1,3 +1,4 @@
*.gem
.bundle .bundle
.sass-cache .sass-cache
_site _site

View File

@ -7,14 +7,12 @@ echo "$0: setting up tmp directory"
mkdir -p ./tmp mkdir -p ./tmp
rm -Rf ./tmp/default-site rm -Rf ./tmp/default-site
workdir=$(pwd)
echo "$0: creating new default site" echo "$0: creating new default site"
bundle exec exe/jekyll new tmp/default-site bundle exec jekyll new tmp/default-site
pushd tmp/default-site pushd tmp/default-site
echo "$0: respecifying the jekyll install location" echo "$0: respecifying the jekyll install location"
ruby -e "contents = File.read('Gemfile'); File.write('Gemfile', contents.sub(/gem \"jekyll\".*\\n/, 'gem \"jekyll\", path: \"$workdir\"'))" ruby -e "contents = File.read('Gemfile'); File.write('Gemfile', contents.sub(/gem \"jekyll\".*\\n/, 'gem \"jekyll\", path: \"../../\"'))"
echo "$0: installing default site dependencies" echo "$0: installing default site dependencies"
BUNDLE_GEMFILE=Gemfile bundle install BUNDLE_GEMFILE=Gemfile bundle install
echo "$0: building the default site" echo "$0: building the default site"

View File

@ -10,7 +10,7 @@ For information about contributing, see the [Contributing page](http://jekyllrb.
You can preview your contributions before opening a pull request by running from within the directory: You can preview your contributions before opening a pull request by running from within the directory:
1. `bundle install` 1. `bundle install --without test test_legacy benchmark`
2. `bundle exec rake site:preview` 2. `bundle exec rake site:preview`
It's just a jekyll site, afterall! :wink: It's just a jekyll site, afterall! :wink:

View File

@ -32,3 +32,7 @@ gems:
- jekyll-seo-tag - jekyll-seo-tag
- jekyll-avatar - jekyll-avatar
- jekyll-mentions - jekyll-mentions
exclude:
- README.md
- .gitignore

View File

@ -9,14 +9,14 @@ a Ruby gem. In order to use them, you must first create a file with the
proper extension name (one of `.sass`, `.scss`, or `.coffee`) and ***start the proper extension name (one of `.sass`, `.scss`, or `.coffee`) and ***start the
file with two lines of triple dashes***, like this: file with two lines of triple dashes***, like this:
{% highlight sass %} ```sass
--- ---
--- ---
// start content // start content
.my-definition .my-definition
font-size: 1.2em font-size: 1.2em
{% endhighlight %} ```
Jekyll treats these files the same as a regular page, in that the output file Jekyll treats these files the same as a regular page, in that the output file
will be placed in the same directory that it came from. For instance, if you will be placed in the same directory that it came from. For instance, if you
@ -46,10 +46,10 @@ If you are using Sass `@import` statements, you'll need to ensure that your
`sass_dir` is set to the base directory that contains your Sass files. You `sass_dir` is set to the base directory that contains your Sass files. You
can do that thusly: can do that thusly:
{% highlight yaml %} ```yaml
sass: sass:
sass_dir: _sass sass_dir: _sass
{% endhighlight %} ```
The Sass converter will default the `sass_dir` configuration option to The Sass converter will default the `sass_dir` configuration option to
`_sass`. `_sass`.
@ -72,10 +72,10 @@ The Sass converter will default the `sass_dir` configuration option to
You may also specify the output style with the `style` option in your You may also specify the output style with the `style` option in your
`_config.yml` file: `_config.yml` file:
{% highlight yaml %} ```yaml
sass: sass:
style: compressed style: compressed
{% endhighlight %} ```
These are passed to Sass, so any output style options Sass supports are valid These are passed to Sass, so any output style options Sass supports are valid
here, too. here, too.
@ -88,7 +88,7 @@ To enable Coffeescript in Jekyll 3.0 and up you must
* Install the `jekyll-coffeescript` gem * Install the `jekyll-coffeescript` gem
* Ensure that your `_config.yml` is up-to-date and includes the following: * Ensure that your `_config.yml` is up-to-date and includes the following:
{% highlight yaml %} ```yaml
gems: gems:
- jekyll-coffeescript - jekyll-coffeescript
{% endhighlight %} ```

View File

@ -17,29 +17,29 @@ namespace.
Add the following to your site's `_config.yml` file, replacing `my_collection` Add the following to your site's `_config.yml` file, replacing `my_collection`
with the name of your collection: with the name of your collection:
{% highlight yaml %} ```yaml
collections: collections:
- my_collection - my_collection
{% endhighlight %} ```
You can optionally specify metadata for your collection in the configuration: You can optionally specify metadata for your collection in the configuration:
{% highlight yaml %} ```yaml
collections: collections:
my_collection: my_collection:
foo: bar foo: bar
{% endhighlight %} ```
Default attributes can also be set for a collection: Default attributes can also be set for a collection:
{% highlight yaml %} ```yaml
defaults: defaults:
- scope: - scope:
path: "" path: ""
type: my_collection type: my_collection
values: values:
layout: page layout: page
{% endhighlight %} ```
### Step 2: Add your content ### Step 2: Add your content
@ -62,11 +62,11 @@ If you'd like Jekyll to create a public-facing, rendered version of each
document in your collection, set the `output` key to `true` in your collection document in your collection, set the `output` key to `true` in your collection
metadata in your `_config.yml`: metadata in your `_config.yml`:
{% highlight yaml %} ```yaml
collections: collections:
my_collection: my_collection:
output: true output: true
{% endhighlight %} ```
This will produce a file for each document in the collection. This will produce a file for each document in the collection.
For example, if you have `_my_collection/some_subdir/some_doc.md`, For example, if you have `_my_collection/some_subdir/some_doc.md`,
@ -76,12 +76,12 @@ choice and written out to `<dest>/my_collection/some_subdir/some_doc.html`.
As for posts with [Permalinks](../permalinks/), the document As for posts with [Permalinks](../permalinks/), the document
URL can be customized by setting `permalink` metadata for the collection: URL can be customized by setting `permalink` metadata for the collection:
{% highlight yaml %} ```yaml
collections: collections:
my_collection: my_collection:
output: true output: true
permalink: /awesome/:path/ permalink: /awesome/:path/
{% endhighlight %} ```
For example, if you have `_my_collection/some_subdir/some_doc.md`, it will be For example, if you have `_my_collection/some_subdir/some_doc.md`, it will be
written out to `<dest>/awesome/some_subdir/some_doc/index.html`. written out to `<dest>/awesome/some_subdir/some_doc/index.html`.
@ -339,7 +339,7 @@ one might have front matter in an individual file structured as follows (which
must use a supported markup format, and cannot be saved with a `.yaml` must use a supported markup format, and cannot be saved with a `.yaml`
extension): extension):
{% highlight yaml %} ```yaml
title: "Josquin: Missa De beata virgine and Missa Ave maris stella" title: "Josquin: Missa De beata virgine and Missa Ave maris stella"
artist: "The Tallis Scholars" artist: "The Tallis Scholars"
director: "Peter Phillips" director: "Peter Phillips"
@ -357,11 +357,11 @@ works:
duration: "7:47" duration: "7:47"
- title: "Agnus Dei I, II & III" - title: "Agnus Dei I, II & III"
duration: "6:49" duration: "6:49"
{% endhighlight %} ```
Every album in the collection could be listed on a single page with a template: Every album in the collection could be listed on a single page with a template:
{% highlight html %} ```html
{% raw %} {% raw %}
{% for album in site.albums %} {% for album in site.albums %}
<h2>{{ album.title }}</h2> <h2>{{ album.title }}</h2>
@ -377,4 +377,4 @@ Every album in the collection could be listed on a single page with a template:
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endraw %} {% endraw %}
{% endhighlight %} ```

View File

@ -284,6 +284,18 @@ class="flag">flags</code> (specified on the command-line) that control them.
<p><code class="flag">-I, --incremental</code></p> <p><code class="flag">-I, --incremental</code></p>
</td> </td>
</tr> </tr>
<tr class="setting">
<td>
<p class="name"><strong>Liquid profiler</strong></p>
<p class="description">
Generate a Liquid rendering profile to help you identify performance bottlenecks.
</p>
</td>
<td class="align-center">
<p><code class="option">profile: BOOL</code></p>
<p><code class="flag">--profile</code></p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -387,13 +399,13 @@ before your site is served.
You can provide custom headers for your site by adding them to `_config.yml` You can provide custom headers for your site by adding them to `_config.yml`
{% highlight yaml %} ```yaml
# File: _config.yml # File: _config.yml
webrick: webrick:
headers: headers:
My-Header: My-Value My-Header: My-Value
My-Other-Header: My-Other-Value My-Other-Header: My-Other-Value
{% endhighlight %} ```
### Defaults ### Defaults
@ -408,19 +420,19 @@ In the build (or serve) arguments, you can specify a Jekyll environment and valu
For example, suppose you set this conditional statement in your code: For example, suppose you set this conditional statement in your code:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% if jekyll.environment == "production" %} {% if jekyll.environment == "production" %}
{% include disqus.html %} {% include disqus.html %}
{% endif %} {% endif %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
When you build your Jekyll site, the content inside the `if` statement won't be run unless you also specify a `production` environment in the build command, like this: When you build your Jekyll site, the content inside the `if` statement won't be run unless you also specify a `production` environment in the build command, like this:
{% highlight sh %} ```sh
JEKYLL_ENV=production jekyll build JEKYLL_ENV=production jekyll build
{% endhighlight %} ```
Specifying an environment value allows you to make certain content available only within specific environments. Specifying an environment value allows you to make certain content available only within specific environments.
@ -442,14 +454,14 @@ The `defaults` key holds an array of scope/values pairs that define what default
Let's say that you want to add a default layout to all pages and posts in your site. You would add this to your `_config.yml` file: Let's say that you want to add a default layout to all pages and posts in your site. You would add this to your `_config.yml` file:
{% highlight yaml %} ```yaml
defaults: defaults:
- -
scope: scope:
path: "" # an empty string here means all files in the project path: "" # an empty string here means all files in the project
values: values:
layout: "default" layout: "default"
{% endhighlight %} ```
<div class="note info"> <div class="note info">
<h5>Please stop and rerun `jekyll serve` command.</h5> <h5>Please stop and rerun `jekyll serve` command.</h5>
@ -465,7 +477,7 @@ defaults:
Here, we are scoping the `values` to any file that exists in the path `scope`. Since the path is set as an empty string, it will apply to **all files** in your project. You probably don't want to set a layout on every file in your project - like css files, for example - so you can also specify a `type` value under the `scope` key. Here, we are scoping the `values` to any file that exists in the path `scope`. Since the path is set as an empty string, it will apply to **all files** in your project. You probably don't want to set a layout on every file in your project - like css files, for example - so you can also specify a `type` value under the `scope` key.
{% highlight yaml %} ```yaml
defaults: defaults:
- -
scope: scope:
@ -473,14 +485,14 @@ defaults:
type: "posts" # previously `post` in Jekyll 2.2. type: "posts" # previously `post` in Jekyll 2.2.
values: values:
layout: "default" layout: "default"
{% endhighlight %} ```
Now, this will only set the layout for files where the type is `posts`. Now, this will only set the layout for files where the type is `posts`.
The different types that are available to you are `pages`, `posts`, `drafts` or any collection in your site. While `type` is optional, you must specify a value for `path` when creating a `scope/values` pair. The different types that are available to you are `pages`, `posts`, `drafts` or any collection in your site. While `type` is optional, you must specify a value for `path` when creating a `scope/values` pair.
As mentioned earlier, you can set multiple scope/values pairs for `defaults`. As mentioned earlier, you can set multiple scope/values pairs for `defaults`.
{% highlight yaml %} ```yaml
defaults: defaults:
- -
scope: scope:
@ -495,11 +507,11 @@ defaults:
values: values:
layout: "project" # overrides previous default layout layout: "project" # overrides previous default layout
author: "Mr. Hyde" author: "Mr. Hyde"
{% endhighlight %} ```
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 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`.
{% highlight yaml %} ```yaml
collections: collections:
- my_collection: - my_collection:
output: true output: true
@ -511,7 +523,7 @@ defaults:
type: "my_collection" # a collection in your site, in plural form type: "my_collection" # a collection in your site, in plural form
values: values:
layout: "default" layout: "default"
{% endhighlight %} ```
In this example, the `layout` is set to `default` inside the In this example, the `layout` is set to `default` inside the
[collection](../collections/) with the name `my_collection`. [collection](../collections/) with the name `my_collection`.
@ -524,7 +536,7 @@ You can see that in the second to last example above. First, we set the default
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: 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:
{% highlight yaml %} ```yaml
# In _config.yml # In _config.yml
... ...
defaults: defaults:
@ -537,16 +549,16 @@ defaults:
author: "Mr. Hyde" author: "Mr. Hyde"
category: "project" category: "project"
... ...
{% endhighlight %} ```
{% highlight yaml %} ```yaml
# In projects/foo_project.md # In projects/foo_project.md
--- ---
author: "John Smith" author: "John Smith"
layout: "foobar" layout: "foobar"
--- ---
The post text goes here... The post text goes here...
{% endhighlight %} ```
The `projects/foo_project.md` would have the `layout` set to `foobar` instead The `projects/foo_project.md` would have the `layout` set to `foobar` instead
of `project` and the `author` set to `John Smith` instead of `Mr. Hyde` when of `project` and the `author` set to `John Smith` instead of `Mr. Hyde` when
@ -567,7 +579,7 @@ file or on the command-line.
</p> </p>
</div> </div>
{% highlight yaml %} ```yaml
# Where things are # Where things are
source: . source: .
destination: ./_site destination: ./_site
@ -582,7 +594,7 @@ collections:
# Handling Reading # Handling Reading
safe: false safe: false
include: [".htaccess"] include: [".htaccess"]
exclude: [] exclude: ["vendor"]
keep_files: [".git", ".svn"] keep_files: [".git", ".svn"]
encoding: "utf-8" encoding: "utf-8"
markdown_ext: "markdown,mkdown,mkdn,mkd,md" markdown_ext: "markdown,mkdown,mkdn,mkd,md"
@ -639,7 +651,7 @@ kramdown:
input: GFM input: GFM
hard_wrap: false hard_wrap: false
footnote_nr: 1 footnote_nr: 1
{% endhighlight %} ```
## Liquid Options ## Liquid Options
@ -703,7 +715,7 @@ extensions are:
If you're interested in creating a custom markdown processor, you're in luck! Create a new class in the `Jekyll::Converters::Markdown` namespace: If you're interested in creating a custom markdown processor, you're in luck! Create a new class in the `Jekyll::Converters::Markdown` namespace:
{% highlight ruby %} ```ruby
class Jekyll::Converters::Markdown::MyCustomProcessor class Jekyll::Converters::Markdown::MyCustomProcessor
def initialize(config) def initialize(config)
require 'funky_markdown' require 'funky_markdown'
@ -718,14 +730,14 @@ class Jekyll::Converters::Markdown::MyCustomProcessor
::FunkyMarkdown.new(content).convert ::FunkyMarkdown.new(content).convert
end end
end end
{% endhighlight %} ```
Once you've created your class and have it properly set up either as a plugin Once you've created your class and have it properly set up either as a plugin
in the `_plugins` folder or as a gem, specify it in your `_config.yml`: in the `_plugins` folder or as a gem, specify it in your `_config.yml`:
{% highlight yaml %} ```yaml
markdown: MyCustomProcessor markdown: MyCustomProcessor
{% endhighlight %} ```
## Incremental Regeneration ## Incremental Regeneration
<div class="note warning"> <div class="note warning">

View File

@ -19,7 +19,7 @@ Enabling Travis builds for your GitHub repository is pretty simple:
1. Go to your profile on travis-ci.org: https://travis-ci.org/profile/username 1. Go to your profile on travis-ci.org: https://travis-ci.org/profile/username
2. Find the repository for which you're interested in enabling builds. 2. Find the repository for which you're interested in enabling builds.
3. Click the slider on the right so it says "ON" and is a dark grey. 3. Click the slider on the right so it says "ON" and is a dark grey.
4. Optionally configure the build by clicking on the wrench icon. Further 4. Optionally configure the build by clicking on the gear icon. Further
configuration happens in your `.travis.yml` file. More details on that configuration happens in your `.travis.yml` file. More details on that
below. below.
@ -38,13 +38,13 @@ Save the commands you want to run and succeed in a file: `./script/cibuild`
### The HTML Proofer Executable ### The HTML Proofer Executable
{% highlight shell %} ```sh
#!/usr/bin/env bash #!/usr/bin/env bash
set -e # halt script on error set -e # halt script on error
bundle exec jekyll build bundle exec jekyll build
bundle exec htmlproofer ./_site bundle exec htmlproofer ./_site
{% endhighlight %} ```
Some options can be specified via command-line switches. Check out the Some options can be specified via command-line switches. Check out the
`html-proofer` README for more information about these switches, or run `html-proofer` README for more information about these switches, or run
@ -52,20 +52,20 @@ Some options can be specified via command-line switches. Check out the
For example to avoid testing external sites, use this command: For example to avoid testing external sites, use this command:
{% highlight shell %} ```sh
$ bundle exec htmlproofer ./_site --disable-external $ bundle exec htmlproofer ./_site --disable-external
{% endhighlight %} ```
### The HTML Proofer Library ### The HTML Proofer Library
You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile): You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile):
{% highlight ruby %} ```ruby
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'html-proofer' require 'html-proofer'
HTMLProofer.check_directory("./_site").run HTMLProofer.check_directory("./_site").run
{% endhighlight %} ```
Options are given as a second argument to `.new`, and are encoded in a Options are given as a second argument to `.new`, and are encoded in a
symbol-keyed Ruby Hash. For more information about the configuration options, symbol-keyed Ruby Hash. For more information about the configuration options,
@ -82,16 +82,16 @@ an explanation of each line.
**Note:** You will need a Gemfile as well, [Travis will automatically install](https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management) the dependencies based on the referenced gems: **Note:** You will need a Gemfile as well, [Travis will automatically install](https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management) the dependencies based on the referenced gems:
{% highlight ruby %} ```ruby
source "https://rubygems.org" source "https://rubygems.org"
gem "jekyll" gem "jekyll"
gem "html-proofer" gem "html-proofer"
{% endhighlight %} ```
Your `.travis.yml` file should look like this: Your `.travis.yml` file should look like this:
{% highlight yaml %} ```yaml
language: ruby language: ruby
rvm: rvm:
- 2.1 - 2.1
@ -114,39 +114,39 @@ env:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
sudo: false # route your build to the container-based infrastructure for a faster build sudo: false # route your build to the container-based infrastructure for a faster build
{% endhighlight %} ```
Ok, now for an explanation of each line: Ok, now for an explanation of each line:
{% highlight yaml %} ```yaml
language: ruby language: ruby
{% endhighlight %} ```
This line tells Travis to use a Ruby build container. It gives your script This line tells Travis to use a Ruby build container. It gives your script
access to Bundler, RubyGems, and a Ruby runtime. access to Bundler, RubyGems, and a Ruby runtime.
{% highlight yaml %} ```yaml
rvm: rvm:
- 2.1 - 2.1
{% endhighlight %} ```
RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This
directive tells Travis the Ruby version to use when running your test directive tells Travis the Ruby version to use when running your test
script. script.
{% highlight yaml %} ```yaml
before_script: before_script:
- chmod +x ./script/cibuild - chmod +x ./script/cibuild
{% endhighlight %} ```
The build script file needs to have the *executable* attribute set or The build script file needs to have the *executable* attribute set or
Travis will fail with a permission denied error. You can also run this Travis will fail with a permission denied error. You can also run this
locally and commit the permissions directly, thus rendering this step locally and commit the permissions directly, thus rendering this step
irrelevant. irrelevant.
{% highlight yaml %} ```yaml
script: ./script/cibuild script: ./script/cibuild
{% endhighlight %} ```
Travis allows you to run any arbitrary shell script to test your site. One Travis allows you to run any arbitrary shell script to test your site. One
convention is to put all scripts for your project in the `script` convention is to put all scripts for your project in the `script`
@ -154,20 +154,20 @@ directory, and to call your test script `cibuild`. This line is completely
customizable. If your script won't change much, you can write your test customizable. If your script won't change much, you can write your test
incantation here directly: incantation here directly:
{% highlight yaml %} ```yaml
install: gem install jekyll html-proofer install: gem install jekyll html-proofer
script: jekyll build && htmlproofer ./_site script: jekyll build && htmlproofer ./_site
{% endhighlight %} ```
The `script` directive can be absolutely any valid shell command. The `script` directive can be absolutely any valid shell command.
{% highlight yaml %} ```yaml
# branch whitelist, only for GitHub Pages # branch whitelist, only for GitHub Pages
branches: branches:
only: only:
- gh-pages # test the gh-pages branch - gh-pages # test the gh-pages branch
- /pages-(.*)/ # test every branch which starts with "pages-" - /pages-(.*)/ # test every branch which starts with "pages-"
{% endhighlight %} ```
You want to ensure the Travis builds for your site are being run only on You want to ensure the Travis builds for your site are being run only on
the branch or branches which contain your site. One means of ensuring this the branch or branches which contain your site. One means of ensuring this
@ -181,11 +181,11 @@ prefixed, exemplified above with the `/pages-(.*)/` regular expression.
The `branches` directive is completely optional. Travis will build from every The `branches` directive is completely optional. Travis will build from every
push to any branch of your repo if leave it out. push to any branch of your repo if leave it out.
{% highlight yaml %} ```yaml
env: env:
global: global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
{% endhighlight %} ```
Using `html-proofer`? You'll want this environment variable. Nokogiri, used Using `html-proofer`? You'll want this environment variable. Nokogiri, used
to parse HTML files in your compiled site, comes bundled with libraries to parse HTML files in your compiled site, comes bundled with libraries
@ -200,9 +200,9 @@ environment variable `NOKOGIRI_USE_SYSTEM_LIBRARIES` to `true`.
servers, which Jekyll will mistakenly read and explode on.</p> servers, which Jekyll will mistakenly read and explode on.</p>
</div> </div>
{% highlight yaml %} ```yaml
exclude: [vendor] exclude: [vendor]
{% endhighlight %} ```
By default you should supply the `sudo: false` command to Travis. This command By default you should supply the `sudo: false` command to Travis. This command
explicitly tells Travis to run your build on Travis's [container-based explicitly tells Travis to run your build on Travis's [container-based
@ -210,9 +210,9 @@ explicitly tells Travis to run your build on Travis's [container-based
speed up your build. If you have any trouble with your build, or if your build speed up your build. If you have any trouble with your build, or if your build
does need `sudo` access, modify the line to `sudo: required`. does need `sudo` access, modify the line to `sudo: required`.
{% highlight yaml %} ```yaml
sudo: false sudo: false
{% endhighlight %} ```
### Troubleshooting ### Troubleshooting

View File

@ -32,7 +32,7 @@ of code in your Jekyll templates:
In `_data/members.yml`: In `_data/members.yml`:
{% highlight yaml %} ```yaml
- name: Eric Mill - name: Eric Mill
github: konklone github: konklone
@ -41,23 +41,23 @@ In `_data/members.yml`:
- name: Liu Fengyun - name: Liu Fengyun
github: liufengyun github: liufengyun
{% endhighlight %} ```
Or `_data/members.csv`: Or `_data/members.csv`:
{% highlight text %} ```text
name,github name,github
Eric Mill,konklone Eric Mill,konklone
Parker Moore,parkr Parker Moore,parkr
Liu Fengyun,liufengyun Liu Fengyun,liufengyun
{% endhighlight %} ```
This data can be accessed via `site.data.members` (notice that the filename This data can be accessed via `site.data.members` (notice that the filename
determines the variable name). determines the variable name).
You can now render the list of members in a template: You can now render the list of members in a template:
{% highlight html %} ```html
{% raw %} {% raw %}
<ul> <ul>
{% for member in site.data.members %} {% for member in site.data.members %}
@ -69,7 +69,7 @@ You can now render the list of members in a template:
{% endfor %} {% endfor %}
</ul> </ul>
{% endraw %} {% endraw %}
{% endhighlight %} ```
## Example: Organizations ## Example: Organizations
@ -80,7 +80,7 @@ folder:
In `_data/orgs/jekyll.yml`: In `_data/orgs/jekyll.yml`:
{% highlight yaml %} ```yaml
username: jekyll username: jekyll
name: Jekyll name: Jekyll
members: members:
@ -89,22 +89,22 @@ members:
- name: Parker Moore - name: Parker Moore
github: parkr github: parkr
{% endhighlight %} ```
In `_data/orgs/doeorg.yml`: In `_data/orgs/doeorg.yml`:
{% highlight yaml %} ```yaml
username: doeorg username: doeorg
name: Doe Org name: Doe Org
members: members:
- name: John Doe - name: John Doe
github: jdoe github: jdoe
{% endhighlight %} ```
The organizations can then be accessed via `site.data.orgs`, followed by the The organizations can then be accessed via `site.data.orgs`, followed by the
file name: file name:
{% highlight html %} ```html
{% raw %} {% raw %}
<ul> <ul>
{% for org_hash in site.data.orgs %} {% for org_hash in site.data.orgs %}
@ -118,22 +118,22 @@ file name:
{% endfor %} {% endfor %}
</ul> </ul>
{% endraw %} {% endraw %}
{% endhighlight %} ```
## Example: Accessing a specific author ## Example: Accessing a specific author
Pages and posts can also access a specific data item. The example below shows how to access a specific item: Pages and posts can also access a specific data item. The example below shows how to access a specific item:
`_data/people.yml`: `_data/people.yml`:
{% highlight yaml %} ```yaml
dave: dave:
name: David Smith name: David Smith
twitter: DavidSilvaSmith twitter: DavidSilvaSmith
{% endhighlight %} ```
The author can then be specified as a page variable in a post's frontmatter: The author can then be specified as a page variable in a post's frontmatter:
{% highlight html %} ```html
{% raw %} {% raw %}
--- ---
title: sample post title: sample post
@ -148,4 +148,4 @@ author: dave
</a> </a>
{% endraw %} {% endraw %}
{% endhighlight %} ```

View File

@ -35,19 +35,19 @@ this](http://web.archive.org/web/20091223025644/http://www.taknado.com/en/2009/0
To have a remote server handle the deploy for you every time you push changes using Git, you can create a user account which has all the public keys that are authorized to deploy in its `authorized_keys` file. With that in place, setting up the post-receive hook is done as follows: To have a remote server handle the deploy for you every time you push changes using Git, you can create a user account which has all the public keys that are authorized to deploy in its `authorized_keys` file. With that in place, setting up the post-receive hook is done as follows:
{% highlight shell %} ```sh
laptop$ ssh deployer@example.com laptop$ ssh deployer@example.com
server$ mkdir myrepo.git server$ mkdir myrepo.git
server$ cd myrepo.git server$ cd myrepo.git
server$ git --bare init server$ git --bare init
server$ cp hooks/post-receive.sample hooks/post-receive server$ cp hooks/post-receive.sample hooks/post-receive
server$ mkdir /var/www/myrepo server$ mkdir /var/www/myrepo
{% endhighlight %} ```
Next, add the following lines to hooks/post-receive and be sure Jekyll is Next, add the following lines to hooks/post-receive and be sure Jekyll is
installed on the server: installed on the server:
{% highlight shell %} ```sh
GIT_REPO=$HOME/myrepo.git GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo PUBLIC_WWW=/var/www/myrepo
@ -56,21 +56,21 @@ git clone $GIT_REPO $TMP_GIT_CLONE
jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE rm -Rf $TMP_GIT_CLONE
exit exit
{% endhighlight %} ```
Finally, run the following command on any users laptop that needs to be able to Finally, run the following command on any users laptop that needs to be able to
deploy using this hook: deploy using this hook:
{% highlight shell %} ```sh
laptops$ git remote add deploy deployer@example.com:~/myrepo.git laptops$ git remote add deploy deployer@example.com:~/myrepo.git
{% endhighlight %} ```
Deploying is now as easy as telling nginx or Apache to look at Deploying is now as easy as telling nginx or Apache to look at
`/var/www/myrepo` and running the following: `/var/www/myrepo` and running the following:
{% highlight shell %} ```sh
laptops$ git push deploy master laptops$ git push deploy master
{% endhighlight %} ```
### Jekyll-hook ### Jekyll-hook
@ -98,12 +98,13 @@ Another way to deploy your Jekyll site is to use [Rake](https://github.com/ruby/
### scp ### scp
Once youve generated the `_site` directory, you can easily scp it using a Once youve generated the `_site` directory, you can easily scp it using a
`tasks/deploy` shell script similar to this: `tasks/deploy` shell script similar to [this deploy script][]. Youd obviously
need to change the values to reflect your sites details. There is even [a
matching TextMate command][] that will help you run this script.
#!/bin/bash [this deploy script here]: https://github.com/henrik/henrik.nyh.se/blob/master/script/deploy
scp -r _site/* user@server:/home/user/public_html
[a matching TextMate command]: https://gist.github.com/henrik/214959
### rsync ### rsync
@ -128,9 +129,9 @@ is to put the restriction to certificate-based authorization in
`~/.ssh/authorized_keys`. Then, launch `rrsync` and supply `~/.ssh/authorized_keys`. Then, launch `rrsync` and supply
it with the folder it shall have read-write access to: it with the folder it shall have read-write access to:
{% highlight shell %} ```sh
command="$HOME/bin/rrsync <folder>",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa <cert> command="$HOME/bin/rrsync <folder>",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa <cert>
{% endhighlight %} ```
`<folder>` is the path to your site. E.g., `~/public_html/you.org/blog-html/`. `<folder>` is the path to your site. E.g., `~/public_html/you.org/blog-html/`.
@ -138,11 +139,11 @@ command="$HOME/bin/rrsync <folder>",no-agent-forwarding,no-port-forwarding,no-pt
Add the `deploy` script to the site source folder: Add the `deploy` script to the site source folder:
{% highlight shell %} ```sh
#!/bin/sh #!/bin/sh
rsync -crvz --rsh='ssh -p2222' --delete-after --delete-excluded <folder> <user>@<site>: rsync -crvz --rsh='ssh -p2222' --delete-after --delete-excluded <folder> <user>@<site>:
{% endhighlight %} ```
Command line parameters are: Command line parameters are:
@ -154,9 +155,9 @@ your host uses a different port than the default (e.g, HostGator)
Using this setup, you might run the following command: Using this setup, you might run the following command:
{% highlight shell %} ```sh
rsync -crvz --rsh='ssh -p2222' --delete-after --delete-excluded _site/ hostuser@example.org: rsync -crvz --rsh='ssh -p2222' --delete-after --delete-excluded _site/ hostuser@example.org:
{% endhighlight %} ```
Don't forget the column `:` after server name! Don't forget the column `:` after server name!
@ -168,10 +169,10 @@ copy it to the output folder. This behavior can be changed in `_config.yml`.
Just add the following line: Just add the following line:
{% highlight yaml %} ```yaml
# Do not copy these files to the output directory # Do not copy these files to the output directory
exclude: ["deploy"] exclude: ["deploy"]
{% endhighlight %} ```
Alternatively, you can use an `rsync-exclude.txt` file to control which files will be transferred to your server. Alternatively, you can use an `rsync-exclude.txt` file to control which files will be transferred to your server.
@ -204,7 +205,7 @@ low-volume blogs as you only pay for what you use.
## OpenShift ## OpenShift
If you'd like to deploy your site to an OpenShift gear, there's [a cartridge If you'd like to deploy your site to an OpenShift gear, there's [a cartridge
for that](https://github.com/openshift-cartridges/openshift-jekyll-cartridge). for that](https://github.com/openshift-quickstart/jekyll-openshift).
<div class="note"> <div class="note">
<h5>ProTip™: Use GitHub Pages for zero-hassle Jekyll hosting</h5> <h5>ProTip™: Use GitHub Pages for zero-hassle Jekyll hosting</h5>

View File

@ -9,10 +9,10 @@ don't want to publish yet. To get up and running with drafts, create a
`_drafts` folder in your site's root (as described in the [site structure](/docs/structure/) section) and create your `_drafts` folder in your site's root (as described in the [site structure](/docs/structure/) section) and create your
first draft: first draft:
{% highlight text %} ```text
|-- _drafts/ |-- _drafts/
| |-- a-draft-post.md | |-- a-draft-post.md
{% endhighlight %} ```
To preview your site with drafts, simply run `jekyll serve` or `jekyll build` To preview your site with drafts, simply run `jekyll serve` or `jekyll build`
with the `--drafts` switch. Each will be assigned the value modification time with the `--drafts` switch. Each will be assigned the value modification time

View File

@ -11,9 +11,9 @@ may want to install, depending on how you plan to use Jekyll.
Kramdown comes with optional support for LaTeX to PNG rendering via [MathJax](https://www.mathjax.org) within math blocks. See the Kramdown documentation on [math blocks](http://kramdown.gettalong.org/syntax.html#math-blocks) and [math support](http://kramdown.gettalong.org/converter/html.html#math-support) for more details. MathJax requires you to include JavaScript or CSS to render the LaTeX, e.g. Kramdown comes with optional support for LaTeX to PNG rendering via [MathJax](https://www.mathjax.org) within math blocks. See the Kramdown documentation on [math blocks](http://kramdown.gettalong.org/syntax.html#math-blocks) and [math support](http://kramdown.gettalong.org/converter/html.html#math-support) for more details. MathJax requires you to include JavaScript or CSS to render the LaTeX, e.g.
{% highlight html %} ```html
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script> <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
{% endhighlight %} ```
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](http://gastonsanchez.com/opinion/2014/02/16/Mathjax-with-jekyll/).

View File

@ -10,12 +10,12 @@ Jekyll as a special file. The front matter must be the first thing in the file
and must take the form of valid YAML set between triple-dashed lines. Here is a and must take the form of valid YAML set between triple-dashed lines. Here is a
basic example: basic example:
{% highlight yaml %} ```yaml
--- ---
layout: post layout: post
title: Blogging Like a Hacker title: Blogging Like a Hacker
--- ---
{% endhighlight %} ```
Between these triple-dashed lines, you can set predefined variables (see below Between these triple-dashed lines, you can set predefined variables (see below
for a reference) or even create custom ones of your own. These variables will for a reference) or even create custom ones of your own. These variables will
@ -108,7 +108,7 @@ 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 instance, if you set a title, you can use that in your layout to set the page
title: title:
{% highlight html %} ```html
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
@ -116,7 +116,7 @@ title:
</head> </head>
<body> <body>
... ...
{% endhighlight %} ```
## Predefined Variables for Posts ## Predefined Variables for Posts

View File

@ -22,14 +22,14 @@ 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 Project Pages complicates the proper resolution of URLs. In order to assure your
site builds properly, use `site.github.url` in your URL's. site builds properly, use `site.github.url` in your URL's.
{% highlight html %} ```html
{% raw %} {% raw %}
<!-- Useful for styles with static names... --> <!-- Useful for styles with static names... -->
<link href="{{ site.github.url }}/path/to/css.css" rel="stylesheet"> <link href="{{ site.github.url }}/path/to/css.css" rel="stylesheet">
<!-- and for documents/pages whose URL's can change... --> <!-- and for documents/pages whose URL's can change... -->
<a href="{{ page.url | prepend: site.github.url }}">{{ page.title }}</a> <a href="{{ page.url | prepend: site.github.url }}">{{ page.title }}</a>
{% endraw %} {% endraw %}
{% endhighlight %} ```
This way you can preview your site locally from the site root on localhost, 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 but when GitHub generates your pages from the gh-pages branch all the URLs
@ -54,7 +54,7 @@ few minor details.
currently-deployed version of the gem in your project, add the currently-deployed version of the gem in your project, add the
following to your <code>Gemfile</code>: following to your <code>Gemfile</code>:
{% highlight ruby %} ```ruby
source 'https://rubygems.org' source 'https://rubygems.org'
require 'json' require 'json'
@ -62,18 +62,18 @@ require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read) versions = JSON.parse(open('https://pages.github.com/versions.json').read)
gem 'github-pages', versions['github-pages'] gem 'github-pages', versions['github-pages']
{% endhighlight %} ```
This will ensure that when you run <code>bundle install</code>, you This will ensure that when you run <code>bundle install</code>, you
have the correct version of the <code>github-pages</code> gem. have the correct version of the <code>github-pages</code> gem.
If that fails, simplify it: If that fails, simplify it:
{% highlight ruby %} ```ruby
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'github-pages' gem 'github-pages'
{% endhighlight %} ```
And be sure to run <code>bundle update</code> often. And be sure to run <code>bundle update</code> often.

View File

@ -7,7 +7,7 @@ permalink: /docs/installation/
Getting Jekyll installed and ready-to-go should only take a few minutes. Getting Jekyll installed and ready-to-go should only take a few minutes.
If it ever becomes a pain, please [file an issue]({{ site.repository }}/issues/new) If it ever becomes a pain, please [file an issue]({{ site.repository }}/issues/new)
(or submit a pull request) describing the issue you (or submit a pull request) describing the issue you
encountered and how we might make the process easier encountered and how we might make the process easier.
### Requirements ### Requirements
@ -37,9 +37,9 @@ The best way to install Jekyll is via
[RubyGems](http://rubygems.org/pages/download). At the terminal prompt, [RubyGems](http://rubygems.org/pages/download). At the terminal prompt,
simply run the following command to install Jekyll: simply run the following command to install Jekyll:
{% highlight shell %} ```sh
$ gem install jekyll $ gem install jekyll
{% endhighlight %} ```
All of Jekylls gem dependencies are automatically installed by the above All of Jekylls gem dependencies are automatically installed by the above
command, so you wont have to worry about them at all. If you have problems command, so you wont have to worry about them at all. If you have problems
@ -62,28 +62,28 @@ community can improve the experience for everyone.
In order to install a pre-release, make sure you have all the requirements In order to install a pre-release, make sure you have all the requirements
installed properly and run: installed properly and run:
{% highlight shell %} ```sh
gem install jekyll --pre gem install jekyll --pre
{% endhighlight %} ```
This will install the latest pre-release. If you want a particular pre-release, This will install the latest pre-release. If you want a particular pre-release,
use the `-v` switch to indicate the version you'd like to install: use the `-v` switch to indicate the version you'd like to install:
{% highlight shell %} ```sh
gem install jekyll -v '2.0.0.alpha.1' gem install jekyll -v '2.0.0.alpha.1'
{% endhighlight %} ```
If you'd like to install a development version of Jekyll, the process is a bit If you'd like to install a development version of Jekyll, the process is a bit
more involved. This gives you the advantage of having the latest and greatest, more involved. This gives you the advantage of having the latest and greatest,
but may be unstable. but may be unstable.
{% highlight shell %} ```sh
$ git clone git://github.com/jekyll/jekyll.git $ git clone git://github.com/jekyll/jekyll.git
$ cd jekyll $ cd jekyll
$ script/bootstrap $ script/bootstrap
$ bundle exec rake build $ bundle exec rake build
$ ls pkg/*.gem | head -n 1 | xargs gem install -l $ ls pkg/*.gem | head -n 1 | xargs gem install -l
{% endhighlight %} ```
## Optional Extras ## Optional Extras

View File

@ -46,7 +46,7 @@ directory with a suitable name for the page you want to create. For a site with
a homepage, an about page, and a contact page, heres what the root directory a homepage, an about page, and a contact page, heres what the root directory
and associated URLs might look like: and associated URLs might look like:
{% highlight shell %} ```sh
. .
|-- _config.yml |-- _config.yml
|-- _includes/ |-- _includes/
@ -57,7 +57,7 @@ and associated URLs might look like:
|-- index.html # => http://example.com/ |-- index.html # => http://example.com/
|-- other.md # => http://example.com/other.html |-- other.md # => http://example.com/other.html
└── contact.html # => http://example.com/contact.html └── contact.html # => http://example.com/contact.html
{% endhighlight %} ```
### Named folders containing index HTML files ### Named folders containing index HTML files
@ -69,7 +69,7 @@ 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 the respective `index.html` file. Here's an example of what this structure
might look like: might look like:
{% highlight shell %} ```sh
. .
├── _config.yml ├── _config.yml
├── _includes/ ├── _includes/
@ -83,7 +83,7 @@ might look like:
|── other/ |── other/
| └── index.md # => http://example.com/other/ | └── index.md # => http://example.com/other/
└── index.html # => http://example.com/ └── index.html # => http://example.com/
{% endhighlight %} ```
This approach may not suit everyone, but for people who like clean URLs its This approach may not suit everyone, but for people who like clean URLs its
simple and it works. In the end, the decision is yours! simple and it works. In the end, the decision is yours!

View File

@ -28,18 +28,18 @@ your `_config.yml` under `gems`. For Jekyll 2, this is standard.
To enable pagination for your blog, add a line to the `_config.yml` file that To enable pagination for your blog, add a line to the `_config.yml` file that
specifies how many items should be displayed per page: specifies how many items should be displayed per page:
{% highlight yaml %} ```yaml
paginate: 5 paginate: 5
{% endhighlight %} ```
The number should be the maximum number of Posts youd like to be displayed The number should be the maximum number of Posts youd like to be displayed
per-page in the generated site. per-page in the generated site.
You may also specify the destination of the pagination pages: You may also specify the destination of the pagination pages:
{% highlight yaml %} ```yaml
paginate_path: "/blog/page:num/" paginate_path: "/blog/page:num/"
{% endhighlight %} ```
This will read in `blog/index.html`, send it each pagination page in Liquid as This will read in `blog/index.html`, send it each pagination page in Liquid as
`paginator` and write the output to `blog/page:num/`, where `:num` is the `paginator` and write the output to `blog/page:num/`, where `:num` is the
@ -146,7 +146,7 @@ the `paginator` variable that will now be available to you. Youll probably
want to do this in one of the main pages of your site. Heres one example of a want to do this in one of the main pages of your site. Heres one example of a
simple way of rendering paginated Posts in a HTML file: simple way of rendering paginated Posts in a HTML file:
{% highlight html %} ```html
{% raw %} {% raw %}
--- ---
layout: default layout: default
@ -179,7 +179,7 @@ title: My Blog
{% endif %} {% endif %}
</div> </div>
{% endraw %} {% endraw %}
{% endhighlight %} ```
<div class="note warning"> <div class="note warning">
<h5>Beware the page one edge-case</h5> <h5>Beware the page one edge-case</h5>
@ -193,7 +193,7 @@ title: My Blog
The following HTML snippet should handle page one, and render a list of each The following HTML snippet should handle page one, and render a list of each
page with links to all but the current page. page with links to all but the current page.
{% highlight html %} ```html
{% raw %} {% raw %}
{% if paginator.total_pages > 1 %} {% if paginator.total_pages > 1 %}
<div class="pagination"> <div class="pagination">
@ -221,4 +221,4 @@ page with links to all but the current page.
</div> </div>
{% endif %} {% endif %}
{% endraw %} {% endraw %}
{% endhighlight %} ```

View File

@ -93,7 +93,7 @@ For instance, a generator can inject values computed at build time for template
variables. In the following example the template `reading.html` has two variables. In the following example the template `reading.html` has two
variables `ongoing` and `done` that we fill in the generator: variables `ongoing` and `done` that we fill in the generator:
{% highlight ruby %} ```ruby
module Reading module Reading
class Generator < Jekyll::Generator class Generator < Jekyll::Generator
def generate(site) def generate(site)
@ -105,11 +105,11 @@ module Reading
end end
end end
end end
{% endhighlight %} ```
This is a more complex generator that generates new pages: This is a more complex generator that generates new pages:
{% highlight ruby %} ```ruby
module Jekyll module Jekyll
class CategoryPage < Page class CategoryPage < Page
@ -142,7 +142,7 @@ module Jekyll
end end
end end
{% endhighlight %} ```
In this example, our generator will create a series of files under the In this example, our generator will create a series of files under the
`categories` directory for each category, listing the posts in each category `categories` directory for each category, listing the posts in each category
@ -189,7 +189,7 @@ languages are implemented using this method.
Below is a converter that will take all posts ending in `.upcase` and process Below is a converter that will take all posts ending in `.upcase` and process
them using the `UpcaseConverter`: them using the `UpcaseConverter`:
{% highlight ruby %} ```ruby
module Jekyll module Jekyll
class UpcaseConverter < Converter class UpcaseConverter < Converter
safe true safe true
@ -208,7 +208,7 @@ module Jekyll
end end
end end
end end
{% endhighlight %} ```
Converters should implement at a minimum 3 methods: Converters should implement at a minimum 3 methods:
@ -266,16 +266,16 @@ As of version 2.5.0, Jekyll can be extended with plugins which provide
subcommands for the `jekyll` executable. This is possible by including the subcommands for the `jekyll` executable. This is possible by including the
relevant plugins in a `Gemfile` group called `:jekyll_plugins`: relevant plugins in a `Gemfile` group called `:jekyll_plugins`:
{% highlight ruby %} ```ruby
group :jekyll_plugins do group :jekyll_plugins do
gem "my_fancy_jekyll_plugin" gem "my_fancy_jekyll_plugin"
end end
{% endhighlight %} ```
Each `Command` must be a subclass of the `Jekyll::Command` class and must Each `Command` must be a subclass of the `Jekyll::Command` class and must
contain one class method: `init_with_program`. An example: contain one class method: `init_with_program`. An example:
{% highlight ruby %} ```ruby
class MyNewCommand < Jekyll::Command class MyNewCommand < Jekyll::Command
class << self class << self
def init_with_program(prog) def init_with_program(prog)
@ -292,7 +292,7 @@ class MyNewCommand < Jekyll::Command
end end
end end
end end
{% endhighlight %} ```
Commands should implement this single class method: Commands should implement this single class method:
@ -328,7 +328,7 @@ hooking into the tagging system. Built-in examples added by Jekyll include the
`highlight` and `include` tags. Below is an example of a custom liquid tag that `highlight` and `include` tags. Below is an example of a custom liquid tag that
will output the time the page was rendered: will output the time the page was rendered:
{% highlight ruby %} ```ruby
module Jekyll module Jekyll
class RenderTimeTag < Liquid::Tag class RenderTimeTag < Liquid::Tag
@ -344,7 +344,7 @@ module Jekyll
end end
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag) Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
{% endhighlight %} ```
At a minimum, liquid tags must implement: At a minimum, liquid tags must implement:
@ -372,24 +372,24 @@ At a minimum, liquid tags must implement:
You must also register the custom tag with the Liquid template engine as You must also register the custom tag with the Liquid template engine as
follows: follows:
{% highlight ruby %} ```ruby
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag) Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
{% endhighlight %} ```
In the example above, we can place the following tag anywhere in one of our In the example above, we can place the following tag anywhere in one of our
pages: pages:
{% highlight ruby %} ```ruby
{% raw %} {% raw %}
<p>{% render_time page rendered at: %}</p> <p>{% render_time page rendered at: %}</p>
{% endraw %} {% endraw %}
{% endhighlight %} ```
And we would get something like this on the page: And we would get something like this on the page:
{% highlight html %} ```html
<p>page rendered at: Tue June 22 23:38:47 0500 2010</p> <p>page rendered at: Tue June 22 23:38:47 0500 2010</p>
{% endhighlight %} ```
### Liquid filters ### Liquid filters
@ -398,7 +398,7 @@ add tags above. Filters are simply modules that export their methods to liquid.
All methods will have to take at least one parameter which represents the input All methods will have to take at least one parameter which represents the input
of the filter. The return value will be the output of the filter. of the filter. The return value will be the output of the filter.
{% highlight ruby %} ```ruby
module Jekyll module Jekyll
module AssetFilter module AssetFilter
def asset_url(input) def asset_url(input)
@ -408,7 +408,7 @@ module Jekyll
end end
Liquid::Template.register_filter(Jekyll::AssetFilter) Liquid::Template.register_filter(Jekyll::AssetFilter)
{% endhighlight %} ```
<div class="note"> <div class="note">
<h5>ProTip™: Access the site object using Liquid</h5> <h5>ProTip™: Access the site object using Liquid</h5>
@ -469,7 +469,7 @@ There are two flags to be aware of when writing a plugin:
To use one of the example plugins above as an illustration, here is how youd To use one of the example plugins above as an illustration, here is how youd
specify these two flags: specify these two flags:
{% highlight ruby %} ```ruby
module Jekyll module Jekyll
class UpcaseConverter < Converter class UpcaseConverter < Converter
safe true safe true
@ -477,7 +477,7 @@ module Jekyll
... ...
end end
end end
{% endhighlight %} ```
## Hooks ## Hooks
@ -491,18 +491,20 @@ call whenever the hook is triggered. For example, if you want to execute some
custom functionality every time Jekyll renders a post, you could register a custom functionality every time Jekyll renders a post, you could register a
hook like this: hook like this:
{% highlight ruby %} ```ruby
Jekyll::Hooks.register :posts, :post_render do |post| Jekyll::Hooks.register :posts, :post_render do |post|
# code to call after Jekyll renders a post # code to call after Jekyll renders a post
end end
{% endhighlight %} ```
Jekyll provides hooks for <code>:site</code>, <code>:pages</code>, Jekyll provides hooks for <code>:site</code>, <code>:pages</code>,
<code>:posts</code>, and <code>:documents</code>. In all cases, Jekyll calls your <code>:posts</code>, and <code>:documents</code>. In all cases, Jekyll calls
hooks with the container object as the first callback parameter. But in the your hooks with the container object as the first callback parameter. However,
case of <code>:pre_render</code>, your hook will also receive a payload hash as all `:pre_render` hooks and the`:site, :post_render` hook will also provide a
a second parameter which allows you full control over the variables that are payload hash as a second parameter. In the case of `:pre_render`, the payload
available while rendering. gives you full control over the variables that are available while rendering.
In the case of `:site, :post_render`, the payload contains final values after
rendering all the site (useful for sitemaps, feeds, etc).
The complete list of available hooks is below: The complete list of available hooks is below:
@ -908,6 +910,8 @@ LESS.js files during generation.
- [Jekyll Autoprefixer](https://github.com/vwochnik/jekyll-autoprefixer): Autoprefixer integration for Jekyll - [Jekyll Autoprefixer](https://github.com/vwochnik/jekyll-autoprefixer): Autoprefixer integration for Jekyll
- [Jekyll-breadcrumbs](https://github.com/git-no/jekyll-breadcrumbs): Creates breadcrumbs for Jekyll 3.x, includes features like SEO optimization, optional breadcrumb item translation and more. - [Jekyll-breadcrumbs](https://github.com/git-no/jekyll-breadcrumbs): Creates breadcrumbs for Jekyll 3.x, includes features like SEO optimization, optional breadcrumb item translation and more.
- [generator-jekyllized](https://github.com/sondr3/generator-jekyllized): A Yeoman generator for rapidly developing sites with Gulp. Live reload your site, automatically minify and optimize your assets and much more. - [generator-jekyllized](https://github.com/sondr3/generator-jekyllized): A Yeoman generator for rapidly developing sites with Gulp. Live reload your site, automatically minify and optimize your assets and much more.
- [Jekyll-Spotify](https://github.com/MertcanGokgoz/Jekyll-Spotify): Easily output Spotify Embed Player for jekyll
- [jekyll-menus](https://github.com/forestryio/jekyll-menus): Hugo style menus for your Jekyll site... recursive menus included.
#### Editors #### Editors

View File

@ -27,18 +27,18 @@ 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 directory. How you name files in this folder is important. Jekyll requires blog
post files to be named according to the following format: post files to be named according to the following format:
{% highlight shell %} ```sh
YEAR-MONTH-DAY-title.MARKUP YEAR-MONTH-DAY-title.MARKUP
{% endhighlight %} ```
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit 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 numbers, and `MARKUP` is the file extension representing the format used in the
file. For example, the following are examples of valid post filenames: file. For example, the following are examples of valid post filenames:
{% highlight shell %} ```sh
2011-12-31-new-years-eve-is-awesome.md 2011-12-31-new-years-eve-is-awesome.md
2012-09-12-how-to-write-a-blog.textile 2012-09-12-how-to-write-a-blog.md
{% endhighlight %} ```
<div class="note"> <div class="note">
<h5>ProTip™: Link to other posts</h5> <h5>ProTip™: Link to other posts</h5>
@ -90,16 +90,16 @@ variable in a post.
Including an image asset in a post: Including an image asset in a post:
{% highlight text %} ```text
... which is shown in the screenshot below: ... which is shown in the screenshot below:
![My helpful screenshot]({% raw %}{{ site.url }}{% endraw %}/assets/screenshot.jpg) ![My helpful screenshot]({% raw %}{{ site.url }}{% endraw %}/assets/screenshot.jpg)
{% endhighlight %} ```
Linking to a PDF for readers to download: Linking to a PDF for readers to download:
{% highlight text %} ```text
... you can [get the PDF]({% raw %}{{ site.url }}{% endraw %}/assets/mydoc.pdf) directly. ... you can [get the PDF]({% raw %}{{ site.url }}{% endraw %}/assets/mydoc.pdf) directly.
{% endhighlight %} ```
<div class="note"> <div class="note">
<h5>ProTip™: Link using just the site root URL</h5> <h5>ProTip™: Link using just the site root URL</h5>
@ -119,7 +119,7 @@ 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. Heres a language](https://docs.shopify.com/themes/liquid/basics) and its tags. Heres a
basic example of how to create a list of links to your blog posts: basic example of how to create a list of links to your blog posts:
{% highlight html %} ```html
<ul> <ul>
{% raw %}{% for post in site.posts %}{% endraw %} {% raw %}{% for post in site.posts %}{% endraw %}
<li> <li>
@ -127,7 +127,7 @@ basic example of how to create a list of links to your blog posts:
</li> </li>
{% raw %}{% endfor %}{% endraw %} {% raw %}{% endfor %}{% endraw %}
</ul> </ul>
{% endhighlight %} ```
Of course, you have full control over how (and where) you display your posts, 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 and how you structure your site. You should read more about [how templates
@ -146,7 +146,7 @@ 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 a little hint about the post's content by adding the first paragraph of each of
your posts: your posts:
{% highlight html %} ```html
<ul> <ul>
{% raw %}{% for post in site.posts %}{% endraw %} {% raw %}{% for post in site.posts %}{% endraw %}
<li> <li>
@ -155,22 +155,22 @@ your posts:
</li> </li>
{% raw %}{% endfor %}{% endraw %} {% raw %}{% endfor %}{% endraw %}
</ul> </ul>
{% endhighlight %} ```
Because Jekyll grabs the first paragraph you will not need to wrap the excerpt 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 in `p` tags, which is already done for you. These tags can be removed with the
following if you'd prefer: following if you'd prefer:
{% highlight html %} ```html
{% raw %}{{ post.excerpt | remove: '<p>' | remove: '</p>' }}{% endraw %} {% raw %}{{ post.excerpt | remove: '<p>' | remove: '</p>' }}{% endraw %}
{% endhighlight %} ```
If you don't like the automatically-generated post excerpt, it can be 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 explicitly overridden by adding an `excerpt` value to your post's YAML
Front Matter. Alternatively, you can choose to define a custom Front Matter. Alternatively, you can choose to define a custom
`excerpt_separator` in the post's YAML front matter: `excerpt_separator` in the post's YAML front matter:
{% highlight text %} ```text
--- ---
excerpt_separator: <!--more--> excerpt_separator: <!--more-->
--- ---
@ -178,7 +178,7 @@ excerpt_separator: <!--more-->
Excerpt Excerpt
<!--more--> <!--more-->
Out-of-excerpt Out-of-excerpt
{% endhighlight %} ```
You can also set the `excerpt_separator` globally in your `_config.yml` You can also set the `excerpt_separator` globally in your `_config.yml`
configuration file. configuration file.
@ -197,7 +197,7 @@ 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. either Pygments or Rouge, and including a code snippet in any post is easy.
Just use the dedicated Liquid tag as follows: Just use the dedicated Liquid tag as follows:
{% highlight text %} ```text
{% raw %}{% highlight ruby %}{% endraw %} {% raw %}{% highlight ruby %}{% endraw %}
def show def show
@widget = Widget(params[:id]) @widget = Widget(params[:id])
@ -207,11 +207,11 @@ def show
end end
end end
{% raw %}{% endhighlight %}{% endraw %} {% raw %}{% endhighlight %}{% endraw %}
{% endhighlight %} ```
And the output will look like this: And the output will look like this:
{% highlight ruby %} ```ruby
def show def show
@widget = Widget(params[:id]) @widget = Widget(params[:id])
respond_to do |format| respond_to do |format|
@ -219,7 +219,7 @@ def show
format.json { render json: @widget } format.json { render json: @widget }
end end
end end
{% endhighlight %} ```
<div class="note"> <div class="note">
<h5>ProTip™: Show line numbers</h5> <h5>ProTip™: Show line numbers</h5>

View File

@ -6,14 +6,14 @@ permalink: /docs/quickstart/
For the impatient, here's how to get a boilerplate Jekyll site up and running. For the impatient, here's how to get a boilerplate Jekyll site up and running.
{% highlight shell %} ```sh
~ $ gem install jekyll ~ $ gem install jekyll bundler
~ $ jekyll new myblog ~ $ jekyll new myblog
~ $ cd myblog ~ $ cd myblog
~/myblog $ bundle install ~/myblog $ bundle install
~/myblog $ bundle exec jekyll serve ~/myblog $ bundle exec jekyll serve
# => Now browse to http://localhost:4000 # => Now browse to http://localhost:4000
{% endhighlight %} ```
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`. 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`.

View File

@ -26,6 +26,7 @@ Jekylls growing use is producing a wide variety of tutorials, frameworks, ext
- [Jekyll Bootstrap](http://jekyllbootstrap.com), 0 to Blog in 3 minutes. Provides detailed explanations, examples, and helper-code to make getting started with Jekyll easier. - [Jekyll Bootstrap](http://jekyllbootstrap.com), 0 to Blog in 3 minutes. Provides detailed explanations, examples, and helper-code to make getting started with Jekyll easier.
- [Integrating Twitter with Jekyll](http://www.justkez.com/integrating-twitter-with-jekyll/) - [Integrating Twitter with Jekyll](http://www.justkez.com/integrating-twitter-with-jekyll/)
> “Having migrated Justkez.com to be based on Jekyll, I was pondering how I might include my recent twitterings on the front page of the site. In the WordPress world, this would have been done via a plugin which may or may not have hung the loading of the page, might have employed caching, but would certainly have had some overheads. … Not in Jekyll.” > “Having migrated Justkez.com to be based on Jekyll, I was pondering how I might include my recent twitterings on the front page of the site. In the WordPress world, this would have been done via a plugin which may or may not have hung the loading of the page, might have employed caching, but would certainly have had some overheads. … Not in Jekyll.”
- [Staticman](https://staticman.net): Add user-generated content to a Jekyll site (free and open source)
### Other commentary ### Other commentary

View File

@ -14,12 +14,12 @@ product.
A basic Jekyll site usually looks something like this: A basic Jekyll site usually looks something like this:
{% highlight shell %} ```sh
. .
├── _config.yml ├── _config.yml
├── _drafts ├── _drafts
| ├── begin-with-the-crazy-ideas.textile | ├── begin-with-the-crazy-ideas.md
| └── on-simplicity-in-technology.markdown | └── on-simplicity-in-technology.md
├── _includes ├── _includes
| ├── footer.html | ├── footer.html
| └── header.html | └── header.html
@ -27,14 +27,14 @@ A basic Jekyll site usually looks something like this:
| ├── default.html | ├── default.html
| └── post.html | └── post.html
├── _posts ├── _posts
| ├── 2007-10-29-why-every-programmer-should-play-nethack.textile | ├── 2007-10-29-why-every-programmer-should-play-nethack.md
| └── 2009-04-26-barcamp-boston-4-roundup.textile | └── 2009-04-26-barcamp-boston-4-roundup.md
├── _data ├── _data
| └── members.yml | └── members.yml
├── _site ├── _site
├── .jekyll-metadata ├── .jekyll-metadata
└── index.html └── index.html
{% endhighlight %} ```
An overview of what each of these does: An overview of what each of these does:

View File

@ -263,7 +263,7 @@ common tasks easier.
</td> </td>
<td class="align-center"> <td class="align-center">
<p> <p>
<code class="filter">{% raw %}{{ "a \n b" | normalize_whitepace }}{% endraw %}</code> <code class="filter">{% raw %}{{ "a \n b" | normalize_whitespace }}{% endraw %}</code>
</p> </p>
</td> </td>
</tr> </tr>
@ -374,9 +374,9 @@ The default is `default`. They are as follows (with what they filter):
If you have small page fragments that you wish to include in multiple places on If you have small page fragments that you wish to include in multiple places on
your site, you can use the `include` tag. your site, you can use the `include` tag.
{% highlight liquid %} ```liquid
{% raw %}{% include footer.html %}{% endraw %} {% raw %}{% include footer.html %}{% endraw %}
{% endhighlight %} ```
Jekyll expects all include files to be placed in an `_includes` directory at the Jekyll expects all include files to be placed in an `_includes` directory at the
root of your source directory. This will embed the contents of root of your source directory. This will embed the contents of
@ -395,23 +395,23 @@ root of your source directory. This will embed the contents of
You can also pass parameters to an include. Omit the quotation marks to send a variable's value. Liquid curly brackets should not be used here: You can also pass parameters to an include. Omit the quotation marks to send a variable's value. Liquid curly brackets should not be used here:
{% highlight liquid %} ```liquid
{% raw %}{% include footer.html param="value" variable-param=page.variable %}{% endraw %} {% raw %}{% include footer.html param="value" variable-param=page.variable %}{% endraw %}
{% endhighlight %} ```
These parameters are available via Liquid in the include: These parameters are available via Liquid in the include:
{% highlight liquid %} ```liquid
{% raw %}{{ include.param }}{% endraw %} {% raw %}{{ include.param }}{% endraw %}
{% endhighlight %} ```
#### Including files relative to another file #### Including files relative to another file
You can also choose to include file fragments relative to the current file: You can also choose to include file fragments relative to the current file:
{% highlight liquid %} ```liquid
{% raw %}{% include_relative somedir/footer.html %}{% endraw %} {% raw %}{% include_relative somedir/footer.html %}{% endraw %}
{% endhighlight %} ```
You won't need to place your included content within the `_includes` directory. Instead, 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, the inclusion is specifically relative to the file where the tag is being used. For example,
@ -437,7 +437,7 @@ languages](http://pygments.org/languages/)
To render a code block with syntax highlighting, surround your code as follows: To render a code block with syntax highlighting, surround your code as follows:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% highlight ruby %} {% highlight ruby %}
def foo def foo
@ -445,7 +445,7 @@ def foo
end end
{% endhighlight %} {% endhighlight %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
The argument to the `highlight` tag (`ruby` in the example above) is the 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 language identifier. To find the appropriate identifier to use for the language
@ -460,7 +460,7 @@ Including the `linenos` argument will force the highlighted code to include line
numbers. For instance, the following code block would include line numbers next numbers. For instance, the following code block would include line numbers next
to each line: to each line:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% highlight ruby linenos %} {% highlight ruby linenos %}
def foo def foo
@ -468,7 +468,7 @@ def foo
end end
{% endhighlight %} {% endhighlight %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
#### Stylesheets for syntax highlighting #### Stylesheets for syntax highlighting
@ -488,21 +488,21 @@ specify.
You must include the file extension when using the `link` tag. You must include the file extension when using the `link` tag.
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% link _collection/name-of-document.md %} {% link _collection/name-of-document.md %}
{% link _posts/2016-07-26-name-of-post.md %} {% link _posts/2016-07-26-name-of-post.md %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
You can also use this tag to create a link in Markdown as follows: You can also use this tag to create a link in Markdown as follows:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
[Link to a document]({% link _collection/name-of-document.md %}) [Link to a document]({% link _collection/name-of-document.md %})
[Link to a post]({% link _posts/2016-07-26-name-of-post.md %}) [Link to a post]({% link _posts/2016-07-26-name-of-post.md %})
{% endraw %} {% endraw %}
{% endhighlight %} ```
Support for static files and pages is coming in a later release but is Support for static files and pages is coming in a later release but is
**not** released as of v3.2.1. **not** released as of v3.2.1.
@ -512,49 +512,49 @@ Support for static files and pages is coming in a later release but is
If you would like to include a link to a post on your site, the `post_url` tag If you would like 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. will generate the correct permalink URL for the post you specify.
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% post_url 2010-07-21-name-of-post %} {% post_url 2010-07-21-name-of-post %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
If you organize your posts in subdirectories, you need to include subdirectory If you organize your posts in subdirectories, you need to include subdirectory
path to the post: path to the post:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% post_url /subdir/2010-07-21-name-of-post %} {% post_url /subdir/2010-07-21-name-of-post %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
There is no need to include the file extension when using the `post_url` tag. 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: You can also use this tag to create a link to a post in Markdown as follows:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
[Name of Link]({% post_url 2010-07-21-name-of-post %}) [Name of Link]({% post_url 2010-07-21-name-of-post %})
{% endraw %} {% endraw %}
{% endhighlight %} ```
### Gist ### Gist
Use the `gist` tag to easily embed a GitHub Gist onto your site. This works Use the `gist` tag to easily embed a GitHub Gist onto your site. This works
with public or secret gists: with public or secret gists:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% gist parkr/931c1c8d465a04042403 %} {% gist parkr/931c1c8d465a04042403 %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
You may also optionally specify the filename in the gist to display: You may also optionally specify the filename in the gist to display:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% gist parkr/931c1c8d465a04042403 jekyll-private-gist.markdown %} {% gist parkr/931c1c8d465a04042403 jekyll-private-gist.markdown %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
To use the `gist` tag, you'll need to add the To use the `gist` tag, you'll need to add the
[jekyll-gist](https://github.com/jekyll/jekyll-gist) gem to your project. [jekyll-gist](https://github.com/jekyll/jekyll-gist) gem to your project.

View File

@ -27,6 +27,7 @@ Jekyll themes set default layouts, includes, and stylesheets, that can be overri
Jekyll will look first to your site's content, before looking to the theme's defaults, for any requested file in the following folders: Jekyll will look first to your site's content, before looking to the theme's defaults, for any requested file in the following folders:
* `/assets`
* `/_layouts` * `/_layouts`
* `/_includes` * `/_includes`
* `/_sass` * `/_sass`
@ -34,11 +35,15 @@ Jekyll will look first to your site's content, before looking to the theme's def
Refer to your selected theme's documentation and source repository for more information on what files you can override. Refer to your selected theme's documentation and source repository for more information on what files you can override.
{: .note .info} {: .note .info}
To locate theme's files on your computer, run `bundle show` followed by
the name of the theme's gem, e.g. `bundle show minima` for default Jekyll's
theme. Then copy the files you want to override, from the returned path to your root folder.
## Creating a theme ## Creating a theme
Jekyll themes are distributed as Ruby gems. Don't worry, Jekyll will help you scaffold a new theme with the `new-theme` command. Just run `jekyll new-theme` with the theme name as an argument: Jekyll themes are distributed as Ruby gems. Don't worry, Jekyll will help you scaffold a new theme with the `new-theme` command. Just run `jekyll new-theme` with the theme name as an argument:
{% highlight plaintext %} ```sh
jekyll new-theme my-awesome-theme jekyll new-theme my-awesome-theme
create /path/to/my-awesome-theme/_layouts create /path/to/my-awesome-theme/_layouts
create /path/to/my-awesome-theme/_includes create /path/to/my-awesome-theme/_includes
@ -54,7 +59,7 @@ jekyll new-theme my-awesome-theme
create /path/to/my-awesome-theme/.gitignore create /path/to/my-awesome-theme/.gitignore
Your new Jekyll theme, my-awesome-theme, is ready for you in /path/to/my-awesome-theme! Your new Jekyll theme, my-awesome-theme, is ready for you in /path/to/my-awesome-theme!
For help getting started, read /path/to/my-awesome-theme/README.md. For help getting started, read /path/to/my-awesome-theme/README.md.
{% endhighlight %} ```
Add your template files in the corresponding folders, complete the `.gemspec` and the README files according to your needs. Add your template files in the corresponding folders, complete the `.gemspec` and the README files according to your needs.
@ -64,6 +69,12 @@ Theme layouts and includes work just like they work in any Jekyll site. Place la
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 a the `page` layout, and if none exists, will use your theme's `page` layout.
### Assets
Any file in `/assets` will be copied over to the user's site upon build unless they have a file with the same relative path. You may ship any kind of asset here: SCSS, an image, a webfont, etc. These files behave just like pages and static files in Jekyll: if the file has [YAML front matter]({{ site.baseurl }}/docs/frontmatter/) at the top, then it will be rendered. If it does not have YAML front matter, it will simply be copied over into the resulting site. This allows theme creators to ship a default `/assets/styles.scss` file which their layouts can depend on as `/assets/styles.css`.
All files in `/assets` will be output into the compiled site in the `/assets` folder just as you'd expect from using Jekyll on your sites.
### Stylesheets ### Stylesheets
Your theme's stylesheets should be placed in your theme's `/_sass` folder, again, just as you would when authoring a Jekyll site. Your theme's styles can be included in the user's stylesheet using the `@import` directive. Your theme's stylesheets should be placed in your theme's `/_sass` folder, again, just as you would when authoring a Jekyll site. Your theme's styles can be included in the user's stylesheet using the `@import` directive.
@ -94,3 +105,6 @@ Themes are published via [RubyGems.org](https://rubygems.org). You'll need a Rub
2. Next, push your packaged theme up to the RubyGems service, by running the following command, again replacing `my-awesome-jekyll-theme` with the name of your theme: 2. Next, push your packaged theme up to the RubyGems service, by running the following command, again replacing `my-awesome-jekyll-theme` with the name of your theme:
gem push my-awesome-jekyll-theme-*.gem gem push my-awesome-jekyll-theme-*.gem
3. To release a new version of your theme, simply update the version number in the gemspec file, ( `my-awesome-jekyll-theme.gemspec` in this example ), and then repeat Steps 1 & 2 above.
We recommend that you follow [Semantic Versioning](http://semver.org/) while bumping your theme-version.

View File

@ -13,6 +13,7 @@ that might be of help. If the problem youre experiencing isnt covered belo
- [Base-URL Problems](#base-url-problems) - [Base-URL Problems](#base-url-problems)
- [Configuration problems](#configuration-problems) - [Configuration problems](#configuration-problems)
- [Markup Problems](#markup-problems) - [Markup Problems](#markup-problems)
- [Production Problems](#production-problems)
## Installation Problems ## Installation Problems
@ -20,61 +21,61 @@ If you encounter errors during gem installation, you may need to install
the header files for compiling extension modules for Ruby 2.0.0. This the header files for compiling extension modules for Ruby 2.0.0. This
can be done on Ubuntu or Debian by running: can be done on Ubuntu or Debian by running:
{% highlight shell %} ```sh
sudo apt-get install ruby2.0.0-dev sudo apt-get install ruby2.0.0-dev
{% endhighlight %} ```
On Red Hat, CentOS, and Fedora systems you can do this by running: On Red Hat, CentOS, and Fedora systems you can do this by running:
{% highlight shell %} ```sh
sudo yum install ruby-devel sudo yum install ruby-devel
{% endhighlight %} ```
If you installed the above - specifically on Fedora 23 - but the extensions would still not compile, you are probably running a Fedora image that misses the `redhat-rpm-config` package. To solve this, simply run: If you installed the above - specifically on Fedora 23 - but the extensions would still not compile, you are probably running a Fedora image that misses the `redhat-rpm-config` package. To solve this, simply run:
{% highlight shell %} ```sh
sudo dnf install redhat-rpm-config sudo dnf install redhat-rpm-config
{% endhighlight %} ```
On [NearlyFreeSpeech](https://www.nearlyfreespeech.net/) you need to run the On [NearlyFreeSpeech](https://www.nearlyfreespeech.net/) you need to run the
following commands before installing Jekyll: following commands before installing Jekyll:
{% highlight shell %} ```sh
export GEM_HOME=/home/private/gems export GEM_HOME=/home/private/gems
export GEM_PATH=/home/private/gems:/usr/local/lib/ruby/gems/1.8/ export GEM_PATH=/home/private/gems:/usr/local/lib/ruby/gems/1.8/
export PATH=$PATH:/home/private/gems/bin export PATH=$PATH:/home/private/gems/bin
export RB_USER_INSTALL='true' export RB_USER_INSTALL='true'
{% endhighlight %} ```
To install RubyGems on Gentoo: To install RubyGems on Gentoo:
{% highlight shell %} ```sh
sudo emerge -av dev-ruby/rubygems sudo emerge -av dev-ruby/rubygems
{% endhighlight %} ```
On Windows, you may need to install [RubyInstaller On Windows, you may need to install [RubyInstaller
DevKit](https://wiki.github.com/oneclick/rubyinstaller/development-kit). DevKit](https://wiki.github.com/oneclick/rubyinstaller/development-kit).
On Mac OS X, you may need to update RubyGems (using `sudo` only if necessary): On Mac OS X, you may need to update RubyGems (using `sudo` only if necessary):
{% highlight shell %} ```sh
sudo gem update --system sudo gem update --system
{% endhighlight %} ```
If you still have issues, you can download and install new Command Line If you still have issues, you can download and install new Command Line
Tools (such as `gcc`) using the command Tools (such as `gcc`) using the command
{% highlight shell %} ```sh
xcode-select --install xcode-select --install
{% endhighlight %} ```
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): `sudo` only if necessary):
{% highlight shell %} ```sh
sudo gem install jekyll sudo gem install jekyll
{% endhighlight %} ```
Note that upgrading Mac OS X does not automatically upgrade Xcode itself Note that upgrading Mac OS X does not automatically upgrade Xcode itself
(that can be done separately via the App Store), and having an out-of-date (that can be done separately via the App Store), and having an out-of-date
@ -90,22 +91,22 @@ 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 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):
{% highlight shell %} ```sh
sudo gem install -n /usr/local/bin jekyll sudo gem install -n /usr/local/bin jekyll
{% endhighlight %} ```
Alternatively, Homebrew can be installed and used to set up Ruby. This can be Alternatively, Homebrew can be installed and used to set up Ruby. This can be
done as follows: done as follows:
{% highlight shell %} ```sh
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
{% endhighlight %} ```
Once Homebrew is installed, the second step is easy: Once Homebrew is installed, the second step is easy:
{% highlight shell %} ```sh
brew install ruby brew install ruby
{% endhighlight %} ```
Advanced users (with more complex needs) may find it helpful to choose one of a Advanced users (with more complex needs) may find it helpful to choose one of a
number of Ruby version managers ([RVM][], [rbenv][], [chruby][], [etc][].) in number of Ruby version managers ([RVM][], [rbenv][], [chruby][], [etc][].) in
@ -119,15 +120,15 @@ which to install Jekyll.
If you elect to use one of the above methods to install Ruby, it might be If you elect to use one of the above methods to install Ruby, it might be
necessary to modify your `$PATH` variable using the following command: necessary to modify your `$PATH` variable using the following command:
{% highlight shell %} ```sh
export PATH=/usr/local/bin:$PATH export PATH=/usr/local/bin:$PATH
{% endhighlight %} ```
GUI apps can modify the `$PATH` as follows: GUI apps can modify the `$PATH` as follows:
{% highlight shell %} ```sh
launchctl setenv PATH "/usr/local/bin:$PATH" launchctl setenv PATH "/usr/local/bin:$PATH"
{% endhighlight %} ```
Either of these approaches are useful because `/usr/local` is considered a Either of these approaches are useful because `/usr/local` is considered a
"safe" location on systems which have SIP enabled, they avoid potential "safe" location on systems which have SIP enabled, they avoid potential
@ -151,21 +152,21 @@ in order to have the `jekyll` executable be available in your Terminal.
If you are using base-url option like: If you are using base-url option like:
{% highlight shell %} ```sh
jekyll serve --baseurl '/blog' jekyll serve --baseurl '/blog'
{% endhighlight %} ```
… then make sure that you access the site at: … then make sure that you access the site at:
{% highlight shell %} ```sh
http://localhost:4000/blog/index.html http://localhost:4000/blog/index.html
{% endhighlight %} ```
It wont work to just access: It wont work to just access:
{% highlight shell %} ```sh
http://localhost:4000/blog http://localhost:4000/blog
{% endhighlight %} ```
## Configuration problems ## Configuration problems
@ -180,6 +181,11 @@ That is: defaults are overridden by options specified in `_config.yml`,
and flags specified at the command-line will override all other settings and flags specified at the command-line will override all other settings
specified elsewhere. 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`.
## Markup Problems ## Markup Problems
The various markup engines that Jekyll uses may have some issues. This The various markup engines that Jekyll uses may have some issues. This
@ -192,9 +198,9 @@ The latest version, version 2.0, seems to break the use of `{{ "{{" }}` in
templates. Unlike previous versions, using `{{ "{{" }}` in 2.0 triggers the templates. Unlike previous versions, using `{{ "{{" }}` in 2.0 triggers the
following error: following error:
{% highlight shell %} ```sh
'{{ "{{" }}' was not properly terminated with regexp: /\}\}/ (Liquid::SyntaxError) '{{ "{{" }}' was not properly terminated with regexp: /\}\}/ (Liquid::SyntaxError)
{% endhighlight %} ```
### Excerpts ### Excerpts
@ -204,6 +210,13 @@ strange errors where references don't exist or a tag hasn't been closed. If you
run into these errors, try setting `excerpt_separator: ""` in your run into these errors, try setting `excerpt_separator: ""` in your
`_config.yml`, or set it to some nonsense string. `_config.yml`, or set it to some nonsense string.
## Production Problems
If you run into an issue that a static file can't be found in your
production environment during build since v3.2.0 you should set your
[environment to `production`](../configuration/#specifying-a-jekyll-environment-at-build-time).
The issue is caused by trying to copy a non-existing symlink.
<div class="note"> <div class="note">
<h5>Please report issues you encounter!</h5> <h5>Please report issues you encounter!</h5>
<p> <p>

View File

@ -9,9 +9,9 @@ and 2.0 that you'll want to know about.
Before we dive in, go ahead and fetch the latest version of Jekyll: Before we dive in, go ahead and fetch the latest version of Jekyll:
{% highlight shell %} ```sh
$ gem update jekyll $ gem update jekyll
{% endhighlight %} ```
<div class="note feature"> <div class="note feature">
<h5 markdown="1">Diving in</h5> <h5 markdown="1">Diving in</h5>

View File

@ -9,9 +9,9 @@ that you'll want to know about.
Before we dive in, go ahead and fetch the latest version of Jekyll: Before we dive in, go ahead and fetch the latest version of Jekyll:
{% highlight shell %} ```sh
$ gem update jekyll $ gem update jekyll
{% endhighlight %} ```
Please note: Jekyll 3 requires Ruby version >= 2.0.0. Please note: Jekyll 3 requires Ruby version >= 2.0.0.
@ -36,11 +36,11 @@ When iterating over `site.collections`, ensure the above conversions are made.
For `site.collections.myCollection` in Jekyll 2, you now do: For `site.collections.myCollection` in Jekyll 2, you now do:
{% highlight liquid %} ```liquid
{% raw %} {% raw %}
{% assign myCollection = site.collections | where: "label", "myCollection" | first %} {% assign myCollection = site.collections | where: "label", "myCollection" | first %}
{% endraw %} {% endraw %}
{% endhighlight %} ```
This is a bit cumbersome at first, but is easier than a big `for` loop. This is a bit cumbersome at first, but is easier than a big `for` loop.
@ -97,17 +97,17 @@ In Jekyll 3 and above, relative permalinks have been deprecated. If you
created your site using Jekyll 2 and below, you may receive the following created your site using Jekyll 2 and below, you may receive the following
error when trying to **serve** or **build**: error when trying to **serve** or **build**:
{% highlight text %} ```text
Since v3.0, permalinks for pages in subfolders must be relative to the site Since v3.0, permalinks for pages in subfolders must be relative to the site
source directory, not the parent directory. Check source directory, not the parent directory. Check
http://jekyllrb.com/docs/upgrading/ for more info. http://jekyllrb.com/docs/upgrading/ for more info.
{% endhighlight %} ```
This can be fixed by removing the following line from your `_config.yml` file: This can be fixed by removing the following line from your `_config.yml` file:
{% highlight yaml %} ```yaml
relative_permalinks: true relative_permalinks: true
{% endhighlight %} ```
### Permalinks no longer automatically add a trailing slash ### Permalinks no longer automatically add a trailing slash
@ -117,19 +117,19 @@ In Jekyll 2, any URL constructed from the `permalink:` field had a trailing slas
Try adding `future: true` to your `_config.yml` file. Are they showing up now? If they are, then you were ensnared by an issue with the way Ruby parses times. Each of your posts is being read in a different timezone than you might expect and, when compared to the computer's current time, is "in the future." The fix for this is to add [a timezone offset](https://en.wikipedia.org/wiki/List_of_UTC_time_offsets) to each post (and make sure you remove `future: true` from your `_config.yml` file). If you're writing from California, for example, you would change this: Try adding `future: true` to your `_config.yml` file. Are they showing up now? If they are, then you were ensnared by an issue with the way Ruby parses times. Each of your posts is being read in a different timezone than you might expect and, when compared to the computer's current time, is "in the future." The fix for this is to add [a timezone offset](https://en.wikipedia.org/wiki/List_of_UTC_time_offsets) to each post (and make sure you remove `future: true` from your `_config.yml` file). If you're writing from California, for example, you would change this:
{% highlight yaml %} ```yaml
--- ---
date: 2016-02-06 19:32:10 date: 2016-02-06 19:32:10
--- ---
{% endhighlight %} ```
to this (note the offset): to this (note the offset):
{% highlight yaml %} ```yaml
--- ---
date: 2016-02-06 19:32:10 -0800 date: 2016-02-06 19:32:10 -0800
--- ---
{% endhighlight %} ```
### My categories have stopped working! ### My categories have stopped working!

View File

@ -7,7 +7,7 @@ permalink: /docs/usage/
The Jekyll gem makes a `jekyll` executable available to you in your Terminal The Jekyll gem makes a `jekyll` executable available to you in your Terminal
window. You can use this command in a number of ways: window. You can use this command in a number of ways:
{% highlight shell %} ```sh
$ jekyll build $ jekyll build
# => The current folder will be generated into ./_site # => The current folder will be generated into ./_site
@ -20,7 +20,7 @@ $ jekyll build --source <source> --destination <destination>
$ jekyll build --watch $ jekyll build --watch
# => The current folder will be generated into ./_site, # => The current folder will be generated into ./_site,
# watched for changes, and regenerated automatically. # watched for changes, and regenerated automatically.
{% endhighlight %} ```
<div class="note info"> <div class="note info">
<h5>Changes to _config.yml are not included during automatic regeneration.</h5> <h5>Changes to _config.yml are not included during automatic regeneration.</h5>
@ -52,7 +52,7 @@ $ jekyll build --watch
Jekyll also comes with a built-in development server that will allow you to 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. preview what the generated site will look like in your browser locally.
{% highlight shell %} ```sh
$ jekyll serve $ jekyll serve
# => A development server will run at http://localhost:4000/ # => A development server will run at http://localhost:4000/
# Auto-regeneration: enabled. Use `--no-watch` to disable. # Auto-regeneration: enabled. Use `--no-watch` to disable.
@ -61,7 +61,7 @@ $ jekyll serve --detach
# => Same as `jekyll serve` but will detach from the current terminal. # => 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 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. [Read more](http://unixhelp.ed.ac.uk/shell/jobz5.html). # If you cannot find the PID, then do, `ps aux | grep jekyll` and kill the instance. [Read more](http://unixhelp.ed.ac.uk/shell/jobz5.html).
{% endhighlight %} ```
<div class="note info"> <div class="note info">
<h5>Be aware of default behavior</h5> <h5>Be aware of default behavior</h5>
@ -70,10 +70,10 @@ $ jekyll serve --detach
</p> </p>
</div> </div>
{% highlight shell %} ```sh
$ jekyll serve --no-watch $ jekyll serve --no-watch
# => Same as `jekyll serve` but will not watch for changes. # => Same as `jekyll serve` but will not watch for changes.
{% endhighlight %} ```
These are just a few of the available [configuration options](../configuration/). These are just a few of the available [configuration options](../configuration/).
Many configuration options can either be specified as flags on the command line, Many configuration options can either be specified as flags on the command line,
@ -82,17 +82,17 @@ file at the root of the source directory. Jekyll will automatically use the
options from this file when run. For example, if you place the following lines options from this file when run. For example, if you place the following lines
in your `_config.yml` file: in your `_config.yml` file:
{% highlight yaml %} ```yaml
source: _source source: _source
destination: _deploy destination: _deploy
{% endhighlight %} ```
Then the following two commands will be equivalent: Then the following two commands will be equivalent:
{% highlight shell %} ```sh
$ jekyll build $ jekyll build
$ jekyll build --source _source --destination _deploy $ jekyll build --source _source --destination _deploy
{% endhighlight %} ```
For more about the possible configuration options, see the For more about the possible configuration options, see the
[configuration](../configuration/) page. [configuration](../configuration/) page.

View File

@ -115,8 +115,7 @@ following is a reference of the available data.
If the page being processed is a Post, this contains a list of up to ten If the page being processed is a Post, this contains a list of up to ten
related Posts. By default, these are the ten most recent posts. related Posts. By default, these are the ten most recent posts.
For high quality but slow to compute results, run the For high quality but slow to compute results, run the
<code>jekyll</code> command with the <code>--lsi</code> (latent semantic <code>jekyll</code> command with the <code>--lsi</code> (<a href="https://en.wikipedia.org/wiki/Latent_semantic_analysis#Latent_semantic_indexing">latent semantic indexing</a>) option. Also note GitHub Pages does not support the <code>lsi</code> option when generating sites.
indexing) option. Also note GitHub Pages does not support the <code>lsi</code> option when generating sites.
</p></td> </p></td>
</tr> </tr>

View File

@ -29,9 +29,9 @@ Additionally, you might need to change the code page of the console window to UT
in case you get a "Liquid Exception: Incompatible character encoding" error during in case you get a "Liquid Exception: Incompatible character encoding" error during
the site generation process. It can be done with the following command: the site generation process. It can be done with the following command:
{% highlight shell %} ```sh
$ chcp 65001 $ chcp 65001
{% endhighlight %} ```
[windows-installation]: http://jekyll-windows.juthilo.com/ [windows-installation]: http://jekyll-windows.juthilo.com/
[hitimes-issue]: https://github.com/copiousfreetime/hitimes/issues/40 [hitimes-issue]: https://github.com/copiousfreetime/hitimes/issues/40
@ -43,9 +43,9 @@ As of v1.3.0, Jekyll uses the `listen` gem to watch for changes when the
built-in support for UNIX systems, it requires an extra gem for compatibility built-in support for UNIX systems, it requires an extra gem for compatibility
with Windows. Add the following to the Gemfile for your site: with Windows. Add the following to the Gemfile for your site:
{% highlight ruby %} ```ruby
gem 'wdm', '~> 0.1.0' if Gem.win_platform? gem 'wdm', '~> 0.1.0' if Gem.win_platform?
{% endhighlight %} ```
### How to install github-pages ### How to install github-pages
@ -81,7 +81,7 @@ This gem is also needed in the github-pages and to get it running on Windows x64
`choco install libiconv -Source "https://www.nuget.org/api/v2/"`{:.language-ruby} `choco install libiconv -Source "https://www.nuget.org/api/v2/"`{:.language-ruby}
{% highlight ruby %} ```ruby
gem install nokogiri --^ gem install nokogiri --^
--with-xml2-include=C:\Chocolatey\lib\libxml2.2.7.8.7\build\native\include^ --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-xml2-lib=C:\Chocolatey\lib\libxml2.redist.2.7.8.7\build\native\bin\v110\x64\Release\dynamic\cdecl^
@ -89,7 +89,7 @@ This gem is also needed in the github-pages and to get it running on Windows x64
--with-iconv-lib=C:\Chocolatey\lib\libiconv.redist.1.14.0.11\build\native\bin\v110\x64\Release\dynamic\cdecl^ --with-iconv-lib=C:\Chocolatey\lib\libiconv.redist.1.14.0.11\build\native\bin\v110\x64\Release\dynamic\cdecl^
--with-xslt-include=C:\Chocolatey\lib\libxslt.1.1.28.0\build\native\include^ --with-xslt-include=C:\Chocolatey\lib\libxslt.1.1.28.0\build\native\include^
--with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic --with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic
{% endhighlight %} ```
#### Install github-pages #### Install github-pages
@ -98,10 +98,10 @@ This gem is also needed in the github-pages and to get it running on Windows x64
* Copy & paste the two lines into the file: * Copy & paste the two lines into the file:
{% highlight ruby %} ```ruby
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'github-pages' gem 'github-pages'
{% endhighlight %} ```
* **Note:** We use an unsecure connection because SSL throws exceptions in the version of Ruby * **Note:** We use an unsecure connection because SSL throws exceptions in the version of Ruby
* Open a command prompt, target your local blog repository root, and install github-pages: `bundle install` * Open a command prompt, target your local blog repository root, and install github-pages: `bundle install`

View File

@ -1,5 +1,5 @@
{% for item in include.items %} {% for item in include.items %}
{% assign item_url = item | prepend:"/docs/" | append:"/" %} {% assign item_url = item | prepend:"/docs/" | append:"/" %}
{% assign doc = site.docs | where: "url", item_url | first %} {% assign doc = site.docs | where: "url", item_url | first %}
<option value="{{ site.url }}{{ doc.url }}">{{ doc.title }}</option> <option value="{{ doc.url }}">{{ doc.title }}</option>
{% endfor %} {% endfor %}

View File

@ -2,6 +2,6 @@
{% for item in include.items %} {% for item in include.items %}
{% assign item_url = item | prepend:"/docs/" | append:"/" %} {% assign item_url = item | prepend:"/docs/" | append:"/" %}
{% assign p = site.docs | where:"url", item_url | first %} {% assign p = site.docs | where:"url", item_url | first %}
<li class="{% if item_url == page.url %}current{% endif %}"><a href="{{ site.url }}{{ p.url }}">{{ p.title }}</a></li> <li class="{% if item_url == page.url %}current{% endif %}"><a href="{{ p.url }}">{{ p.title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -0,0 +1,18 @@
---
layout: news_item
title: "Jekyll Admin Initial Release"
date: "2016-08-25 09:50:00 +0300"
author: mertkahyaoglu
categories: [community]
---
[Jekyll's Google Summer of Code Project](http://jekyllrb.com/news/2016/06/03/update-on-jekyll-s-google-summer-of-code-projects/) has concluded. After three months of hard (but fun) work with my mentors @benbalter, @jldec, and @parkr, I'm proud to announce [Jekyll Admin](https://github.com/jekyll/jekyll-admin)'s [initial release](https://github.com/jekyll/jekyll-admin/releases/tag/v0.1.0). Jekyll admin is a Jekyll plugin that provides users with a traditional CMS-style graphical interface to author content and administer Jekyll sites. You can start to use it right away by following [these instructions](https://github.com/jekyll/jekyll-admin#installation).
As a Google Summer of Code student, I feel very lucky to be part of a project that the community has been wanting for such a long time. The three-month Google Summer of Code period was a great journey. It was a lot of fun developing the project and seeing how it could help the community, and going forward, we are really excited to see where the project goes with the help of the amazing Jekyll community.
I would like to thank my mentors who embraced me as their teammate and guided me throughout the process. They have put a lot of work and time to mentor me and helped me with everything. It was a great pleasure to work with them. I also would like to thank the wonderful Jekyll community for making Jekyll what it is today. It was amazing to see the community contribute to the project and give their feedback
prior to its release. I'm sure that they will support Jekyll Admin as much as they can and move Jekyll even further.
Please let us know what you think about [Jekyll Admin](https://github.com/jekyll/jekyll-admin) and feel free to [contribute](https://github.com/jekyll/jekyll-admin/blob/master/.github/CONTRIBUTING.md). Your feedback and contributions are greatly appreciated.
Happy (graphical) Jekylling!

View File

@ -673,6 +673,12 @@ h5 > code,
overflow: auto; overflow: auto;
} }
.highlighter-rouge .highlight {
@extend .highlight;
margin: 0;
padding: 10px 0.5em;
}
/* HTML Elements */ /* HTML Elements */
h1, h2, h3, h4, h5, h6 { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; }

View File

@ -45,7 +45,7 @@ overview: true
<p class="line"> <p class="line">
<span class="path">~</span> <span class="path">~</span>
<span class="prompt">$</span> <span class="prompt">$</span>
<span class="command">gem install jekyll</span> <span class="command">gem install jekyll bundler</span>
</p> </p>
<p class="line"> <p class="line">
<span class="path">~</span> <span class="path">~</span>

View File

@ -0,0 +1,3 @@
.sample {
color: red;
}

View File

@ -0,0 +1,3 @@
---
---
alert "From your theme."

View File

@ -0,0 +1 @@
logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,3 @@
---
---
@import "test-theme-{{ site.theme-color | default: "red" }}";

View File

@ -120,12 +120,9 @@ class JekyllUnitTest < Minitest::Test
"destination" => dest_dir, "destination" => dest_dir,
"incremental" => false "incremental" => false
})) }))
build_configs({ Configuration.from(full_overrides.merge({
"source" => source_dir "source" => source_dir
}, full_overrides) }))
.fix_common_issues
.backwards_compatibilize
.add_default_collections
end end
def clear_dest def clear_dest

View File

@ -0,0 +1,3 @@
---
---
alert "From your site."

7
test/source/info.md Normal file
View File

@ -0,0 +1,7 @@
---
title: Information
---
# Information
Very important information is here

View File

@ -8,23 +8,28 @@ class TestFilters < JekyllUnitTest
attr_accessor :site, :context attr_accessor :site, :context
def initialize(opts = {}) def initialize(opts = {})
@site = Jekyll::Site.new( @site = Jekyll::Site.new(opts.merge("skip_config_files" => true))
Jekyll.configuration(opts.merge("skip_config_files" => true))
)
@context = Liquid::Context.new({}, {}, { :site => @site }) @context = Liquid::Context.new({}, {}, { :site => @site })
end end
end end
def make_filter_mock(opts = {})
JekyllFilter.new(site_configuration(opts)).tap do |f|
tz = f.site.config["timezone"]
Jekyll.set_timezone(tz) if tz
end
end
class SelectDummy class SelectDummy
def select; end def select; end
end end
context "filters" do context "filters" do
setup do setup do
@filter = JekyllFilter.new({ @filter = make_filter_mock({
"source" => source_dir, "timezone" => "UTC",
"destination" => dest_dir, "url" => "http://example.com",
"timezone" => "UTC" "baseurl" => "/base"
}) })
@sample_time = Time.utc(2013, 3, 27, 11, 22, 33) @sample_time = Time.utc(2013, 3, 27, 11, 22, 33)
@sample_date = Date.parse("2013-03-27") @sample_date = Date.parse("2013-03-27")
@ -65,7 +70,7 @@ class TestFilters < JekyllUnitTest
end end
should "escapes special characters when configured to do so" do should "escapes special characters when configured to do so" do
kramdown = JekyllFilter.new({ :kramdown => { :entity_output => :symbolic } }) kramdown = make_filter_mock({ :kramdown => { :entity_output => :symbolic } })
assert_equal( assert_equal(
"&ldquo;This filter&rsquo;s test&hellip;&rdquo;", "&ldquo;This filter&rsquo;s test&hellip;&rdquo;",
kramdown.smartify(%q{"This filter's test..."}) kramdown.smartify(%q{"This filter's test..."})
@ -307,6 +312,99 @@ class TestFilters < JekyllUnitTest
assert_equal "my%20things", @filter.uri_escape("my things") assert_equal "my%20things", @filter.uri_escape("my things")
end end
context "absolute_url filter" do
should "produce an absolute URL from a page URL" do
page_url = "/about/my_favorite_page/"
assert_equal "http://example.com/base#{page_url}", @filter.absolute_url(page_url)
end
should "ensure the leading slash" do
page_url = "about/my_favorite_page/"
assert_equal "http://example.com/base/#{page_url}", @filter.absolute_url(page_url)
end
should "ensure the leading slash for the baseurl" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({
"url" => "http://example.com",
"baseurl" => "base"
})
assert_equal "http://example.com/base/#{page_url}", filter.absolute_url(page_url)
end
should "be ok with a blank but present 'url'" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({
"url" => "",
"baseurl" => "base"
})
assert_equal "/base/#{page_url}", filter.absolute_url(page_url)
end
should "be ok with a nil 'url'" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({
"url" => nil,
"baseurl" => "base"
})
assert_equal "/base/#{page_url}", filter.absolute_url(page_url)
end
should "be ok with a nil 'baseurl'" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({
"url" => "http://example.com",
"baseurl" => nil
})
assert_equal "http://example.com/#{page_url}", filter.absolute_url(page_url)
end
should "not prepend a forward slash if input is empty" do
page_url = ""
filter = make_filter_mock({
"url" => "http://example.com",
"baseurl" => "/base"
})
assert_equal "http://example.com/base", filter.absolute_url(page_url)
end
end
context "relative_url filter" do
should "produce a relative URL from a page URL" do
page_url = "/about/my_favorite_page/"
assert_equal "/base#{page_url}", @filter.relative_url(page_url)
end
should "ensure the leading slash between baseurl and input" do
page_url = "about/my_favorite_page/"
assert_equal "/base/#{page_url}", @filter.relative_url(page_url)
end
should "ensure the leading slash for the baseurl" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({ "baseurl" => "base" })
assert_equal "/base/#{page_url}", filter.relative_url(page_url)
end
should "be ok with a nil 'baseurl'" do
page_url = "about/my_favorite_page/"
filter = make_filter_mock({
"url" => "http://example.com",
"baseurl" => nil
})
assert_equal "/#{page_url}", filter.relative_url(page_url)
end
should "not prepend a forward slash if input is empty" do
page_url = ""
filter = make_filter_mock({
"url" => "http://example.com",
"baseurl" => "/base"
})
assert_equal "/base", filter.relative_url(page_url)
end
end
context "jsonify filter" do context "jsonify filter" do
should "convert hash to json" do should "convert hash to json" do
assert_equal "{\"age\":18}", @filter.jsonify({ :age => 18 }) assert_equal "{\"age\":18}", @filter.jsonify({ :age => 18 })
@ -475,7 +573,7 @@ class TestFilters < JekyllUnitTest
g["items"].is_a?(Array), g["items"].is_a?(Array),
"The list of grouped items for '' is not an Array." "The list of grouped items for '' is not an Array."
) )
assert_equal 13, g["items"].size assert_equal 15, g["items"].size
end end
end end
end end

View File

@ -40,9 +40,12 @@ class TestNewCommand < JekyllUnitTest
should "display a success message" do should "display a success message" do
Jekyll::Commands::New.process(@args) Jekyll::Commands::New.process(@args)
output = Jekyll.logger.messages.last output = Jekyll.logger.messages[-3]
output_last = Jekyll.logger.messages.last
success_message = "New jekyll site installed in #{@full_path.cyan}." success_message = "New jekyll site installed in #{@full_path.cyan}."
bundle_message = "Running bundle install in #{@full_path.cyan}..."
assert_includes output, success_message assert_includes output, success_message
assert_includes output_last, bundle_message
end end
should "copy the static files in site template to the new directory" do should "copy the static files in site template to the new directory" do
@ -85,7 +88,10 @@ class TestNewCommand < JekyllUnitTest
should "create blank project" do should "create blank project" do
blank_contents = %w(/_drafts /_layouts /_posts /index.html) blank_contents = %w(/_drafts /_layouts /_posts /index.html)
capture_stdout { Jekyll::Commands::New.process(@args, "--blank") } capture_stdout { Jekyll::Commands::New.process(@args, "--blank") }
output = Jekyll.logger.messages.last
bundle_message = "Running bundle install in #{@full_path.cyan}..."
assert_same_elements blank_contents, dir_contents(@full_path) assert_same_elements blank_contents, dir_contents(@full_path)
refute_includes output, bundle_message
end end
should "force created folder" do should "force created folder" do
@ -93,6 +99,13 @@ class TestNewCommand < JekyllUnitTest
output = capture_stdout { Jekyll::Commands::New.process(@args, "--force") } output = capture_stdout { Jekyll::Commands::New.process(@args, "--force") }
assert_match(%r!New jekyll site installed in!, output) assert_match(%r!New jekyll site installed in!, output)
end end
should "skip bundle install when opted to" do
capture_stdout { Jekyll::Commands::New.process(@args, "--skip-bundle") }
output = Jekyll.logger.messages.last
bundle_message = "Bundle install skipped."
assert_includes output, bundle_message
end
end end
context "when multiple args are given" do context "when multiple args are given" do

View File

@ -13,8 +13,8 @@ class TestRelatedPosts < JekyllUnitTest
last_post = @site.posts.last last_post = @site.posts.last
related_posts = Jekyll::RelatedPosts.new(last_post).build related_posts = Jekyll::RelatedPosts.new(last_post).build
last_10_recent_posts = (@site.posts.docs.reverse - [last_post]).first(10) last_ten_recent_posts = (@site.posts.docs.reverse - [last_post]).first(10)
assert_equal last_10_recent_posts, related_posts assert_equal last_ten_recent_posts, related_posts
end end
end end

View File

@ -180,6 +180,7 @@ class TestSite < JekyllUnitTest
%#\ +.md %#\ +.md
.htaccess .htaccess
about.html about.html
application.coffee
bar.html bar.html
coffeescript.coffee coffeescript.coffee
contacts.html contacts.html
@ -191,6 +192,7 @@ class TestSite < JekyllUnitTest
humans.txt humans.txt
index.html index.html
index.html index.html
info.md
main.scss main.scss
main.scss main.scss
properties.html properties.html
@ -489,6 +491,34 @@ class TestSite < JekyllUnitTest
end end
end end
context "when setting theme" do
should "set no theme if config is not set" do
expect($stderr).not_to receive(:puts)
expect($stdout).not_to receive(:puts)
site = fixture_site({ "theme" => nil })
assert_nil site.theme
end
should "set no theme if config is a hash" do
output = capture_output do
site = fixture_site({ "theme" => {} })
assert_nil site.theme
end
expected_msg = "Theme: value of 'theme' in config should be String " \
"to use gem-based themes, but got Hash\n"
assert output.end_with?(expected_msg),
"Expected #{output.inspect} to end with #{expected_msg.inspect}"
end
should "set a theme if the config is a string" do
expect($stderr).not_to receive(:puts)
expect($stdout).not_to receive(:puts)
site = fixture_site({ "theme" => "test-theme" })
assert_instance_of Jekyll::Theme, site.theme
assert_equal "test-theme", site.theme.name
end
end
context "with liquid profiling" do context "with liquid profiling" do
setup do setup do
@site = Site.new(site_configuration("profile" => true)) @site = Site.new(site_configuration("profile" => true))

View File

@ -12,6 +12,7 @@ class TestTags < JekyllUnitTest
site.posts.docs.concat(PostReader.new(site).read_posts("")) if override["read_posts"] site.posts.docs.concat(PostReader.new(site).read_posts("")) if override["read_posts"]
CollectionReader.new(site).read if override["read_collections"] CollectionReader.new(site).read if override["read_collections"]
site.read if override["read_all"]
info = { :filters => [Jekyll::Filters], :registers => { :site => site } } info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
@converter = site.converters.find { |c| c.class == converter_class } @converter = site.converters.find { |c| c.class == converter_class }
@ -58,6 +59,7 @@ CONTENT
assert_match r, "xml+cheetah" assert_match r, "xml+cheetah"
assert_match r, "x.y" assert_match r, "x.y"
assert_match r, "coffee-script" assert_match r, "coffee-script"
assert_match r, "shell_session"
refute_match r, "blah^" refute_match r, "blah^"
@ -627,6 +629,41 @@ CONTENT
end end
end end
context "simple page with linking to a page" do
setup do
content = <<CONTENT
---
title: linking
---
{% link contacts.html %}
{% link info.md %}
{% link /css/screen.css %}
CONTENT
create_post(content, {
"source" => source_dir,
"destination" => dest_dir,
"read_all" => true
})
end
should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
end
should "have the URL to the \"contacts\" item" do
assert_match(%r!/contacts\.html!, @result)
end
should "have the URL to the \"info\" item" do
assert_match(%r!/info\.html!, @result)
end
should "have the URL to the \"screen.css\" item" do
assert_match(%r!/css/screen\.css!, @result)
end
end
context "simple page with linking" do context "simple page with linking" do
setup do setup do
content = <<CONTENT content = <<CONTENT

View File

@ -34,16 +34,16 @@ class TestTheme < JekyllUnitTest
end end
context "path generation" do context "path generation" do
[:layouts, :includes, :sass].each do |folder| [:assets, :_layouts, :_includes, :_sass].each do |folder|
should "know the #{folder} path" do should "know the #{folder} path" do
expected = File.expand_path("_#{folder}", @expected_root) expected = File.expand_path(folder.to_s, @expected_root)
assert_equal expected, @theme.public_send("#{folder}_path") assert_equal expected, @theme.public_send("#{folder.to_s.tr("_", "")}_path")
end end
end end
should "generate folder paths" do should "generate folder paths" do
expected = File.expand_path("./_sass", @expected_root) expected = File.expand_path("./_sass", @expected_root)
assert_equal expected, @theme.send(:path_for, :sass) assert_equal expected, @theme.send(:path_for, :_sass)
end end
should "not allow paths outside of the theme root" do should "not allow paths outside of the theme root" do
@ -56,7 +56,7 @@ class TestTheme < JekyllUnitTest
should "return the resolved path when a symlink & resolved path exists" do should "return the resolved path when a symlink & resolved path exists" do
expected = File.expand_path("./_layouts", @expected_root) expected = File.expand_path("./_layouts", @expected_root)
assert_equal expected, @theme.send(:path_for, :symlink) assert_equal expected, @theme.send(:path_for, :_symlink)
end end
end end

View File

@ -0,0 +1,71 @@
require "helper"
class TestThemeAssetsReader < JekyllUnitTest
def setup
@site = fixture_site(
"theme" => "test-theme",
"theme-color" => "black"
)
assert @site.theme
end
def assert_file_with_relative_path(haystack, relative_path)
assert haystack.any? { |f|
f.relative_path == relative_path
}, "Site should read in the #{relative_path} file, " \
"but it was not found in #{haystack.inspect}"
end
def refute_file_with_relative_path(haystack, relative_path)
refute haystack.any? { |f|
f.relative_path == relative_path
}, "Site should not have read in the #{relative_path} file, " \
"but it was found in #{haystack.inspect}"
end
context "with a valid theme" do
should "read all assets" do
@site.reset
ThemeAssetsReader.new(@site).read
assert_file_with_relative_path @site.static_files, "assets/img/logo.png"
assert_file_with_relative_path @site.pages, "assets/style.scss"
end
should "convert pages" do
@site.process
file = @site.pages.find { |f| f.relative_path == "assets/style.scss" }
refute_nil file
assert_equal @site.in_dest_dir("assets/style.css"), file.destination(@site.dest)
assert_includes file.output, ".sample {\n color: black; }"
end
should "not overwrite site content with the same relative path" do
@site.reset
@site.read
file = @site.pages.find { |f| f.relative_path == "assets/application.coffee" }
refute_nil file
assert_includes file.content, "alert \"From your site.\""
end
end
context "with a valid theme without an assets dir" do
should "not read any assets" do
site = fixture_site("theme" => "test-theme")
allow(site.theme).to receive(:assets_path).and_return(nil)
ThemeAssetsReader.new(site).read
refute_file_with_relative_path site.static_files, "assets/img/logo.png"
refute_file_with_relative_path site.pages, "assets/style.scss"
end
end
context "with no theme" do
should "not read any assets" do
site = fixture_site("theme" => nil)
ThemeAssetsReader.new(site).read
refute_file_with_relative_path site.static_files, "assets/img/logo.png"
refute_file_with_relative_path site.pages, "assets/style.scss"
end
end
end

View File

@ -198,6 +198,13 @@ class TestUtils < JekyllUnitTest
) )
end end
should "replace everything else but ASCII characters" do
assert_equal "the-config-yml-file",
Utils.slugify("The _config.yml file?", :mode => "ascii")
assert_equal "f-rtive-glance",
Utils.slugify("fürtive glance!!!!", :mode => "ascii")
end
should "only replace whitespace if mode is raw" do should "only replace whitespace if mode is raw" do
assert_equal( assert_equal(
"the-_config.yml-file?", "the-_config.yml-file?",