Thank you Jura, alias works perfectly so far Douglas Adams was a class act.
Pleas excuse me talking aloud but I’m trying to fix in my mind the logic of the system
We have four principle document areas in HUGO
- SHORTCODES
- CONTENT
- TEMPLATES
- PARTIALS
I hope that this discussion is refined and checked can be placed in front of the next person being introduced to Hugo. I floundered because the logic evaded me by using the example themes as a start.
The LOGIC weakness and merit I referred to … as I understand it occurs when passing variables page location specific… occurs because of the walls within the system and the order in which inserts are processed. It is was not obvious to me that Partials could not be used in Content except in the HOME index page. There is a work around…
Content cannot access Partials directly but can access Shortcodes (that can access Partials)
- that is Content pages can access the Partial if the Partial is referenced in a Shortcode.
example // make a file in Shortcodes called logo.html
place in it the partial call for the logo … ** {{ partial “home/logo.html” . }}**
then in the Content.Page use {{< logo >}} so site just has ONE location for logo ir any other snippet of HTML. Awesome.
- That works so any Partial can be reused in Content HTML or MD with {{< shortcode >}}
Partials cannot access Shortcodes but can access other Partials … brilliant
Partials cannot access Content or Templates…
Index.htm (located in LAYOUT) cannot access Shortcodes but can access Partials… an exception.
Content pages (located in the content directory usually grouped in sub-directories) are wrapped in Templates split in a type SINGLE or LIST
The default wrapper is SINGLE and allows the insertion of {{ Content }} the Content.Page can override the default wrapping Template. Hugo is opinionated as to when it allows a LIST Template with by default is designed to list pages?..It creates a LIST template automatically for any sub-directory of Content with pages accessed by that sub-directory name ignoring the URL STUB set in each Content.Page. … please correct me if wrong.
If you make a page _indes.html in the sub-directory it will become the sub-directory list page BUT it cannot have any content. That must be made with a different and specified Template for that page unless you use sun-name.list? (that it will collect first)
Templates can have any Partial or any code and have all the Page variables available of the Content.page. They have no access to any Shortcode.
Correct me if I am wrong anywhere?
Shortcodes are very important as Templates and Partials cannot have Content.page .positioned variables passed to them except by fixed structures too limited. Some Content.Pages need more photos, panels and structures in random order not supported by Partials.
Shortcodes can have variable passed to them. I have hell of a problem getting them reliable so far though … and as the syntax is so far clumsy, I have not got the layout tidy in the Markdown pages of passing longer multiple variables to the Shortcodes. Maybe best to define new Content.Page variables that the Shortcode can collect? Is that possible? Even better if on the fly within the Content page.
Please check this idea…
Image file location for same named image files for each Content.page … it head.jpg topic1.jpg topic2.jpg. No images can be placed in the Content area. If you want images sitting in the same directory as the content in the PUBLIC result they must be placed in the STATIC area in same named directories. If so the Content Pages can use them directly automatically in a Templates where you cold make the Template or it’s Partial use an automatic process to include images. Problem comes when your txt is added but it could be placed in Page.Param. Better if the Content.Page has the image and text layout made there with less reliance on a Template. This must be worth deeper discussion as in the end the power of Hugo defined by the simplicity to publish complex content from one page.
And this is easy…
One more thing Id’ like … a flag in Hugo to turn on a section trace for development … if each component added to a page was to report in the page what code block is in use. … that is why I proposed this…and suggest that until this is done uses of Hugo adopt this method to trace Templates and Partials in Use.
May I suggest that Hugo by verbose flag places using template, shortcode NAME for debugging purposes. While the Hugo manual is extensive and (I see updating )I found comments such as {{ “” | safeHTML } were needed in all files… then finding the problem was faster.
my 10 cents …