Hugo Themes Part 4
Just like the last post, here is the TL;DR#
- Without git, you should use 7zip or tar to make backups of your working site on your workstation.
- There is a very specific order you should use to create new content.
- Some of this mystery behavior is me not understanding what I am doing when creating “new” posts that are actually old.
- IDK why, but I get better results with the Hugo test server by using the –disableFastRender flag.
When we last saw our heroes…#
I had decided to remove git from my workflow. It has definitely solved the disappearing template problem. Of course, if I need to regenerate my work directory for the site, I am out of luck. So I have taken to making compressed snapshots of the directory in case I have to delete the directory and start from my last checkpoint.
The other thing that I have discovered is that Hugo can sometimes miss your copy updates to your MarkDown files. When Hugo renders the page, you should get a number of pages that were rendered. That number should increment up:
| EN
-------------------+-----
Pages | 61
Paginator pages | 4
Non-page files | 0
Static files | 6
Processed images | 0
Aliases | 27
Cleaned | 0
It doesn’t necessarily have to increment up by 1, but it should be a larger value than the last time you added content.
I have yet to determine what causes this behavior. You just run the Hugo server and your new content isn’t there. So you run Hugo alone and still nothing. And so you close VSCode in frustration, and say “I’ll try this again tomorrow.”
And then the next day, you run Hugo, with zero changes to your markdown file, and suddenly it works. You get your incremented number for like, no reason:
| EN
-------------------+-----
Pages | 65
I don’t know man. It’s a fickle creature I guess. I have taken to running the Hugo server with the –disableFastRender flag, so you know the whole site is getting rebuilt every time.
hugo --disableFastRender
Sometimes that helps, but honestly, I just don’t know.
While I have certainly seen this “missed MarkDown” happen with zero explanation, I found that it doesn’t happen as frequently as I first noticed. About half of the time I was seeing this strange behavior, I was looking at the main landing page for the test site, and not seeing the pages that I was importing from WordPress. Well, if you create a new post, and then change the date of that post to reflect the time it was written, it’s not going to show up on the landing page. The landing page shows the 5 most recent posts, so if the date has changed to two years ago, it’s going to show up further back on the timeline of posts. I knew I was doing something wrong, I just didn’t know what it was.
Rolling the work directory back#
The advantage of git is that you can just delete the working directory and clone it again. That created its share of issues, but it was convenient to roll back to a possibly working state.
Now, I use 7zip to back up the working directory so I can start from something that worked last time. That’s not a guarantee. But it’s something to do. The other thing I do is back up the MarkDown files so that I can copy and paste their contents when I am having these problems. I need to find a cloud storage solution so that these files aren’t just sitting on my laptop.
Insert inspriational message here#
I am dug into this pretty deep, and I imagine I will have similar issues with other generators. So I am going to keep pushing with Hugo. Once I can reliably create new content, I will move on to deployment. For right now I am just using the “synchronize” function in WinSCP.
So eliminating git from the workflow, paying attention to what I am doing when creating posts, and using the “-disableFastRender” flag have made my experience more consistent, but it’s still not 100%.