add site var to control link destination

This commit is contained in:
Gus Esquivel 2017-05-18 17:52:37 -05:00
parent bb3a8251ef
commit 6890f1fbdf
3 changed files with 12 additions and 10 deletions

View File

@ -43,6 +43,8 @@ BackgroundImages = [
] ]
# optional background style (valid css only) # optional background style (valid css only)
BackgroundStyle = "background: #000000;" BackgroundStyle = "background: #000000;"
# optional bool to have links open in a new window/tab (default: true)
OpenLinksInNewWindow = true
# list of nav tags # list of nav tags
[[ params.nav ]] [[ params.nav ]]

View File

@ -1,10 +1,10 @@
<a class="tile tile-link" href="{{ .url }}" data-groups='{{ if .tags }}{{ delimit .tags "," }}{{ end }}'> <a class="tile tile-link" href="{{ .Link.url }}" data-groups='{{ if .Link.tags }}{{ delimit .Link.tags "," }}{{ end }}'{{ if .Jump }} target="_blank"{{ end }}>
<div class="tile-box" <div class="tile-box"
data-title='{{ .name }}' data-title='{{ .Link.name }}'
data-url='{{ .url }}' data-url='{{ .Link.url }}'
{{ if .bg_color }}data-bg-color='{{ .bg_color }}'{{ end -}} {{ if .Link.bg_color }}data-bg-color='{{ .Link.bg_color | safeCSS }}'{{ end -}}
{{ if .txt_color }}data-txt-color='{{ .txt_color }}'{{ end -}} {{ if .Link.txt_color }}data-txt-color='{{ .Link.txt_color | safeCSS }}'{{ end -}}
{{ if .img }}data-img='{{ .img }}'{{ end -}}> {{ if .Link.img }}data-img='{{ .Link.img }}'{{ end -}}>
{{ if .img }}<img class="logo" src="{{ .img }}"></img>{{ else }}{{ .name }}{{ end }}</div> {{ if .Link.img }}<img class="logo" src="{{ .Link.img }}"></img>{{ else }}{{ .Link.name }}{{ end }}</div>
<div class="tile-title">{{ .name }}</div> <div class="tile-title">{{ .Link.name }}</div>
</a> </a>

View File

@ -1,3 +1,3 @@
<div class="tile-container">{{ range .Site.Data.links.tiles }} <div class="tile-container">{{$jump := .Site.Params.OpenLinksInNewWindow | default true }}{{ range .Site.Data.links.tiles }}
{{ partial "tile.html" . }}{{ end }} {{ partial "tile.html" (dict "Link" . "Jump" $jump)}}{{ end }}
</div> </div>