24 ms·
How to set up a blog with Hugo and Cloudflare, and why you should
- Arrezz 5y agoI have been thinking about having a blog for a while now but I can't really see what benefits it would give me? Seems like a lot of effort for something not terribly rewarding but maybe that is me being ill informed.
- TheFreim 5y agoI journal offline in a notebook. It's not "rewarding" in a monetary sense, but I still enjoy it and find it to enhance my life. A blog is similar in that it's like a journal except you can send it to people and get input in response.
- lbriner 5y agoThere is a slightly different motivation when writing for the public. I have to take a bit more time to make things read well and clearly and this can help my general communication skills. Engineers are often introverts and many can struggle communicating easily the ideas that they understand entirely but which are complicated. Blogging is a good way to challenge that and force you to abstract something well enough to explain it.
- sylvain_kerkour 5y agoIf it can motivate you, I received more job offers than I can accept thanks to my blog https://kerkour.com/ https://kerkour.com/
- dudul 5y agoHow do you know your blog is what made the difference?
- sylvain_kerkour 5y agoI don't have linkedIn, and I usually get messages after an article got some attention on social networks :) Also, sometimes, my website is directly mentioned in the emails.
- ezconnect 5y agoHe didn't send out resume to apply for the job, jobs found him via blog post.
- dudul 5y agoHow does he know it came from the blog and not his LinkedIn profile or github page? I get 3 or 4 emails a day for jobs without having a blog, so I'm curious to understand how he can tell that his blog is what is drawing the attention.
- cute_boi 5y agoI usually get email like "We found you via github! If you are seeking for job, please apply today blah blah blah". Maybe these recruiters mention his website?
- ahelwer 5y agoIt’s critical if you’re an independent contractor or will become one some day. Writing blog posts about interesting projects or topics then submitting them to tech news aggregators (HN, lobste.rs, r/programming) pays dividends for years. Not even from the post itself necessarily, but it ensures you show up in search results. Much easier than writing a textbook, doing conf talks, or building a really good network. Plus it’s also nice on a psychological level, I feel I only get closure on projects once I write about them.
- cturtle 5y agoI enjoy sharing posts because I enjoy the process of writing about something that inspires me. If I made progress on a personal project or learned something interesting, it is nice to take a step back and log it. I find that I can recall what I learned more if I wrote about it, and if I forgot, I have a place to look back on! Publishing writing on a blog just makes this information public. I chose to do that since I benefit from the blogs of others, so I might as well make my learning and insights public, hopefully helping someone else too!
- commandlinefan 5y agoI had one that I published to every month for about ten years. I got some positive feedback, which was nice, but ultimately the effort of researching and coming up with what I considered quality content got to be more trouble than it was worth.
- Dma54rhs 5y agoIt gives some people good feeling when they can share good things with others. And some do it for self marketing. And some maybe for self esteem, like Instagram but tech stuff.
- ReactiveJelly 5y agoIt's nice for stuff you might want to reference later: 1. Opinions you talk about regularly, that would benefit from a well-structured argument you can link people to instead of typing from scratch every time 2. That one StackOverflow post you need every 2 years but you keep losing it because the search keywords are weird
- kaashif 5y agoI've been writing blog posts for 10 years and I don't even write with the intention of anyone reading it, it's just nice to get my thoughts into words or document a project I've been working on (e.g. how to get some weird hardware to work, or what some weird error messages really mean). Having it be public is a motivator to make sure it's at least kind of coherent. Sometimes I get an email from someone who found one of my step by step guides useful, that gives me a warm fuzzy feeling which is the closest thing to a benefit I get.
- lbriner 5y agoIt can be rewarding in a number of ways, most of which can be split into helping yourself and helping others. To help myself, as another poster said, I record things I've learned, errors I have fixed, processes for e.g. setting up ssh securely or whatever. To help others, most of the things that help me also help them. Every now and then I get a really weird error that no-one else seems to get and I have to solve it and then blog about it. Hopefully another 10,000 people don't have to go through the same pain. At one point, I think I had about 200K viewson my blogspot blog but eventually I just came to hate the fact that they never seemed to update the site or fix any of the bugs on it so I went static and lost a tonne of SEO in the process but that will grow again!
- codazoda 5y agoIt is extremely rewarding for me. Like others have said, I write for my future self. I’ve been doing so for about 20 years. It’s extremely rewarding, for me, when someone emails me to say thank you. I’ve gotten emails from people saying I helped them lose 200 lbs (yes 200) or save $1000’s of dollars. That’s pretty rewarding. For the curious, the person who lost weight was using a calorie tracker I built and wrote a blog post about. The person that saved money followed instructions on how to install old software on newer OS’s, saving them from buying a whole new embroidery machine (something I only did because my Mom needed help with her embroidery hobby).
- coffeefirst 5y agoIf you want a reward, then you’re right, it doesn’t make sense. Hobby sites are creative outlets, it’s about the enjoyment of making stuff just because you can.
- smoyer 5y agoThis is a great article and many of the steps can be generalized to other services. It's a good thing you don't need to click anywhere because that's the most annoying cursor ever!
- iKlsR 5y agoQuickest way to get me to close the tab to any site is to override the cursor look or movement.
- elevaet 5y ago.. or override the scroll speed
- Belphemur 5y agoOr disable copy pasting (especially on forms)
- rickstanley 5y agoOr not open at all, if the title includes: "... why you should"
- unfocussed_mike 5y agoOr "Here's why." NO.
- thasmin 5y agoIs Namecheap a scammy registrar?
- Jamie9912 5y agoNo
- cbg0 5y agoNope. Renewal is indeed more expensive than the first year and more expensive than Cloudflare overall but they display it quite publicly: https://www.namecheap.com/domains/full-tld-list/ https://www.namecheap.com/domains/full-tld-list/
- zinekeller 5y agoI'll add why Cloudflare is cheaper: it's subsidised. The fee for their own operations is $0.00, they expect you to use their other services though, which is paid.
- kilroy123 5y agoAgreed. It's a little frustrating to always hunt down a coupon code when renewing all my domains.
- cmetzger4 5y agoNo. I've had domains registered with them for years. They have great support via online chat that I have used a couple times. Also a customer of their email hosting and it has been solid.
- pigbearpig 5y agoI don't think so, I was under the impression they were one of the better ones.
- rukshn 5y agoGo daddy is definitely scammy. I’m using NameCheap for the domain and hosting of my blog and quite happy with their service and customer support. I’ve also used PorkBun for domain names. Their prices are reasonable as well
- jinseokim 5y agoHappy with Cloudflare Pages but its build takes too long. 2 minutes for "initializing build environment", and <5 seconds for actual build...
- Jamie9912 5y agoAgreed, I wonder if it's poorly engineered and that 2 minutes is spent spinning up an Ubuntu VM on GCP You can ask "Walshy" in the Cloudflare Developers Discord and he can give you access to a feature called "fast builds" it's in beta at the moment.
- jhart99 5y agoI think it is because the container it spins up is a bit heavy. When you select a framework, it just sets a build command. It seems as though every framework and tool is installed in that build container.
- natnatenathan 5y agoDumb question, why build the site on the server? Shouldn’t the site generate on your laptop and then upload the static content to the server? It just seems to me that building on server adds a lot of complexity.
- Dma54rhs 5y agoTrue but you often want people to make updates that can only either edit markdown files or use some frontend that then calls the build process. (marketing people, copywriters etc). When you're a hacker who knows how to install dependencies and don't have to use other machines sure.
- jtbayly 5y agoOr if you just want to make a quick typo fix on your phone on GitHub…
- jffry 5y ago
- hericium 5y agoEDIT: I was wrong. Apologies.
- smallerfish 5y agoThat's weird - does `themes` not exist for you after the hugo new command?
- totetsu 5y agoAnd you can export the Hugo markdown from org mode https://ox-hugo.scripter.co/ https://ox-hugo.scripter.co/
- marcofiset 5y agoHugo supports org-mode natively. It's not a very widely known feature but it does work.
- kaushalmodi 5y agoHello, ox-hugo author here. Hugo has the best support of Org Mode as a markup. But Org mode is more than a markup. I ended up facing some limitations with the original Org mode parser used by Hugo and so I developed this exporter. Since then the Org parser used by Hugo got replaced by an even better exporter, but still the points mentioned here apply: https://ox-hugo.scripter.co/doc/why-ox-hugo/ https://ox-hugo.scripter.co/doc/why-ox-hugo/ The biggest ones are being able to organize all my posts as subtrees in a single Org file and leverage the Org mode's inbuilt"meta data" inheritance.
- ahelwer 5y agoYou can also do this directly with gitlab pages, which supports hugo. My blog runs on it.
- rgacote 5y agoBeen doing a lot of internal documentation with Gilab pages, Sphinx, and Myst (markdown for Sphinx). There are pre-built templates for the Continuous Integration for rebuilding the pages.
- Brajeshwar 5y agoI have had multiple downtime with GitHub Pages. I have tried with quite a few and it is not limited to a particular repo or domain. We are spoilt with choices these days for Static site and I'm particularly happy with both Netlify and Cloudflare Pages.
- jtbayly 5y agoI came here to ask why these instructions didn’t just use GitHub pages. Especially since it seems it is targeted toward a person that this is a stretch for, and GH pages would be easier. So anyway, downtime is one reason I suppose. Are there others?
- whimsicalism 5y agoI seem to recall from my experience that if you want to have a custom domain and subdomain, they can't both be on gh-pages but they can be on Cloudflare. Don't really remember what the hurdle with gh-pages was though.
- the_arun 5y agoI wish github supported comments on any file in the repository with a preference to turn it off. That alone is sufficient in most cases. OR There is a way to make GitHub pages to support commenting by default. Currently, it is a pain to run after third party tools for commenting. Is it so difficult to make already existing commenting feature to work on pages or regular files?
- codazoda 5y agoI use GitHub pages with no build step (GitHub handles that). I use my repos root folder for my page content, starting with index.md. I have a custom domain and just point the a record or cname at my GitHub address or IP. Works great for me and I haven’t noticed a lot of downtime, but I don’t really monitor either. Edit: It is a little slow to build when you make changes. My changes take a minute or two to appear on the site.
- Brajeshwar 5y agoAnother thing I remembered, was the support for newer Jekyll version and plugins. I had everything running locally and it failed on GitHub Pages without any error anywhere. It turned out to be that I need to step back few versions with Jekyll (and I think some Github approved plugins). I’m fine with that but the lack of error why that is happening was hard for me to assume. Last year, I moved my site[1] (a pretty heavy content with lots of text files from two decades), and I really like Hugo. It was fast and can compile my site quick enough. Jekyll still crawls but I was ready to live with it as I can just write in MarkDown and don’t worry about compiling every time. However, the downtime was the reason I stopped using GitHub Pages. 1. https://brajeshwar.com/2021/brajeshwar.com-2021/ https://brajeshwar.com/2021/brajeshwar.com-2021/
- meowmeow20 5y agoThis is a really cool article. I think more people should have a blog or some form of a personal website. Here's a small but definetly incomplete list of free static site hosting with a custom domain: - Cloudflare - Netlify - Heroku - Github Pages - Gitlab Pages - Google Firebase (360 MB/day traffic, plenty enough for small sites) - DigitalOcean App Platform (1GB/mo)
- dminor 5y agoRender
- russellendicott 5y agoI did something similar to the OP but with hugo and an S3 bucket. First thing I did after setting it up was document how I did it for future me. http://blog.bytester.net/posts/about-blog/ http://blog.bytester.net/posts/about-blog/
- hsn915 5y agoThere's also surge.sh
- toastal 5y agoSourcehut has Pages and there's something similar now at Codeberg for those interested in FOSS Git forges
- skybrian 5y agoI'm wondering why Hugo wants you to install homebrew. It's a Go program. Shouldn't downloading a binary be all you need? Or maybe building it from source? The Go SDK doesn't require Homebrew.
- _fat_santa 5y agoLooks like the guide is using it to install the Hugo binary and Git. So if you already have git and a Go dev env, you shouldn't need to do that.
- reidrac 5y agoIt is weird, because here: https://gohugo.io/getting-started/installing https://gohugo.io/getting-started/installing ...they refer you to the GH's releases page, where you can find binaries ready to use (I don't use Mac, but I see 64 bit and ARM64). You don't need a Go dev env to use Hugo. I use it in Linux and I don't have a Go compiler installed.
- skyfaller 5y agoYou don't need Go, but it enables certain features like Hugo modules, which I find easier to use e.g. for themes than e.g. git submodules: https://gohugo.io/hugo-modules/ https://gohugo.io/hugo-modules/ Basically it uses the Go dependency manager to help you assemble your website. Here's my documentation on Hugo modules for my work-in-progress Hugo theme: https://git.sr.ht/~skyfaller/maxethics-hugo#hugo-modules https://git.sr.ht/~skyfaller/maxethics-hugo#hugo-modules
- admn2 5y agoI've been using Cloudflare Pages almost exclusively. It's nice not having to worry about bandwidth limits. That being said, I would probably use Vercel a lot more if they weren't so strict about their hobby plan not being used for "commercial purposes" at all. While I understand they want to make money, seems silly not to offer some sorta leeway when you have so many other options that do.
- tarunupaday 5y agoI work with non-technical people who cannot install (or does not want to) or build anything on their regular machines. The best option would be rather create posts in a browser or iPad. Is there a way to set up a stand alone blog (which is not on “community-linked” content platforms like Medium) that DOES NOT require installing and compiling or even a personal laptop?
- ctxc 5y agoCheck Hashnode out
- leodriesch 5y agoYou could just use any website builder like Squarespace. Other options would include creating HTML pages on vscode.dev or creating a Next.js site with Stackblitz that is hosted on Vercel or something.
- johnnypangs 5y agoGhost is nice. https://ghost.org/ https://ghost.org/
- mmcnl 5y agoSeconded. This is really easy.
- fasquoika 5y agoWritefreely? https://writefreely.org/ https://writefreely.org/
- miikavonbell 5y agoYou can also couple Hugo with Netlify CMS or Forestry.io. Those add a CMS UI for your SSG website that can be accessed for example from yourblog.com/admin/.
- open-source-ux 5y ago"I work with non-technical people..." Consider using WordPress. There are many hosting providers who offer a managed WordPress option. They manage the installation, hosting and back-ups. The non-technical users simply sign-in to WordPress via their browser to write posts using a browser-based editor. Local installation on user machines is simply not required. Static Site Generators (SSGs) like Hugo are supposedly 'simple' compared to the complexity of dynamic blog engines. However, the Hugo setup discussed in this thread is much too complicated and defies the meanings of simplicity or easy. SSGs lack comments and even a simple contact form is impossible without a third-party service or plug-in.
- unfocussed_mike 5y agoHugo is impressive, but: > Wordpress is a mess that keeps on chugging through inertia This is a weirdly reductionist position. WordPress is an auto-updating, security-patched, open source CMS with a stable API, an advanced WYSIWYG editor and now layout tool, a reliable REST interface, good hosting support from stable vendors, a highly functional foundation and a profitable owner, etc. It's really no messier than any other open source CMS (less messy than several), and it has better community and foundation support than almost any open source product I can think of. It's fine not to like it, but let's not just casually write it off in a blog post about a static site generator that is limited in scope and a single third party behemoth hosting operation; that's disingenuous.
- nunez 5y agoThis right here. For us technical folk, Wordpress is a beast that needs to be slayed. For John, the non-technical, world-travelling coffee shop owner, that wants to maintain a simple blog describing his adventures, it's perfect. (I say this as someone who used Wordpress and now uses Hugo)
- Saris 5y agoI feel like a lot of people dismiss WordPress purely on it being complex or heavy to run while completely dismissing the huge benefits it offers.
- cleancoder0 5y agoI do not like Hugo at all. Quite hard to map data inside templates.
- Nextgrid 5y ago> security-patched Unless bad guys "patch" it first before the official patches are out.
- unfocussed_mike 5y ago(You did not deserve downvoting on this; it's a reasonable point. Not sure when the last zero-day was exploited in WP itself, but it definitely happens in plugins and themes.) I usually find out there is an official patch when I get an email from a WP installation telling me it has already been installed. Core WP copes with zero-day attacks better than most platforms. To the extent that they will even mitigate problems in widely-installed third party plugins and themes if they think it necessary. Sure, there is a paradox with anything popular like this, that the people who are installing it are the people least likely to be able to deal with security patches. And that is an endless source of tension. But it is also why WP auto-patches, why plugin and theme auto-updates are now possible etc.
- advael 5y agoThis sounds like a fun project tho I'd likely self-host the git repo because I no longer have a personal github account and don't plan to reverse that decision in the foreseeable future
- lazyant 5y agoAlso google's Firebase works well for me
- lbriner 5y agoOP mentions Medium which is pretty annoying but do know what irks me the most with them and many other premium platforms is that they seem to convert quotes to smart quotes when people upload articles making it impossible to copy-and-paste examples that people use. I think Medium have even tried to stop people copying and pasting content without an account. That is so anti-internet. Most of the knowledge I have I got for free so the idea that somehow I should charge others for it instead of helping others to go much further than I ever could.
- throwamon 5y agoLast time I did some research on SSGs, I saw lots of complaints about Hugo, including this one by the creator of Zola: > This tool and the template engine it is using were born from an intense dislike of the (insane) Golang template engine and therefore of Hugo that I was using before for 6+ sites. Could anyone with experience with this and other solutions weigh in? There are so many of them my head spins when I think about it. I just want something that doesn't make me babysit it (as in, I can write as little code as possible to get a simple static webite) and has the usual things you'd want by default (e.g. image optimization) and is extensible if I do outgrow it and need to add dynamic components.
- brabel 5y agoGo templates are indeed weird... and Hugo is very far from the only option in this space... I never tire to link to the list of SSGs available today: https://jamstack.org/generators/ https://jamstack.org/generators/ Each option lists which template language it uses, license and language it's written in... just pick the option that best suits your taste among the hundreds of options there... they're mostly all great, Hugo really is just one option in hundreds.
- seanwilson 5y agoI didn't like Hugo template syntax at first but how complex is your logic really going to get? It generally doesn't get much more complex than "if this do that", "loop over each post", "do this for the last post only" etc.
- bbkane 5y agoThere are many options because these are personal choices. Pick a SSG that has a template language you like and has decent documentation and maybe plugins. In addition, make sure the SSG is easy to install - for example, I migrated from Jekyll to Zola because the templating language is similar and Zola is a single binary while Jekyll is a Ruby gem with C dependencies (at least it was when I tried to install it last) and I had a rough time trying to install it. For what it's worth, I like Zola, but it might not be right for you :)
- jph 5y ago
- hsn915 5y agoI appreciate the sentiment behind this but I don't think static site generators are the solution. What a static website lacks is interaction with visitors. Interaction with other people is the whole point of going on the internet. Forums and comment sections on blogs is the reason we go on the internet. It's the reason people visit HN. If you couldn't write comments, would you visit the website? Maybe you would, but a lot less frequently. For example, I don't visit the lobsters website because I can't sign up for an account so I can't participate in discussions. The problem is that setting up and maintaing a website in 2022 is quite cumbersome and tiring. No one wants to maintain a web server with the correct configuration of which versions of which applications are installed, where their configs files are, and what the contents of these configuration files are. Which is what you have to do with any of the existing solutions like Wordpress or Ghost or similar products. A website should just be a program. A program you run and it manages itself. You shouldn't have to manage it. Programs are for automating things with computers. In 2022, it's not difficult at all to write a program that does all of the following: - Be an http(s) server (listen on the http and https ports and implement the http protocol) - Manage its own data storage (database as library, not as a separate program that needs to be setup and configured separately). - Manage the acquisition and updating of certificates for https (thanks to the ACME protocol and Let's Encrypt) - Handle thousands of concurrent connections on cheap hardware (about $5/mo) without breaking a sweat - Manage its own installation. For example, the user need only run a program on his own computer, give it the IP of the server he wants to host the website on, along with root username and password, and that program will do everything necessary to setup the website program and install it on the server. It should not take more than a few seconds (less than 10 seconds, and that's being very generous with time). I'm not sure why no one is working on such a thing. It seems like a very low hanging fruit. I suspect that people look at the current landscape and see that users prefer managed solutions like Substack over self-hosted solutions like Ghost, and they conclude that no one wants to self-host their own website. I think they are wrong. No one wants to self-host using any of the existing solutions because they all suck in that you have to sort of be a sysadmin in order to self host. People think this is a fundamental properly of self-hosting and don't realize it's just a coincidence that all current solutions are like that but that things don't actually have to be that way.
- 5y ago
- ivanvas 5y ago
- shell0x 5y agoPlease don’t recommend GoDaddy. Their previous CEO killed elephants. This company supported SOPA. They literally use every trick they could come up with to fool people. It’s probably one of the least ethical domain registrars out there. Just use namecheap, name.com, gandi.net(Amazon domains uses them I think),inwx or anything more ethical.
- gzer0 5y agoSo with this setup, will Cloudflare intervene in the case of a DMCA request? If I host my domain with Njal.la, and have Cloudflare setup as in this post, I should be safe from any frivolous take-down requests, right? I'm a long time user of Cloudflare, however, when Cloudflare forwarded my personal information due to a DMCA take-down request (even though they refused to act on the actual request, forwarding my personal information was a shock); it opened my eyes to the fact that no one is immune from the bullshit that we call "DMCA".
- unsungNovelty 5y agoI started blogging after seeing a similar post by Jamie Tanna - https://www.jvt.me/posts/2019/07/22/why-website/ https://www.jvt.me/posts/2019/07/22/why-website/. I wrote something similar - https://www.unsungnovelty.org/posts/11/2019/why-do-i-host-a-website/ https://www.unsungnovelty.org/posts/11/2019/why-do-i-host-a-... And I hope somebody else will get inspired by these as well! There are a lot of personal blogs still BTW. And for those who plans to write. Creating a blog is easy. Maintaining it is the hard part. Irrespective of your experience and topics you want to share, just keeping the website and writing is hard. Do keep in mind so that you will prepare well for this. :)
- PinkPigeon 5y agoAt pinkpigeon.co.uk we created a website builder that literally just pushes Hugo-generated sites to Cloudflare. It has been working perfectly for about a year by now. We don't use CF pages, admittedly. It's workers sites, due to the ability to publish directly.
- mmcnl 5y agoStatic site generators still feel like too much work for me. I am currently hosting a blog using Ghost and couldn't be happier. Fast and simple, almost no maintenance.
- AnonHP 5y agoOP: The fly.io link at the end of the post is broken, and points to a non-existent page on your domain.
- pdyc 5y agoif you want to self host using vps, please give my tool a try as well https://github.com/newbeelearn/sserver https://github.com/newbeelearn/sserver
- desireco42 5y agoRead article / most of it. Way too complicated for not much benefit I think. Hugo can be used much more simply and I don't see why we have to use Cloudflare for simple blog. You know you can host it on Github if you want to, or anywhere else.
- nunez 5y agoHugo is friggin' awesome for developers that want a high-quality blog. I've seen some incredible websites powered by Hugo that you'd never guess were powered by it. I say "for developers" because you'll usually need to write at least some HTML and CSS overlays over the themes that Hugo makes available to do things like add analytics tags or custom footers. This is a slight hindrance for non-devs who just want to generate content. Medium or Substack work really well for this user persona. (Git is not easy to teach outside of the big three commands --- clone, commit, push. I teach engineers how to use Git amongst other things, and it gets complicated (i.e. let's talk about trees and some other CS things) to explain once you scratch slightly beneath the surface, like "what does clone/commit actually do?")
- Semiapies 5y agohttps://web.archive.org/web/20220219132205/https://smaller.fish/posts/hugo https://web.archive.org/web/20220219132205/https://smaller.f...
- minroot 5y agoNo Cloudflare.
- XCSme 5y agoI use my own basic PHP blogging platform[0], it just loads and displays markdown files from a folder. [0]: https://github.com/Cristy94/markdown-blog https://github.com/Cristy94/markdown-blog
- calltrak 5y ago
- Fnoord 5y ago> Your site isn’t innately tied to Cloudflare. If you want to move from Cloudflare in future (should they turn evil in some way, or you have another provider in mind), you need to facilitate the following: [...] I liked this part. Honest, and shows it isn't a vendor lock-in.
- TheRealNGenius 5y agoreminds me of this https://rakhim.org/images/honestly-undefined/blogging.jpg https://rakhim.org/images/honestly-undefined/blogging.jpg