passthejoe — the blog

You really need to set rsslimit in your Hugo config file

I use Hugo to automatically build two sites that pull XML feeds from the CentOS project whenever there are updates to the Stream 8 and Stream 9 Linux distributions. The entries tend to be long, but they are all text, and the great thing is that the blog tends to run itself.

I was having trouble with IFTTT, which I use to post the new entries to Twitter, and I found that the XML out of Hugo was sluggish.

It was then I learned that the Hugo binary was running out of memory on my servers right in the middle of building the XML page. And that XML file was running about 100 MB in size.

That’s a little big for a single XML file.

I was able to build it on my desktop, where I have a lot more memory at my disposal.

Looking at the XML, it appears that the default behavior of Hugo is to put the full text of every entry in the blog into the index.xml file.

That’s too big.

But there’s a way to keep the XML file size manageable, quicken the build and make everything work — including IFTTT.

There’s a Hugo config parameter called rssLimit. Just set it in your config.toml (or config.yaml or config.json), and Hugo will only put the number of entries you want in your index.xml.

In my config.toml, it’s:

rssLimit = 10

Ten entries is way more manageable than all the entries, and now my Hugo sites are running better than before. And also building without running out of memory.

#Hugo #Rss #Servers