Skip to content

Commit

Permalink
Remove relative permalinks
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredxing committed Apr 28, 2015
1 parent 786f6e1 commit 9ab3c20
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 49 deletions.
14 changes: 5 additions & 9 deletions lib/jekyll/commands/doctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ def healthy?(site)
end

def deprecated_relative_permalinks(site)
contains_deprecated_pages = false
site.pages.each do |page|
if page.uses_relative_permalinks
Jekyll::Deprecator.deprecation_message "'#{page.path}' uses relative" +
" permalinks which will be deprecated in" +
" Jekyll v2.0.0 and beyond."
contains_deprecated_pages = true
end
if site.config['relative_permalinks']
Jekyll::Deprecator.deprecation_message "Your site still uses relative" +
" permalinks, which was removed in" +
" Jekyll v3.0.0."
return true
end
contains_deprecated_pages
end

def conflicting_urls(site)
Expand Down
3 changes: 0 additions & 3 deletions lib/jekyll/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class Configuration < Hash
'host' => '127.0.0.1',
'baseurl' => '',

# Backwards-compatibility options
'relative_permalinks' => false,

# Output Configuration
'permalink' => 'date',
'paginate_path' => '/page:num',
Expand Down
10 changes: 1 addition & 9 deletions lib/jekyll/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ def dir
# Returns the String permalink or nil if none has been set.
def permalink
return nil if data.nil? || data['permalink'].nil?
if site.config['relative_permalinks']
File.join(@dir, data['permalink'])
else
data['permalink']
end
data['permalink']
end

# The template of the permalink.
Expand Down Expand Up @@ -156,9 +152,5 @@ def html?
def index?
basename == 'index'
end

def uses_relative_permalinks
permalink && !@dir.empty? && site.config['relative_permalinks']
end
end
end
20 changes: 6 additions & 14 deletions lib/jekyll/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ def instantiate_subclasses(klass)
#
# Returns
def relative_permalinks_are_deprecated
if config['relative_permalinks'] && has_relative_page?
Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" +
" in subfolders must be relative to the" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
if config['relative_permalinks']
Jekyll.logger.abort_with "Since v3.0, permalinks for pages" +
" in subfolders must be relative to the" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
end
end

Expand Down Expand Up @@ -370,14 +370,6 @@ def in_dest_dir(*paths)

private

# Checks if the site has any pages containing relative links
#
# Returns a Boolean: true for usage of relateive permalinks, false
# if it doesn't
def has_relative_page?
pages.any? { |page| page.uses_relative_permalinks }
end

# Limits the current posts; removes the posts which exceed the limit_posts
#
# Returns nothing
Expand Down
1 change: 0 additions & 1 deletion site/_config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
markdown: kramdown
highlighter: pygments
relative_permalinks: false
permalink: /news/:year/:month/:day/:title/
excerpt_separator: ""

Expand Down
3 changes: 0 additions & 3 deletions site/_docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,6 @@ port: 4000
host: 127.0.0.1
baseurl: "" # does not include hostname

# Backwards-compatibility
relative_permalinks: false

# Outputting
permalink: date
paginate_path: /page:num
Expand Down
13 changes: 3 additions & 10 deletions site/_docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,12 @@ your site.
In Jekyll v1.0, we introduced absolute permalinks for pages in
subdirectories. Starting with v2.0, absolute permalinks are opt-out,
meaning Jekyll will default to using absolute permalinks instead of
relative permalinks.

* To use absolute permalinks, set `relative_permalinks: false` in your
configuration file.
* To continue using relative permalinks, set `relative_permalinks: true` in
your configuration file.
relative permalinks. Relative permalink backwards-compatibility was removed in v3.0.

<div class="note warning" id="absolute-permalinks-warning">
<h5 markdown="1">Absolute permalinks will be default in v2.0 and on</h5>
<h5 markdown="1">Absolute permalinks will be required in v3.0 and on</h5>
<p markdown="1">
Starting with Jekyll v2.0, `relative_permalinks` will default to `false`,
meaning all pages will be built using the absolute permalink behaviour.
The switch will still exist until v2.0.
Starting with Jekyll v3.0, relative permalinks functionality will be removed and thus unavailable for use.
</p>
</div>

Expand Down

0 comments on commit 9ab3c20

Please sign in to comment.