Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Open link in content in new window

Started by Muut Archive 11 years ago · 2 replies · 1978 views
11 years ago

Hi there!

I am new to Grav and I love it!
I cannot however find a way to make links in content of pages open in new window (target="_blank"). Is there a working solution around? How do you set the link to open a new window in markdown?

Thanks in advance!
Best,
Ivan

11 years ago

There is an external_links plugin available.

11 years ago

Alternatively I solved with this piece of JavaScript:

JS

$(document.links).filter(function() {
    return this.hostname != window.location.hostname;
}).attr('target', '_blank');
---

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2288 9 years ago
Archive · by Muut Archive, 9 years ago
2 1500 9 years ago
Archive · by Muut Archive, 9 years ago
2 4753 9 years ago
Archive · by Muut Archive, 9 years ago
1 3569 9 years ago
Archive · by Muut Archive, 9 years ago
3 1626 9 years ago