Content Inventory

Does anyone have an example of building a content inventory of all pages and resources on their website?

What is a “resource” in this context?

For pages, we have .Site.AllPages.

Basically, everything embedded on and linked to on site pages and posts.
Media, files, etc.

There isn’t a Hugo-specific way to do content inventory, unless the content is kept in a data file or front matter parameter that I know of. I am not sure how bundles will work.

For instance, I keep my images and other files in a different place than my text content, and just link to them. There isn’t an easy way to scrap the content for those assets and list them out, though I suppose I could be really creative and use other tools to do so.

If assets are kept in static, then you can just list out those directories and there you have it, though not what links to them outside the aforementioned data files and front matter.

There will be a .Resources variable in an upcoming Hugo release. See here

But these resources will be at the same directory as the content files that use them.

A way to do what you want with Hugo right now is to use ReadDir

1 Like