Is it possible to use the name of the parent folder in the URL of a page?
Something like “:parent” or “:Parent” does not work.
CRITICAL 2018/01/10 00:03:23 error expanding “/:Parent/:slug/” section “”: permalink ill-formed
https://gohugo.io/content-management/urls/#permalinks does not mention any variable or method which might do the job.
Alternately, can permalinks be manipulated via list.html or single.html templates?
I can’t say about other methods, but the basic rules are listed under “Permalink Configuration Values” here:
Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs.
Also I assume that having the section in permalinks is a form of this “parent” concept, in that a page under the section can have its section in its slug. Perhaps if you give a couple examples of what you are trying to accomplish?
So I’ve this folder structure
posts > Books > Post1.md
and I want the URL for
Post1.md to look like “/Books/Post1/”.
If I use “:section” then I get the URL as “/posts/Post1/” instead.
What you want is not possible with the way you have organized your content.
You need to make /books/ its own section and then configure this books section permalink in your config.