Skip to content

Commit

Permalink
Open relref link in a new tab (#35)
Browse files Browse the repository at this point in the history
Add a new shortcode that opens relative links to another page.

Signed-off-by: Trifonova Antonia <[email protected]>
  • Loading branch information
antoniyatrifonova authored Jul 12, 2022
1 parent 1e54a0b commit 05aa645
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web/site/layouts/shortcodes/relrefn.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ $ref := index .Params 0 }}
{{ $page := .Page.GetPage $ref }}
{{- "" -}}<a href="{{$page.RelPermalink}}" target="_blank">{{if eq .Page.File.Ext "md"}}{{.Inner|markdownify}}{{else}}{{.Inner|htmlUnescape|safeHTML}}{{end}}</a>{{- "" -}}

0 comments on commit 05aa645

Please sign in to comment.