Fix Page#relative_path so that it consistently does NOT have the prepending slash (previously inconsistent)
Fixes for #4946
This commit is contained in:
		
							parent
							
								
									de39107c76
								
							
						
					
					
						commit
						4fbbeddae2
					
				|  | @ -135,12 +135,12 @@ module Jekyll | |||
|     # | ||||
|     # Returns the path to the source file | ||||
|     def path | ||||
|       data.fetch("path") { relative_path.sub(%r{!\A\/!}, "") } | ||||
|       data.fetch("path") { relative_path } | ||||
|     end | ||||
| 
 | ||||
|     # The path to the page source file, relative to the site source | ||||
|     def relative_path | ||||
|       File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)) | ||||
|       File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r{\A\/}, "") | ||||
|     end | ||||
| 
 | ||||
|     # Obtain destination path. | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ class TestFrontMatterDefaults < JekyllUnitTest | |||
|         }] | ||||
|       })) | ||||
|       @site.process | ||||
|       @affected = @site.pages.find { |page| page.relative_path == "/contacts/bar.html" } | ||||
|       @affected = @site.pages.find { |page| page.relative_path == "contacts/bar.html" } | ||||
|       @not_affected = @site.pages.find { |page| page.relative_path == "about.html" } | ||||
|     end | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue