tpl/urls: Return empty string when JoinPath has zero args

This commit is contained in:
Joe Mooring authored and Bjørn Erik Pedersen committed 2023-05-20 11:14:18 +02:00
1 parent 310ce949ad
commit 0e0c7b25e3
1 file changed
+2 -1
+2 -1
View File
@@ -1,6 +1,6 @@
--- ---
title: urls.JoinPath title: urls.JoinPath
description: Joins the provided elements into a URL string and cleans the result of any ./ or ../ elements. description: Joins the provided elements into a URL string and cleans the result of any ./ or ../ elements. If the argument list is empty, JoinPath returns an empty string.
categories: [functions] categories: [functions]
menu: menu:
docs: docs:
@@ -10,6 +10,7 @@ signature: ["urls.JoinPath ELEMENT..."]
--- ---
```go-html-template ```go-html-template
{{ urls.JoinPath }} → ""
{{ urls.JoinPath "" }} → "/" {{ urls.JoinPath "" }} → "/"
{{ urls.JoinPath "a" }} → "a" {{ urls.JoinPath "a" }} → "a"
{{ urls.JoinPath "a" "b" }} → "a/b" {{ urls.JoinPath "a" "b" }} → "a/b"