Browse Source

add site var to control link destination

main
Gus Esquivel 8 years ago
parent
commit
6890f1fbdf
  1. 2
      README.md
  2. 16
      layouts/partials/tile.html
  3. 4
      layouts/partials/tile_slate.html

2
README.md

@ -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 ]]

16
layouts/partials/tile.html

@ -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>

4
layouts/partials/tile_slate.html

@ -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>

Loading…
Cancel
Save