Content Inventory


#1

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


#2

What is a “resource” in this context?

For pages, we have .Site.AllPages.


#3

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


#4

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.


#5

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