Merge pull request #3383 from jekyll/respect-the-title
This commit is contained in:
commit
a2b19c1d2b
|
@ -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
|
||||
|
||||
|
|
|
@ -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 Post’s filename</p>
|
||||
<p>
|
||||
Title from the document’s filename. May be overridden via the
|
||||
document’s <code>slug</code> YAML front matter.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: So what is Jekyll, exactly?
|
||||
slug: so-what-is-jekyll-exactly
|
||||
layout: slide
|
||||
---
|
||||
|
||||
|
|
|
@ -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 project’s page, blog, or website from GitHub’s servers **for
|
||||
free**.
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue