a few style changes and readme for pretty permalink

This commit is contained in:
Tom Preston-Werner 2009-03-10 16:30:14 -07:00
parent fa1043ca69
commit 86e72a8b25
2 changed files with 26 additions and 9 deletions

View File

@ -113,30 +113,40 @@ And if you don't want to be in the proto site root to run Jekyll:
h2. Run Options h2. Run Options
h3. Autobuild
There is an autobuild feature that will regenerate your site if any of the There is an autobuild feature that will regenerate your site if any of the
files change. The autobuild feature can be used on any of the invocations: files change. The autobuild feature can be used on any of the invocations:
$ jekyll --auto $ jekyll --auto
h3. Related Posts
By default, the "related posts" functionality will produce crappy results. By default, the "related posts" functionality will produce crappy results.
In order to get high quality results with a true LSI algorithm, you must In order to get high quality results with a true LSI algorithm, you must
enable it (it may take some time to run if you have many posts): enable it (it may take some time to run if you have many posts):
$ jekyll --lsi $ jekyll --lsi
h3. Code Highlighting
For static code highlighting, you can install Pygments (see below) and then For static code highlighting, you can install Pygments (see below) and then
use that to make your code blocks look pretty. To activate Pygments support use that to make your code blocks look pretty. To activate Pygments support
during the conversion: during the conversion:
$ jekyll --pygments $ jekyll --pygments
h3. Markdown Processor
By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for
Markdown support. If you'd like to use RDiscount (faster, but requires Markdown support. If you'd like to use RDiscount (faster, but requires
compilation), you must install it (gem install rdiscount) and then you can compilation), you must install it (gem install rdiscount) and then you can
have it used instead: have it used instead:
$ jekyll --rdiscount $ jekyll --rdiscount
h3. Local Server
When previewing complex sites locally, simply opening the site in a web When previewing complex sites locally, simply opening the site in a web
browser (using file://) can cause problems with links that are relative to browser (using file://) can cause problems with links that are relative to
the site root (e.g., "/stylesheets/style.css"). To get around this, Jekyll the site root (e.g., "/stylesheets/style.css"). To get around this, Jekyll
@ -145,16 +155,24 @@ Default port is 4000:
$ jekyll --server [PORT] $ jekyll --server [PORT]
h3. Permalink Style
By default, the permalink for each post begins with its date in 'YYYY/MM/DD' By default, the permalink for each post begins with its date in 'YYYY/MM/DD'
format. If you do not wish to have the date appear in the URL of each post, format.
If you do not wish to have the date appear in the URL of each post,
you can change the permalink style to 'none' so that only the 'slug' part of you can change the permalink style to 'none' so that only the 'slug' part of
the filename is used. For example, with the permalink style set to 'none' the the filename is used. For example, with the permalink style set to 'none' the
file '2009-01-01-happy-new-year.markdown' will have a permalink like file '2009-01-01-happy-new-year.markdown' will have a permalink like
'http://yoursite.com/happy-new-year.html'. The date of the post will still be 'http://yoursite.com/happy-new-year.html'. The date of the post will still be
read from the filename (and is required!) to be used elsewhere in Jekyll. read from the filename (and is required!) to be used elsewhere in Jekyll.
Example usage:
$ jekyll --permalink none If you want WordPress-style pretty URLs that leave off the .html, you can
change the permalink style to 'pretty' and directories corresponding to the
date parts and post name will be made and an index.html will be placed in the
leaf directory resulting in URLs like 2008/11/17/blogging-like-a-hacker/.
$ jekyll --permalink [date|none|pretty]
h2. Data h2. Data

View File

@ -83,8 +83,7 @@ module Jekyll
permalink.to_s.split("/")[0..-2].join("/") + '/' permalink.to_s.split("/")[0..-2].join("/") + '/'
else else
prefix = self.categories.empty? ? '' : '/' + self.categories.join('/') prefix = self.categories.empty? ? '' : '/' + self.categories.join('/')
if Jekyll.permalink_style == :date || if [:date, :pretty].include?(Jekyll.permalink_style)
Jekyll.permalink_style == :pretty
prefix + date.strftime("/%Y/%m/%d/") prefix + date.strftime("/%Y/%m/%d/")
else else
prefix + '/' prefix + '/'
@ -106,8 +105,8 @@ module Jekyll
# #
# Returns <String> # Returns <String>
def url def url
permalink || self.id + ext = Jekyll.permalink_style == :pretty ? '' : '.html'
( ".html" unless Jekyll.permalink_style == :pretty ).to_s permalink || self.id + ext
end end
# The UID for this post (useful in feeds) # The UID for this post (useful in feeds)
@ -117,7 +116,7 @@ module Jekyll
def id def id
self.dir + self.slug self.dir + self.slug
end end
# Calculate related posts. # Calculate related posts.
# #
# Returns [<Post>] # Returns [<Post>]