But this is not working for me as it returns a Page(0) collection. Please tell me where I might have went wrong, or hopefully a better approach for this use-case, which is to get the page resource of the author of the current page.
The names of the authors, author1 and author2 are also Params for my RegularPages. I want to be able to refer to the front matter inside content/authors/<some author>/_index.md while on a random RegularPage.
The above snippet is an attempt to access the page resource for the author.
Hope this clears things to some extent, if not, I’ll try to emphasize more.
But does it make sense to be using that value? If it’s not a built-in page var like Section, Type etc, it should be .Params.something : https://gohugo.io/functions/where/
Well, I don’t want to push the changes upstream right now, since it’ll affect the deployment of my website etc.
I can, however, confirm that path.Base (path.Split .Path).Dir returns author1, author2 according to above directory tree. The issue happens when I use it in where.
I know that it’s not nice of me not to provide you with the code, but I really don’t want to. There are a lot of changes in the code since I’m doing a revamp of my website and hence I’m waiting to push it once everything’s well tested.
It isn’t a matter of niceness; we literally don’t care about your website, so you should be reproducing the issue in a minimal repo and sharing that. We just need to look at the source code to understand what’s happening.