feat: Add support for icons in url_custom

Close #787
Close #326
This commit is contained in:
George Cushen committed 2018-11-03 22:17:00 +00:00
1 parent de269ebdb8
commit dd5422981b
11 files changed
+39 -15

No files matched your search

+4
View File
@@ -30,6 +30,10 @@ url_slides = ""
url_video = ""
url_poster = ""
# Custom links (optional).
# Uncomment line below to enable. For multiple links, use the form `[{...}, {...}, {...}]`.
# url_custom = [{icon_pack = "fab", icon="twitter", name="Follow", url = "https://twitter.com"}]
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
[image]
@@ -29,6 +29,10 @@ url_slides = ""
url_video = ""
url_code = ""
# Custom links (optional).
# Uncomment line below to enable. For multiple links, use the form `[{...}, {...}, {...}]`.
url_custom = [{icon_pack = "fab", icon="twitter", name="Follow", url = "https://twitter.com/georgecushen"}]
# Featured image
# To use, add an image named `featured.jpg/png` to your project's folder.
[image]
+7 -1
View File
@@ -694,6 +694,12 @@ article {
box-sizing: border-box;
}
/* Prevent FA's line height of 1 causing FA button links to be taller than other button links. */
.btn-links .fab,
.btn-links .fas {
line-height: inherit !important;
}
.split-header-image {
position: relative; /* Required for caption positioning */
clear: both;
@@ -983,7 +989,7 @@ article .article-metadata {
color: rgba(255,255,255,0.54);
}
.pub-list-item .pub-links {
.pub-list-item .btn-links {
padding-top: 10px;
}
+17 -7
View File
@@ -120,11 +120,21 @@
</a>
{{ end }}
{{ range $.Params.url_custom }}
{{ $link := .url }}
{{ if not (urls.Parse .url).Scheme }}
{{ $link = (printf "%s%s" $.Dir .url) | relURL }}
{{ end }}
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
{{ .name }}
</a>
{{ $pack := or .icon_pack "fas" }}
{{ $pack_prefix := $pack }}
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
{{ $pack_prefix = "fa" }}
{{ end }}
{{ $link := .url }}
{{ $scheme := (urls.Parse $link).Scheme }}
{{ $target := "" }}
{{ if not $scheme }}
{{ $link = (printf "%s%s" $.Dir .url) | relURL }}
{{ else if in (slice "http" "https") $scheme }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
{{ if .icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} {{if .name}}mr-1{{end}}"></i>{{end}}
{{ with .name }}{{ . | safeHTML }}{{end}}
</a>
{{ end }}
+1 -1
View File
@@ -19,7 +19,7 @@
{{ end }}
{{ if $cite_link | or $pdf_link | or .Params.external_link | or .Params.url_preprint | or .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_source | or .Params.url_code | or .Params.url_dataset | or .Params.url_poster | or .Params.url_project | or .Params.url_custom | or .Params.projects | or .Params.slides }}
<div class="mb-3">
<div class="btn-links mb-3">
{{ with .Params.external_link }}
<a class="btn btn-outline-primary my-1" href="{{ . }}" target="_blank" rel="noopener">{{ i18n "open_project_site" }}</a>
{{ end }}
+1 -1
View File
@@ -39,7 +39,7 @@
</div>
{{ end }}
<div class="talk-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" $item "is_list" 0) }}
</div>
@@ -38,7 +38,7 @@
{{ .Date.Format "2006" }}
</div>
<div class="pub-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>
+1 -1
View File
@@ -27,7 +27,7 @@
</div>
</div>
<div class="talk-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>
+1 -1
View File
@@ -42,7 +42,7 @@
{{ end }}
</div>
<div class="talk-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>
+1 -1
View File
@@ -15,7 +15,7 @@
{{ .Params.event | markdownify }}
{{ end }}
</div>
<div class="talk-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>
</div>
+1 -1
View File
@@ -43,7 +43,7 @@
</div>
</div>
<div class="talk-links">
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>