mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
resources: Create a common ResourceFinder interface
And make both .Resources and resources implement it. This gets us 2 new methods/functions, so you can now also do: * .Resources.Get * resources.ByType Note that GetRemote is not covered by this interface, as that is only available as a global template function. Fixes #8653
This commit is contained in:
@@ -553,7 +553,8 @@ HEADLESS {{< myShort >}}
|
||||
|
||||
headlessResources := headless.Resources()
|
||||
c.Assert(len(headlessResources), qt.Equals, 3)
|
||||
c.Assert(len(headlessResources.Match("l*")), qt.Equals, 2)
|
||||
res := headlessResources.Match("l*")
|
||||
c.Assert(len(res), qt.Equals, 2)
|
||||
pageResource := headlessResources.GetMatch("p*")
|
||||
c.Assert(pageResource, qt.Not(qt.IsNil))
|
||||
p := pageResource.(page.Page)
|
||||
|
Reference in New Issue
Block a user