-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Try the following method.
In your pages.yml:
in pages:... section, compose link title as actual title|href (I found handy to mark external links with 🗗 Unicode character), for example - 'Google 🗗|http://www.google.com/': 'index.md'
(just pretend it's local file, it only must be existing md)
in extra_javascript:... section, declare file with following code:
var anchors = Array.from(document.getElementsByClassName("navbar-collapse")[0].getElementsByTagName("a"));
anchors.forEach(function(anchor) {
var sep = anchor.innerText.indexOf("|");
if (sep != -1) {
anchor.href = anchor.innerText.substring(sep + 1, anchor.innerText.length);
anchor.innerText = anchor.innerText.substring(0,sep);
}
if (anchor.innerText.indexOf("\uD83D\uDDD7") != -1) { // 🗗 = "new window" char, see http://www.fileformat.info/info/unicode/char/1f5d7/index.htm
anchor.target = "_blank";
}
}); Metadata
Metadata
Assignees
Labels
No labels