Any hints on viewing blogdown site locally more rapidly?

blogdown

#1

I have a blogdown site which I want to view locally after writing a new post and applying serve_site()

slow

Building the site takes around 30secs with a similar time before the
"Serving the directory" message arrives and the site shows up in the Viewer pane

However, when I attempt to open this in a new window I get the “Waiting for 127.0.0.1” but nothing usually appears
For instance I’m currently up to 15 mins and still waiting


#2

This is strange considering you have only a few pages to render.
I can render 500 posts in about 2 seconds:

tarted building sites ...

Built site for language en:
0 of 3 drafts rendered
0 future content
0 expired content
569 regular pages created
1668 other pages created
0 non-page files copied
1186 paginator pages created
8 categories created
26 bangumis created
795 tags created
total in 2121 ms

Here is my suggestions:

  • Please check hugo version using blogdown::hugo_version() and if possible, blogdown::update_hugo()

  • If you want to see the actual duration of template rendering. You can use the latest hugo (v0.30.2) and run this in the site directory:

hugo --templateMetrics

you should see similar things like this:

Template Metrics:

     cumulative       average       maximum         
       duration      duration      duration  count  template
     ----------      --------      --------  -----  --------
   2.862392915s    2.621238ms   18.082299ms   1092  _default/list.html
   2.836366088s    1.656755ms   13.131224ms   1712  theme/partials/header.html
   2.724485992s      4.7882ms   14.245897ms    569  _default/single.html
   534.840043ms     641.295µs   37.446011ms    834  rss.xml
   487.320997ms   10.368531ms   18.059756ms     47  index.html
   484.936263ms     283.257µs    3.708622ms   1712  theme/partials/footer.html
   293.644182ms     171.521µs    4.102104ms   1712  partials/banner.html
   237.016424ms      38.785µs    8.956208ms   6111  theme/partials/author_names.html
...

Then it might be possible to debug the performance issue


#3

Thanks for suggestions. I was able to update to the new version with update_hugo()

didnt quite follow next command
In RStudio terminal in the project directory entered hugo --templateMetrics
and got hugo: command not found


#4

The second command is for the terminal like bash, not in R terminal. if you use linux or macOS, you can run it in any of the terminals.

Anyway, since blogdown wrapped hugo nicely, you can run this wrapper function in R terminal to get it working:

blogdown::hugo_cmd("--templateMetrics")

#5

@tctcab
Thanks. Running that, I have some shortcode tweets which are most costly and one or two others that might be worth pursuing but it still, currently, adds up to only a few seconds
I think that the issue of taking so long to open in browser may well have been down to having too many other tabs open; so I wll keep an eye on that in future