diff --git a/lib/jekyll/tags/link.rb b/lib/jekyll/tags/link.rb index 6ffd4726..a076c417 100644 --- a/lib/jekyll/tags/link.rb +++ b/lib/jekyll/tags/link.rb @@ -16,8 +16,10 @@ module Jekyll def render(context) site = context.registers[:site] - site.docs_to_write.each do |document| - return document.url if document.relative_path == @relative_path + site.each_site_file do |item| + return item.url if item.relative_path == @relative_path + # This takes care of the case for static files that have a leading / + return item.url if item.relative_path == "/#{@relative_path}" end raise ArgumentError, < [Jekyll::Filters], :registers => { :site => site } } @converter = site.converters.find { |c| c.class == converter_class } @@ -627,6 +628,41 @@ CONTENT end end + context "simple page with linking to a page" do + setup do + content = < source_dir, + "destination" => dest_dir, + "read_all" => true + }) + end + + should "not cause an error" do + refute_match(%r!markdown\-html\-error!, @result) + end + + should "have the URL to the \"contacts\" item" do + assert_match(%r!/contacts\.html!, @result) + end + + should "have the URL to the \"info\" item" do + assert_match(%r!/info\.html!, @result) + end + + should "have the URL to the \"screen.css\" item" do + assert_match(%r!/css/screen\.css!, @result) + end + end + context "simple page with linking" do setup do content = <