Skip to content

Commit

Permalink
Fix bug that the domain link is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
ysk24ok committed May 18, 2021
1 parent 94597ec commit 976bfe7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jekyll-linkpreview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def gen_default_template(hash)
</div>
</div>
<div class="jekyll-linkpreview-footer">
<a href="#{domain}" target="_blank">#{domain}</a>
<a href="//#{domain}" target="_blank">#{domain}</a>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions spec/jekyll-linkpreview_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def check_default_template_with_image_is_rendered(html)
expect(doc.xpath('//h2[@class="jekyll-linkpreview-title"]/a').inner_text).to eq @title
expect(doc.xpath('//h2[@class="jekyll-linkpreview-title"]/a').attribute('href').value).to eq @url
expect(doc.xpath('//div[@class="jekyll-linkpreview-footer"]/a').inner_text).to eq @domain
expect(doc.xpath('//div[@class="jekyll-linkpreview-footer"]/a').attribute('href').value).to eq "//#{@domain}"
expect(doc.xpath('//div[@class="jekyll-linkpreview-image"]/a/img').attribute('src').value).to eq @image
expect(doc.xpath('//div[@class="jekyll-linkpreview-description"]').inner_text).to eq @description
end
Expand All @@ -553,6 +554,7 @@ def check_default_template_without_image_is_rendered(html)
expect(doc.xpath('//h2[@class="jekyll-linkpreview-title"]/a').inner_text).to eq @title
expect(doc.xpath('//h2[@class="jekyll-linkpreview-title"]/a').attribute('href').value).to eq @url
expect(doc.xpath('//div[@class="jekyll-linkpreview-footer"]/a').inner_text).to eq @domain
expect(doc.xpath('//div[@class="jekyll-linkpreview-footer"]/a').attribute('href').value).to eq "//#{@domain}"
expect(doc.xpath('//div[@class="jekyll-linkpreview-image"]')).to be_empty
expect(doc.xpath('//div[@class="jekyll-linkpreview-description"]').inner_text).to eq @description
end
Expand Down

0 comments on commit 976bfe7

Please sign in to comment.