Merge branch 'master' into build-the-site

* master:
  Update history to reflect merge of #5152 [ci skip]
  Missing trailing |
  Update history to reflect merge of #5158 [ci skip]
  Also include LICENSE and README
  note that themes have been released
  Update history to reflect merge of #5143 [ci skip]
  Update history to reflect merge of #5150 [ci skip]
  Revert "Readability: lib/jekyll/static_file.rb."
  include theme directories in default gemspec
  [site] enable excerpts
  Centre align text and use nav styles on helpful links.
  Puns FTW
  Add helpful links and minor alignment tweak.
  Create error template that has no main nav or footer.
  Use more generic wording.
  sitemap: false so that the error page is not indexed
  Initial 404 page
This commit is contained in:
Parker Moore 2016-08-01 17:28:05 -07:00
commit dc8c6e0e43
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
7 changed files with 106 additions and 57 deletions

View File

@ -1,3 +1,15 @@
## HEAD
### Site Enhancements
* Enable site excerpts (#5150)
* Initial 404 page (#5143)
* Remove the "this feature is unreleased" warning from the theme docs (#5158)
### Bug Fixes
* Include theme directories in default gemspec (#5152)
## 3.2.0 / 2016-07-26 ## 3.2.0 / 2016-07-26
### Minor Enhancements ### Minor Enhancements

View File

@ -3,9 +3,7 @@ module Jekyll
attr_reader :relative_path, :extname attr_reader :relative_path, :extname
class << self class << self
# # The cache of last modification times [path] -> mtime.
# The cache of last modification times
# [path] -> mtime.
def mtimes def mtimes
@mtimes ||= {} @mtimes ||= {}
end end
@ -31,29 +29,25 @@ module Jekyll
@relative_path = File.join(*[@dir, @name].compact) @relative_path = File.join(*[@dir, @name].compact)
@extname = File.extname(@name) @extname = File.extname(@name)
end end
# rubocop: enable ParameterLists # rubocop: enable ParameterLists
# Returns source file path. # Returns source file path.
def path def path
File.join( File.join(*[@base, @dir, @name].compact)
*[@base, @dir, @name].compact
)
end end
# Obtain destination path. # Obtain destination path.
#
# dest - The String path to the destination dir. # dest - The String path to the destination dir.
#
# Returns destination file path. # Returns destination file path.
def destination(dest) def destination(dest)
@site.in_dest_dir( @site.in_dest_dir(*[dest, destination_rel_dir, @name].compact)
*[dest, destination_rel_dir, @name].compact
)
end end
def destination_rel_dir def destination_rel_dir
if @collection if @collection
File.dirname( File.dirname(url)
url
)
else else
@dir @dir
end end
@ -69,12 +63,14 @@ module Jekyll
end end
# Is source path modified? # Is source path modified?
#
# Returns true if modified since last write. # Returns true if modified since last write.
def modified? def modified?
self.class.mtimes[path] != mtime self.class.mtimes[path] != mtime
end end
# Whether to write the file to the filesystem # Whether to write the file to the filesystem
#
# Returns true unless the defaults for the destination path from # Returns true unless the defaults for the destination path from
# _config.yml contain `published: false`. # _config.yml contain `published: false`.
def write? def write?
@ -82,18 +78,20 @@ module Jekyll
end end
# Write the static file to the destination directory (if modified). # Write the static file to the destination directory (if modified).
# Returns false if the file was not modified since last time (no-op). #
# dest - The String path to the destination dir. # dest - The String path to the destination dir.
#
# Returns false if the file was not modified since last time (no-op).
def write(dest) def write(dest)
dest_path = destination(dest) dest_path = destination(dest)
if File.exist?(dest_path) && !modified?
return false
end
return false if File.exist?(dest_path) && !modified?
self.class.mtimes[path] = mtime self.class.mtimes[path] = mtime
FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.rm(dest_path) if File.exist?(dest_path) FileUtils.rm(dest_path) if File.exist?(dest_path)
copy_file(dest_path) copy_file(dest_path)
true true
end end
@ -108,12 +106,11 @@ module Jekyll
def placeholders def placeholders
{ {
:collection => @collection.label, :collection => @collection.label,
:path => relative_path[
@collection.relative_directory.size..relative_path.size],
:output_ext => "", :output_ext => "",
:name => "", :name => "",
:title => "", :title => ""
:path => relative_path[
@collection.relative_directory.size..relative_path.size
]
} }
end end
@ -121,16 +118,14 @@ module Jekyll
# the collection's URL template into account. The default URL template can # the collection's URL template into account. The default URL template can
# be overriden in the collection's configuration in _config.yml. # be overriden in the collection's configuration in _config.yml.
def url def url
@url ||= @url ||= if @collection.nil?
if @collection.nil?
relative_path relative_path
else else
::Jekyll::URL.new({ ::Jekyll::URL.new({
:template => @collection.url_template, :template => @collection.url_template,
:placeholders => placeholders :placeholders => placeholders
}) })
end end.to_s.gsub(%r!/$!, "")
.to_s.gsub(%r!/$!, "")
end end
# Returns the type of the collection if present, nil otherwise. # Returns the type of the collection if present, nil otherwise.
@ -141,28 +136,17 @@ module Jekyll
# Returns the front matter defaults defined for the file's URL and/or type # Returns the front matter defaults defined for the file's URL and/or type
# as defined in _config.yml. # as defined in _config.yml.
def defaults def defaults
@defaults ||= @site.frontmatter_defaults.all( @defaults ||= @site.frontmatter_defaults.all url, type
url, type
)
end end
private private
def copy_file(dest_path) def copy_file(dest_path)
if @site.safe || Jekyll.env == "production" if @site.safe || Jekyll.env == "production"
FileUtils.cp( FileUtils.cp(path, dest_path)
path, dest_path
)
else else
FileUtils.copy_entry( FileUtils.copy_entry(path, dest_path)
path, dest_path
)
end end
File.utime(self.class.mtimes[path], self.class.mtimes[path], dest_path)
File.utime(
self.class.mtimes[path],
self.class.mtimes[path],
dest_path
)
end end
end end
end end

View File

@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.homepage = "TODO: Put your gem's website or public repo URL here." spec.homepage = "TODO: Put your gem's website or public repo URL here."
spec.license = "MIT" spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(<%= theme_directories.join("|") %>)/}) } spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(<%= theme_directories.join("|") %>|LICENSE|README)/i}) }
spec.add_development_dependency "jekyll", "~> <%= jekyll_version_with_minor %>" spec.add_development_dependency "jekyll", "~> <%= jekyll_version_with_minor %>"
spec.add_development_dependency "bundler", "~> 1.12" spec.add_development_dependency "bundler", "~> 1.12"

