mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 10:27:45 +02:00
Support embed icons on bookmarks URLs
This commit is contained in:
parent
eeda2104a6
commit
90254b92d2
@ -5,6 +5,7 @@ import (
|
||||
"html/template"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message"
|
||||
@ -53,6 +54,7 @@ var globalTemplateFunctions = template.FuncMap{
|
||||
|
||||
return template.HTML(value + ` <span class="color-base size-h5">` + label + `</span>`)
|
||||
},
|
||||
"hasPrefix": strings.HasPrefix,
|
||||
}
|
||||
|
||||
func mustParseTemplate(primary string, dependencies ...string) *template.Template {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="flex items-center gap-10">
|
||||
{{- if ne "" .Icon.URL }}
|
||||
<div class="bookmarks-icon-container">
|
||||
<img class="bookmarks-icon{{ if .Icon.IsFlatIcon }} flat-icon{{ end }}" src="{{ .Icon.URL }}" alt="" loading="lazy">
|
||||
<img class="bookmarks-icon{{ if .Icon.IsFlatIcon }} flat-icon{{ end }}" src="{{ if hasPrefix .Icon.URL "data:image/" }}{{ .Icon.URL | safeURL }}{{ else }}{{ .Icon.URL }}{{ end }}" alt="" loading="lazy">
|
||||
</div>
|
||||
{{- end }}
|
||||
<a href="{{ .URL | safeURL }}" class="bookmarks-link {{ if .HideArrow }}bookmarks-link-no-arrow {{ end }}color-highlight size-h4" {{ if .Target }}target="{{ .Target }}"{{ end }} rel="noreferrer">{{ .Title }}</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user