5 ms·
I considered doing this with my hugo blog, but decided I wanted to do the work on my client and keep my server stupid. In order to build my site, I have a lot o
by jalami 10y ago
I considered doing this with my hugo blog, but decided I wanted to do the work on my client and keep my server stupid. In order to build my site, I have a lot of minification, pdf generation, syntax highlighting etc, that requires a few packages to be installed on the client.
If my server had to rebuild after a git push of a new post, I'd have to install all of the tooling on the server. I just commit my post, then run npm deploy which rsyncs all the static assets to the server after building on the client. This also makes it so I can see everything on my client easily before deploying. If I was building a blog for someone else though, this would make sense, stupid client, smart server, commit from anywhere.
- snehesht 10y agoMy motivation for this project was simple, I need a good interface to write my articles from different devices and able to publish them without touching the server. I built this in such a way I don't need to think about database backups, server side authentication, using dropbox to sync my unfinished articles. This architecture offers me freedom to write on my phone (Termux) during commute or sitting in the office and keep track of changes using git and finally publishing the post by simply adding a record into metadata.json.
- jalami 10y agoYou could throw Jekyll, Middleman, Pelican or Hugo on the server and run their build command with a git hook. Then you'd get the same result, but a completely static website without the server needing flask to piece together pages when a user hits the site. The build times wouldn't be instantaneous as it would need to regenerate all the pages, but Hugo is still really snappy for even a large site. You probably post less than users access anyway. This would still check all your boxes: No database No server side auth Non-public drafts (metadata) Commit from anywhere Bonus: Dumb serving (only prebuilt static pages) Optional bonus: Shortcodes, themes, bells whistles The site would be built on the server so it wouldn't be completely dumb like rsync-ing static pages to nginx or something, but that's the rub if you want to be able to use clients with only git as a dependency. Yours is a good solution, I'm just throwing an idea out there for a pre-baked alternative. My original use case didn't call for mobile blogging (not a fan), I run my own gitolite server so auth is already in my camp and I have a multi-tooled build that I didn't want on the server. If something breaks, it happens on my machine instead of on my server. Also just a tip, maybe you want to put a <noscript> tag around an expanded copy of your hamburger menu. Without javascript, your website navigation is broken because you can't expand the menu. Edit: by client, I mean blog-editing-computer not blog-reader's-computer.
- snehesht 10y agoWhat you said is true but where's the fun in it. I started this project as a simple django blog, included react little later and then scratched the whole thing and finally built this. It was fun working on this. About the menu, I was planning to update it to hamburger icon with animations. For now the icon doesn't change and the menu is injected into adjacent/bottom element based on screen size. Thanks your feedback though.
- GeneTT 10y agoWhat you describe is pretty similar setup to my blog. Im using Jeykll with Bitbucket Pipelines, when I push it builds the site and uploads it to S3.
- afandian 10y agoInteresting to hear your experiences. I'm doing something similar, with a large number of files in the static directory which never change. Hugo seems to lack any knowledge about which files it changed, so it's a huge re-upload every time (I'm using AWS S3 sync). It would be nice if Hugo could remember if it touched a file or not. AFAICT it just copies everything over each time and changes the datestamp. Even with rsync this is a lot of useless work. I've got a script which does a git pull every 5 minutes, with automatic hugo build. It works (Hugo doesn't crash that often) and is simple enough for me.