Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gesquive/slate.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGus Esquivel <gesquive@gmail.com>2017-05-19 01:52:37 +0300
committerGus Esquivel <gesquive@gmail.com>2017-05-19 01:52:37 +0300
commit6890f1fbdf6ee36668e79c6f503cfcac3c36f9bc (patch)
tree8dbf9e228a83ddbd4354bdd75627c309bdf5cb67
parentbb3a8251efa62e3291b2f1a1818a66ce7340558d (diff)
add site var to control link destination
-rw-r--r--README.md2
-rw-r--r--layouts/partials/tile.html16
-rw-r--r--layouts/partials/tile_slate.html4
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 @@
-<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"
- data-title='{{ .name }}'
- data-url='{{ .url }}'
- {{ if .bg_color }}data-bg-color='{{ .bg_color }}'{{ end -}}
- {{ if .txt_color }}data-txt-color='{{ .txt_color }}'{{ end -}}
- {{ if .img }}data-img='{{ .img }}'{{ end -}}>
- {{ if .img }}<img class="logo" src="{{ .img }}"></img>{{ else }}{{ .name }}{{ end }}</div>
- <div class="tile-title">{{ .name }}</div>
+ 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 }}<img class="logo" src="{{ .Link.img }}"></img>{{ else }}{{ .Link.name }}{{ end }}</div>
+ <div class="tile-title">{{ .Link.name }}</div>
</a>
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 @@
-<div class="tile-container">{{ range .Site.Data.links.tiles }}
-{{ partial "tile.html" . }}{{ end }}
+<div class="tile-container">{{$jump := .Site.Params.OpenLinksInNewWindow | default true }}{{ range .Site.Data.links.tiles }}
+{{ partial "tile.html" (dict "Link" . "Jump" $jump)}}{{ end }}
</div>