Add deprecation support for pages in subfolders with relative permalinks.

This commit is contained in:
Parker Moore 2013-05-11 17:40:00 +02:00
parent d675ef6662
commit e22b1bb74a
3 changed files with 19 additions and 1 deletions

View File

@ -19,7 +19,10 @@ module Jekyll
'limit_posts' => 0,
'lsi' => false,
'future' => true, # remove and make true just default
'pygments' => true, # remove and make true just default
'pygments' => true,
'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 1.1 hits
'markdown' => 'maruku',
'permalink' => 'date',

View File

@ -144,5 +144,9 @@ module Jekyll
def index?
basename == 'index'
end
def uses_relative_permalinks
permalink && !permalink.include?(File.expand_path(@dir, site.source))
end
end
end

View File

@ -231,6 +231,7 @@ module Jekyll
end
self.pages.each do |page|
relative_permalinks_deprecation_method if page.uses_relative_permalinks
page.render(self.layouts, payload)
end
@ -418,5 +419,15 @@ module Jekyll
post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post }
end
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && !@deprecated_relative_permalinks
Jekyll::Logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
" in subfolders must be absolute" +
" permalinks relative to the site" +
" source."
@deprecated_relative_permalinks = true
end
end
end
end