From 6890f1fbdf6ee36668e79c6f503cfcac3c36f9bc Mon Sep 17 00:00:00 2001 From: Gus Esquivel Date: Thu, 18 May 2017 17:52:37 -0500 Subject: [PATCH] add site var to control link destination --- README.md | 2 ++ layouts/partials/tile.html | 16 ++++++++-------- layouts/partials/tile_slate.html | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8a2cb25..bfc1abd 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ BackgroundImages = [ ] # optional background style (valid css only) BackgroundStyle = "background: #000000;" +# optional bool to have links open in a new window/tab (default: true) +OpenLinksInNewWindow = true # list of nav tags [[ params.nav ]] diff --git a/layouts/partials/tile.html b/layouts/partials/tile.html index d7e239f..4e2fe15 100644 --- a/layouts/partials/tile.html +++ b/layouts/partials/tile.html @@ -1,10 +1,10 @@ - +
- {{ if .img }}{{ else }}{{ .name }}{{ end }}
-
{{ .name }}
+ data-title='{{ .Link.name }}' + data-url='{{ .Link.url }}' + {{ if .Link.bg_color }}data-bg-color='{{ .Link.bg_color | safeCSS }}'{{ end -}} + {{ if .Link.txt_color }}data-txt-color='{{ .Link.txt_color | safeCSS }}'{{ end -}} + {{ if .Link.img }}data-img='{{ .Link.img }}'{{ end -}}> + {{ if .Link.img }}{{ else }}{{ .Link.name }}{{ end }} +
{{ .Link.name }}
diff --git a/layouts/partials/tile_slate.html b/layouts/partials/tile_slate.html index 4f31816..6e2945a 100644 --- a/layouts/partials/tile_slate.html +++ b/layouts/partials/tile_slate.html @@ -1,3 +1,3 @@ -
{{ range .Site.Data.links.tiles }} -{{ partial "tile.html" . }}{{ end }} +
{{$jump := .Site.Params.OpenLinksInNewWindow | default true }}{{ range .Site.Data.links.tiles }} +{{ partial "tile.html" (dict "Link" . "Jump" $jump)}}{{ end }}