projects: Open external link in new tab

This commit is contained in:
George Cushen 2016-12-27 02:46:07 +00:00
commit a741bc6db8
2 changed files with 6 additions and 3 deletions

View file

@ -33,7 +33,7 @@
{{ if .Content }}
<a href="{{ .Permalink }}">
{{ else }}
{{ with .Params.external_link }}<a href="{{ . }}">{{ end }}
{{ with .Params.external_link }}<a href="{{ . }}" target="_blank">{{ end }}
{{ end }}
<i class="fa-li fa fa-files-o pub-icon" aria-hidden="true"></i>
{{ .Title }}
@ -52,13 +52,16 @@
{{ range $project := where $.Data.Pages "Type" "project" }}
{{ $.Scratch.Set "project_url" $project.Permalink }}
{{ $.Scratch.Set "target" "" }}
{{ if $project.Params.external_link }}
{{ $.Scratch.Set "project_url" $project.Params.external_link }}
{{ $.Scratch.Set "target" "target=\"_blank\"" }}
{{ end }}
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 project-item isotope-item {{ delimit .Params.tags " " }}">
<div class="card">
{{ with $project.Params.image_preview }}
<a href="{{ $.Scratch.Get "project_url" }}" title="" class="card-image hover-overlay">
<a href="{{ $.Scratch.Get "project_url" }}" title="" class="card-image hover-overlay"
{{ $.Scratch.Get "target" | safeHTMLAttr }}>
<img src="{{ "/img/" | relURL }}{{ . }}" alt="" class="img-responsive">
</a>
{{ end }}

View file

@ -10,7 +10,7 @@
<h1 itemprop="name">{{ .Title }}</h1>
{{ with .Params.external_link }}
<a class="btn btn-primary btn-outline" href="{{ . }}">{{ i18n "open_project_site" }}</a>
<a class="btn btn-primary btn-outline" href="{{ . }}" target="_blank">{{ i18n "open_project_site" }}</a>
{{ end }}
<div class="article-style" itemprop="articleBody">