Skip to content

Commit

Permalink
a few style changes and readme for pretty permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Mar 10, 2009
1 parent fa1043c commit 86e72a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
26 changes: 22 additions & 4 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,40 @@ And if you don't want to be in the proto site root to run Jekyll:

h2. Run Options

h3. Autobuild

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:

$ jekyll --auto

h3. Related Posts

By default, the "related posts" functionality will produce crappy results.
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):

$ jekyll --lsi

h3. Code Highlighting

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
during the conversion:

$ jekyll --pygments

h3. Markdown Processor

By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for
Markdown support. If you'd like to use RDiscount (faster, but requires
compilation), you must install it (gem install rdiscount) and then you can
have it used instead:

$ jekyll --rdiscount


h3. Local Server

When previewing complex sites locally, simply opening the site in a web
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
Expand All @@ -145,16 +155,24 @@ Default port is 4000:

$ jekyll --server [PORT]

h3. Permalink Style

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
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
'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.
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

Expand Down
9 changes: 4 additions & 5 deletions lib/jekyll/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def dir
permalink.to_s.split("/")[0..-2].join("/") + '/'
else
prefix = self.categories.empty? ? '' : '/' + self.categories.join('/')
if Jekyll.permalink_style == :date ||
Jekyll.permalink_style == :pretty
if [:date, :pretty].include?(Jekyll.permalink_style)
prefix + date.strftime("/%Y/%m/%d/")
else
prefix + '/'
Expand All @@ -106,8 +105,8 @@ def permalink
#
# Returns <String>
def url
permalink || self.id +
( ".html" unless Jekyll.permalink_style == :pretty ).to_s
ext = Jekyll.permalink_style == :pretty ? '' : '.html'
permalink || self.id + ext
end

# The UID for this post (useful in feeds)
Expand All @@ -117,7 +116,7 @@ def url
def id
self.dir + self.slug
end

# Calculate related posts.
#
# Returns [<Post>]
Expand Down

0 comments on commit 86e72a8

Please sign in to comment.