Navigation Menu

Skip to content

Commit

Permalink
staticref shortcode: Add "newtab" option to open link in new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
gcushen committed Oct 7, 2017
1 parent 7f9b8ac commit 143576b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion exampleSite/content/post/writing-markdown-latex.md
Expand Up @@ -60,7 +60,9 @@ A numbered figure with caption:

To enable linking to a file, such as a PDF, first place the file in your `static/files/` folder and then link to it using the following form:

{{%/* staticref "files/cv.pdf" */%}}Download my CV{{%/* /staticref */%}}
{{%/* staticref "files/cv.pdf" "newtab" */%}}Download my CV{{%/* /staticref */%}}

The optional `"newtab"` argument for `staticref` will cause the link to be opened in a new tab.

## Emojis

Expand Down
4 changes: 3 additions & 1 deletion layouts/shortcodes/staticref.html
@@ -1 +1,3 @@
<a href="{{ .Page.Site.BaseURL }}{{ .Get 0 }}"/>{{ .Inner }}</a>
<a href="{{ .Get 0 | absURL }}"{{ if len .Params | eq 2 }} target="_blank"{{ end }}>
{{ .Inner }}
</a>

0 comments on commit 143576b

Please sign in to comment.