Skip to content

Commit

Permalink
Implemented target option for the page content type as suggested by #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lednerb committed Nov 28, 2017
1 parent ec54f18 commit e4b23a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions archetypes/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ draft: true

# set the link if you want to redirect the user.
link: ""
# set the html target parameter if you want to change default behavior
target: "_blank"
---
2 changes: 2 additions & 0 deletions exampleSite/content/page/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ date: 2017-11-01T13:17:56+01:00

# set the link if you want to redirect the user.
link: "https://github.com/Lednerb/bilberry-hugo-theme"
# set the html target parameter if you want to change default behavior
target: "_blank"
---
2 changes: 1 addition & 1 deletion layouts/partials/topnav.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ul class="topnav">
{{ range where (where .Site.Pages ".Type" "page") ".IsPage" true }}
{{ if and (isset .Params "link") (ne .Params.link "") }}
<li><a href="{{ .Params.link | relURL }}">{{ .Title }}</a></li>
<li><a href="{{ .Params.link | relURL }}" target="{{ .Params.target }}">{{ .Title }}</a></li>
{{ else }}
<li><a href="{{ .URL }}">{{ .Title }}</a></li>
{{ end }}
Expand Down

0 comments on commit e4b23a5

Please sign in to comment.