Hello,
I am new to Jekyll and need some help with an image link issue.
I want to use an image as a link in a post or page, when clicked on to bring the viewer to another website in a new window.
Can anybody advise how this is done?
Thanks
Hello,
I am new to Jekyll and need some help with an image link issue.
I want to use an image as a link in a post or page, when clicked on to bring the viewer to another website in a new window.
Can anybody advise how this is done?
Thanks
You can try this: https://jekyllcodex.org/without-plugin/new-window-fix/
You probably use Kramdown already (it’s the default parser for Jekyll but you can override in your config)
Which means you can use some Kramdown syntax on your Jekyll site - no plugins needed.
[Text](https://example.com){:target="_blank"}
I tested it locally on my Jekyll site and it works create.
It got compiled to HTML:
<p><a href="https://example.com" target="_blank">Text</a></p>
Based on answer https://stackoverflow.com/a/4705645
You just have to use that on each link that must be external. The includes solution in the previous answer uses JS to rewrite your external links. Which is also fine can be inserted in your head
tag of your default.html
so you can use it anywhere. It just depends on JS being enabled and working on the user’s browser.
Here is my Gemfile.
gem "jekyll", "~> 3.9"
gem "kramdown-parser-gfm", "~> 1.1.0"
On Jekyll 3.9 - the site will not serve unless you explicitly install this kramdown gem. For Jekyll <3.9 and for >=4, it is implied as subdependency so can be omitted from your Gemfile.