RMarkdown html _site.yml navbar href link, open in new tab with target="_blank"


Kevin Magnum

Struggling with the R Markdown HTML _site.yml page. In my nav bar I have hrefs pointing to different website links but I don't know where to add them

target="_blank"

statement to open the link in a new tab. Href links do not follow the normal html format in the RMarkdowns _site.yml file.

    - text: "TWITTER"
      icon: fa-twitter
      href: https://twitter.com
    - text: "GITHUB"
      icon: fa-github
      href: https://github.com
    - text: "SLACK"
      icon: fa-slack
      href: https://slack.com
Eric

You can create a redirect page for everyone like this:

    - text: "TWITTER"
  icon: fa-twitter
  href: twitter_redirect.html

Then for twitter_redirect.html (etc), use window.open, then window.history.back.

<!DOCTYPE html>

<html>
<head>
</head>
<body onload="myFunction()">

  <script>
    function myFunction() {
    window.open('https://twitter.com/', '_blank');
    window.history.back();
    }
  </script>
</body>

Related


How to open link in new tab if link has target=_blank?

Say I try to open the link in a new tab only if the link has target=_blanksomething similar . <a href="https://google.com" target="_blank">Google</a> For some reason target=_blankit doesn't work in the Bootstrap 4.5 navbar So I'm trying to use jQuery to make

Use target="_blank" to open link in new tab with github markdown

Peel: Is there a way to make links written in githubs markdown open in new tabs? All the posts I've found related to this suggest using HTML and target="_blank", which works fine for me, but it doesn't work. For example, this link: <a href="http://stackoverflo

Use target="_blank" to open link in new tab with github markdown

the Is there a way to make links written in githubs markdown open in new tabs? All the posts I've found related to this suggest using HTML and target="_blank", which works fine for me, but doesn't work. For example, this link: <a href="http://stackoverflow.com

Use target="_blank" to open link in new tab with github markdown

Peel: Is there a way to make links written in githubs markdown open in new tabs? All the posts I've found related to this suggest using HTML and target="_blank", which works fine for me, but it doesn't work. For example, this link: <a href="http://stackoverflo

Use target="_blank" to open link in new tab with github markdown

Peel: Is there a way to make links written in githubs markdown open in new tabs? All the posts I've found related to this suggest using HTML and target="_blank", which works fine for me, but it doesn't work. For example, this link: <a href="http://stackoverflo

setAttribute target _blank does not open in new tab

conservatism var a = document.createElement('a'); a.setAttribute('target','_blank'); a.click(); The above code doesn't work for me. Doesn't work setAttributeif a click event occurs JavaScript? Quentin Anchor elements without an href attribute don't link anywh

target="_blank" does not open a new tab

airline I created this code so that when clicked, this ImageButton will redirect the PDF to a new tab/new window. Unfortunately it doesn't work. When I click the ImageButton it passes to the current tab/window. please help. <asp:ImageButton ID="ImageButton14"

target="_blank" does not open a new tab

airline I created this code so that when clicked, this ImageButton will redirect the PDF to a new tab/new window. Unfortunately it doesn't work. When I click the ImageButton it passes to the current tab/window. please help. <asp:ImageButton ID="ImageButton14"