mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
@@ -31,13 +31,13 @@ func init() {
|
||||
|
||||
ns.AddMethodMapping(ctx.Exists,
|
||||
nil,
|
||||
[][2]string{{`{{ if (templates.Exists "partials/header.html") }}Yes!{{ end }}`, `Yes!`},
|
||||
[][2]string{
|
||||
{`{{ if (templates.Exists "partials/header.html") }}Yes!{{ end }}`, `Yes!`},
|
||||
{`{{ if not (templates.Exists "partials/doesnotexist.html") }}No!{{ end }}`, `No!`},
|
||||
},
|
||||
)
|
||||
|
||||
return ns
|
||||
|
||||
}
|
||||
|
||||
internal.AddTemplateFuncsNamespace(f)
|
||||
|
@@ -36,5 +36,4 @@ type Namespace struct {
|
||||
func (ns *Namespace) Exists(name string) bool {
|
||||
_, found := ns.deps.Tmpl().Lookup(name)
|
||||
return found
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user