Skip to content

Commit

Permalink
implemeht 'startswith()' template function so themes can avoid sendin…
Browse files Browse the repository at this point in the history
…g analytics if the homepage begins with file://
  • Loading branch information
weberc2 committed Apr 23, 2024
1 parent ecf021f commit c7a7036
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/futhorc/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"html/template"
"io/fs"
"net/url"
"strings"

"github.com/tailscale/hujson"
)
Expand Down Expand Up @@ -64,6 +65,7 @@ func parse(fs fs.FS, templates ...string) (*template.Template, error) {
"html": func(input string) template.HTML {
return template.HTML(input)
},
"startswith": strings.HasPrefix,
}).
ParseFS(fs, templates...)
}

0 comments on commit c7a7036

Please sign in to comment.