Only build one specific page

Hello girls & guys, did anyone of you know a way to make this happen?

I could imagine something like declaring it within the frontmatter of the specific file, or some kind of build flag to only build this page.

Goal: set path to the content file (eg: blog/article-01/index.md) and then only build this page.

Our site has around 600 article pages, and building the site takes around 20mins. So any tips or pointing towards the right direction would be super helpful!

Thank you!

So, when running the server and change 1 content file, we – in general – only process that file.

When running hugo we build everything. Currently no way around that. That said …

If you have 600 articles and it takes 20 min to build then … Either

  • are the articles incredibly big or you have some other big data I don’t know about
  • or you have some “ineffectiveness” in your site setup. I would expect 600 articles to build in less than a second in its simplest case.

My guess you have some suboptimal template(s). Running:

hugo --templateMetrics --templateMetricsHints

Should give you some hints.

2 Likes

Thanks for your quick reply!
There was indeed a black sheep in the templates. Now I’m down to 1m10s. So huge improvement, thank you for that! I think the rest is image processing (around 10k processed images). Or maybe some suboptimal docker configs.
But anyways, thanks so much! Really appreciate it!

You’re probably right re: image processing being the big load here. My site generates ~10K pages in about 13 seconds - it took longer when I had a badly-designed related-posts feature. Fixed that, and page generation sped up considerably.

Note that if your images lives in page bundles, the originals currently gets “auto published”. In next Hugo (coming very soon), I have added a way to turn off that behaviour. Which should be good for sites with many/big originals.