Skip to content

add link to docs#47

Description

@waigani

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 &#x1F5D7|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";
	}
}); 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions