Site Design and Migration Issues - help and ideas needed - Suggest Newbie path?


#1

Moving a big single page site to Hugo, Hugo seems very opinionated, but he has hidden abilities.

Cutting out sections of the one page site into many partials wanting to populate many new pages with these sections.
Wanting to keep the index page as a big page still remade the index page perfectly comprised of partials.

Now I want new topic pages each made from some of the partial. Hugo is FAST!

Partials do not work in content. If I made a template for each corresponding content page it is an inflexible mess. Some scope problem? The .Get always failing V

Tried shortcodes - ie {{< logo >}} great; I make a shortcode that calls the partial I need for the page.
So I can now add partials to the pages in the content area. _ Now this rocks._ {{< rooms >}} {{< people >}} {{}}

So next if all the sections where placed in shortcodes the pages can use them and I can mix in new content - BUT the index page cannot use shortcodes! So it has to use the partials. As the single front page has a different navigation to sections in that page we can easily use a different partial for the nav menu.

May I suggest that Hugo by verbose flag places using template, shortcode NAME for debugging purposes. While the Hugo manual is extensive I found comments such as {{ “” | safeHTML } were needed in all files… then finding the problem was faster.

Another failure was the lack of inherent automation for simple stuff. Example adding photos.
The shortcodes became the method to add automation. Another opinion (i may be wrong) is that Hugo does not allow images in the contents subdirectories. They mist be in static it seems.

Please keep the topic rolling as Hugo has great potential not just as a blogging site, cutting back or linking the logic more clearly of some of the template location type and opinion and simplifying the structure for lots of partials.

Further is there a way a page can have two urls? Ie /expore/hithammock and /hothammock.

I expect that this will be live in April 2017 hothammock.com with zillions more pages!
(For Steve Francia - thank you)


#2

This is the only question I understood from your post. To answer it, yes: see aliases.


#3

I think my Babel Fish has fallen out too !


#4

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

  1. SHORTCODES
  2. CONTENT
  3. TEMPLATES
  4. 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 …


#5

_Opps _index.html not indes.html


#6

A tough read but I gather there is some general confusion due to the structure and content, and in some cases lack thereof, of the documentation. It definitely created some unnecessary hurdles for me while getting started.

As for my own use, I’m new to Hugo but already working on my own themes. Aside from some range loops which call Pagination and a “double where” in the same “breath”, I tend to aim for keeping it simple. I don’t use shortcodes, My content (.md files) only contain markdown, and I have a lot of partials including other partials, sometimes conditionally. The key to my method of using and understanding comes with relying heavy on $.Scratch add and get. Without it, I’d likely not be using Hugo to the extent that I am aiming to adopt it, build tools to accompany it, and generally integrate it into my workflow. So far, I haven’t found anything I can’t do with Hugo, albeit sometimes it does take some trial and error (which I enjoy.)

With that said, I don’t know enough about Hugo’s internals to qualify or modify your statements but I am curious to see if $.Scratch may solve some of your issues with maintaining variable definitions, allowing you to simplify the way you are attempting to build out your project.

Regards,

Kris