I like to visualize new posts on the browser as I write them. I found that hugo --watch and the live reloading is amazing for this! The only trouble is that my website has ~1,200 posts. While hugo is really fast, this still takes about 4 seconds for any changes to update on my current post.
Since I’m only concerned at live-reloading the current page I’m working on, I am wondering: is there a way to ignore / select a subset of pages for the live-reloading with --watch?
As far as I can tell, the only page that really changes when I edit the content of a single post is the index and the post page itself, so it would make sense to not regenerate the other thousand pages in my case.
If this feature doesn’t yet exist, I can move this thread to the “feature” forum for discussion.
We only load the changed file(s), so there are lots of “partial logic” in there. But we do render the entire site on every change. There are issues about this on GitHub. But it is a very hard problem to perfect. So until then I suggest you enjoy your 4 seconds turnaround. You may use the new metrics feature in the latest Hugo to tune your templates.
@schollz, the parameter is --templateMetrics. I have almost 1,300 pieces of content, and live reloading happens faster than I can switch windows. I use a very minimal theme, so the difference between our sites is likely complex theme templates.
When Hugo 0.29 dropped I posted about it and included my metrics. Betcha can’t wait to see yours!
That is one fast theme, @maiki … The noHTTPCache is just relevant for the hugo dev server. I had this site with a rather big JSON search index which suddenly got very sluggish, and I noticed that Chrome downloaded the entire index on every page load instead of using the 304 Not Modified status.
Basically, I found that my theme/partials/header.html had a little for-loop where it iterated over one page and it had a bunch of meta tag stuff. I just removed all that. Now my metrics look like: