scratchProcessing: homeLayout

Sidebar

> Hugo processing order
|-- Lorem
|-- -- Lorem page
|-- Lorem
|-- -- Lorem page
|-- Lorem
|-- -- Lorem page
|-- And
|-- Some
|-- More
|-- Pages

Taxonomies

|-- categories
|-- -- Bratwurst (1x)
|-- -- Lorem (3x)
|-- tags
|-- -- Dolore (2x)
|-- -- Ipsum (3x)
|-- -- more pages (4x)
|-- -- Qui (1x)

Home: Hugo processing order 1

About

This trial repository was created to see in which order Hugo processes the content.

The reason is that I would like to add some Scratch data to every page before the pages are rendered. Since Hugo does most of the processing in parallel this is not so trivial.

In this repo I tried four ways to run the partial which adds the Scratch data:

  1. Using a loop in the home page layout (demo).
  2. Using a loop in a custom output layout for the home page (demo).
  3. As the page is processed by its corresponding layout (demo).
  4. Using a loop in a custom layout, which is used by a dedicated content page (demo). This page has the weight set such that it will be processed first.

The selection takes place in config.yaml:

params:
  # scratchProcessing: # homeLayout / homeCustomOutput / perLayout / customLayout
  # Process the partial for adding some Scratch data to the page:
  #   "homeLayout" - using a loop in the home layout (`/index.html`)
  #   "homeCustomOutput" - using a loop in the home custom output layout (`/index.custom-output.html`)
  #   "perLayout" - as the page is processed by its corresponding layout (`_default/single.html` etc.)
  #   "customLayout" - using a loop in a custom layout (`_default/custom-layout.html`)
  scratchProcessing: customLayout

Inspect

To inspect the order a number (or time stamp) is added to the scratch.


Lorem 2

Lorem 3

Lorem 4

And 5

Some 6

More 7

Pages 8