40
site/404.html Normal file
View File

@ -0,0 +1,40 @@
---
layout: error
permalink: /404.html
sitemap: false
---
<section class="intro">
<div class="grid">
<div class="unit whole align-center">
<p class="first">Huh. It seems that page is<br/>Hyde-ing...</p>
</div>
</div>
</section>
<section class="error">
<div class="grid">
<div class="unit whole align-center">
<p>The resource you requested was not found. Here are some links to help you find your way:</p>
<nav class="main-nav">
<ul>
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/docs/home/">Documentation</a>
</li>
<li>
<a href="/news/">News</a>
</li>
<li>
<a href="/community/">Community</a>
</li>
<li>
<a href="/help/">Help</a>
</li>
</ul>
</nav>
</div>
</div>
</section>

View File

@ -1,7 +1,6 @@
markdown: kramdown markdown: kramdown
highlighter: rouge highlighter: rouge
permalink: /news/:year/:month/:day/:title/ permalink: /news/:year/:month/:day/:title/
excerpt_separator: ""
gauges_id: 503c5af6613f5d0f19000027 gauges_id: 503c5af6613f5d0f19000027
google_analytics_id: UA-50755011-1 google_analytics_id: UA-50755011-1

View File

@ -4,15 +4,6 @@ title: Themes
permalink: /docs/themes/ permalink: /docs/themes/
--- ---
<div class="note unreleased">
<h5>This feature is unreleased!</h5>
<p>
Jekyll 3.0 and 3.1 do NOT have the ability to add themes in this way.
The documentation below is for an unreleased version of Jekyll and
cannot be used at the moment.
</p>
</div>
Jekyll has an extensive theme system, which allows you to leverage community-maintained templates and styles to customize your site's presentation. Jekyll themes package layouts, includes, and stylesheets in a way that can be overridden by your site's content. Jekyll has an extensive theme system, which allows you to leverage community-maintained templates and styles to customize your site's presentation. Jekyll themes package layouts, includes, and stylesheets in a way that can be overridden by your site's content.
## Installing a theme ## Installing a theme

23
site/_layouts/error.html Normal file
View File

@ -0,0 +1,23 @@
{% include top.html %}
<body class="wrap">
<header>
<div class="grid">
<div class="unit whole align-center">
<h1>
<a href="/">
<span class="sr-only">Jekyll</span>
<img src="/img/logo-2x.png" width="249" height="115" alt="Jekyll Logo">
</a>
</h1>
</div>
</div>
</header>
{{ content }}
{% include anchor_links.html %}
{% include analytics.html %}
</body>
</html>