Merge pull request #3383 from jekyll/respect-the-title

This commit is contained in:
Parker Moore 2015-01-31 00:07:10 -08:00
commit a2b19c1d2b
5 changed files with 30 additions and 7 deletions

View File

@ -132,7 +132,7 @@ module Jekyll
path: cleaned_relative_path,
output_ext: Jekyll::Renderer.new(site, self).output_ext,
name: Utils.slugify(basename_without_ext),
title: Utils.slugify(data['title']) || Utils.slugify(basename_without_ext)
title: Utils.slugify(data['slug']) || Utils.slugify(basename_without_ext)
}
end

View File

@ -78,7 +78,10 @@ permalink is defined as `/:categories/:year/:month/:day/:title.html`.
<p><code>title</code></p>
</td>
<td>
<p>Title from the Posts filename</p>
<p>
Title from the documents filename. May be overridden via the
documents <code>slug</code> YAML front matter.
</p>
</td>
</tr>
<tr>

View File

@ -1,5 +1,5 @@
---
title: So what is Jekyll, exactly?
slug: so-what-is-jekyll-exactly
layout: slide
---

View File

@ -0,0 +1,15 @@
---
slug: Well, so what is Jekyll, then?
layout: slide
---
Jekyll is a simple, blog-aware, static site generator. It takes a template
directory containing raw text files in various formats, runs it through
[Markdown](http://daringfireball.net/projects/markdown/) (or
[Textile](http://redcloth.org/textile)) and
[Liquid](http://wiki.shopify.com/Liquid)
converters, and spits out a complete, ready-to-publish static website suitable
for serving with your favorite web server. Jekyll also happens to be the engine
behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll
to host your projects page, blog, or website from GitHubs servers **for
free**.

View File

@ -249,15 +249,20 @@ class TestDocument < Test::Unit::TestCase
}))
@site.process
@document = @site.collections["slides"].docs[3]
@document_without_title = @site.collections["slides"].docs[4]
@document_without_slug = @site.collections["slides"].docs[4]
@document_with_strange_slug = @site.collections["slides"].docs[5]
end
should "produce the right URL if they have a title" do
should "produce the right URL if they have a slug" do
assert_equal "/slides/so-what-is-jekyll-exactly", @document.url
end
should "produce the right URL if they don't have a title" do
assert_equal "/slides/example-slide-5", @document_without_title.url
should "produce the right URL if they don't have a slug" do
assert_equal "/slides/example-slide-5", @document_without_slug.url
end
should "produce the right URL if they have a wild slug" do
assert_equal "/slides/well-so-what-is-jekyll-then", @document_with_strange_slug.url
end
end