9 ms·
How to start a blog using Hugo
- thomasedwards 7y agoHugo is super, but the official docs make it look a lot scarier than it is. It’s a solid static site builder with a lot of power under the hood.
- ealexhudson 7y agoI recently moved my blog over from Wordpress to Hugo. I think it must be a lot easier to start out from scratch than to migrate something existing; some parts of Hugo are substantially less than straightforward. I certainly don't regret the move - much happier having a static site than WP in place - but some of this is much more complex than I had hoped it would be. Amongst other issues; * error messages can be extremely opaque (although usually easy to google, at least) * upgrading to new versions is not always straightforward I deploy my site via rsync, but got bitten immediately by a very odd bug with respect to file timestamps (#6161) where a bunch of my files were warped back to the 1750's. I personally am happy with hugo. I probably wouldn't recommend it at this point though...
- stiray 7y agoSimilar issues from my side. Cryptic documentation, bad dissorganized forum and configuration,... I love the hugo idea but to find one detail you will get into chaos of strange wording and noise. I am using it but I try to configure as small amount as possible as I always get into some undesired behaviour. It seems like it was from begining build with idea and then continued by patch over patch over patch. Cant recomend it either.
- Moru 7y agoI decided I would make a static site the old fashioned way on neocities.org and happily got started. And then I remembered all the double work you have to do linking and making lists and repeating headers/footers (or use frames) and so on. Now I'm back to looking for some simple script that can output static sites without having to spend a month learning a new tool...
- jjjbokma 7y agoHmmm... maybe tumblelog [0]. Comes in both a Python and a Perl version (as a single script). Demo site: https://plurrrr.com/ https://plurrrr.com/ [0] https://github.com/john-bokma/tumblelog https://github.com/john-bokma/tumblelog
- deleted 7y ago[deleted]
- nkrisc 7y agoI tried a few about four years back, when I had much less web dev experience than I do today (not a professional developer). I found Jekyll to be the easiest for me. Just powerful enough to make pretty much any static site I could think of, but easy enough that even I could do it. Hosting was easy too, at the time I just FTPd everything to my provider, but I now o use rsync.
- bovermyer 7y agoI have a site like that on Tilde Town. It's much smaller than my blogs or other sites, though, so managing links and repeating code is not that big of a deal.
- japanoise 7y agoIt's a mess, and evokes abject horror in some people, but I'll continue to defend the merit of just writing a shell script. I moved it to hugo years ago (ironically) but my old site worked like that: https://github.com/japanoise/website/blob/cdf728d4ebea75cbc9a03f435d5cdfc78af8f9a5/buildsite.sh https://github.com/japanoise/website/blob/cdf728d4ebea75cbc9... It's not pretty to look at, but it can be read, understood, and maintained by one person.
- Moru 7y agoI'm pretty sure my problem with everything I tried so far was that it wasn't me building it so I guess I just have to make some simple script to do it for me some day.
- sequoia 7y ago
- StavrosK 7y agoMy main issue was how hard it was to do some simple things (or I didn't understand the documentation). I use Lektor for my site and it's been very easy to set up and use, I recommend it.
- ianmf 7y agoI like to blog to provide an online presence, but blogging for me is not that important. I cannot justify spending time in configuring and troubleshooting static site generators. I like WordPress because you can get it to work within minutes and all I have to worry about is writing content and coming up with ideas. I have a self-hosted WP instance, which conducts regular backups, and uses Let's Encrypt and auto renews monthly which I check on every 2 or 3 months to ensure everything is running correctly.
- flagpack 7y agoI am currently moving from WordPress to Hugo, so your tutorial arrived just in time. Are your posts part of the content of your ebook series? Just asking in admiration of your frequency of daily new posts.
- flaviocopes 7y agoGreat to hear! I'd say the biggest difference with WP is that you don't worry about plugins, updates, server, etc. Maybe 50% of the posts I write are included in an ebook, I try to write them as a series, so they have a double purpose. One to help if you're searching specific information, the other more organized in an ebook where I explain something from the beginning with a clear structure. Making a series that ends up in an ebook also helps with ideas of what to write about, because I define all the topics beforehand. The other 50% of the posts are individual pieces, maybe an explanation of a problem or task solved while coding, or just a description of something new I'm learning :)
- saagarjha 7y ago> It’s too easy to get trapped in making things perfectly like you want, but the important thing is the content. Where's the fun in that :)
- bar_de 7y agoHugo is a great tool. I use it with my small project's websites for easily changing the content and getting hosting for nearly free. Just adding new posts, push the repo and let the build and deployment scripts do their thing. And - don't forget - the less dynamic your site is the less attractive it becomes for the bad guys.
- ThinkBeat 7y agoI keep wanting to use Hugo, and I have made a few attempts. Moving away from Wordpress and its problems would be good. I do think a few features are missing that I find valuable: * Search (you can add it as an external service I haven't found one I trust and like yet. * Comments, there are several third-party comment providers that I can use, I tried out Disqus for a while but I didnt like nor trust them. I look at using forum software for the comments but then I have to run that and I might as well stay in WP Then there are a few plug-ins I use and like. The worst part of using WP is of course security. I have switched to fully managed WP hosting so I dont have to worry too much about that. I do still worry about plugins but my provider does not allow a lot of plug-ins due to issues and I can totally appreciate that.
- wiggler00m 7y agoGoogle custom search?
- stankot 7y agoI'm running my blog (https://muffinman.io https://muffinman.io) on Jekyll and GitHub pages, and I've run into the same issues. For search I generate a JSON array, with the name and the url to each post. Then I just client side javascript to search them. It adds a small traffic overhead, but users said they really like the search - it is instant and uses fuzzy matching algorithm. Here is the code I use to generate the array: https://github.com/Stanko/Stanko.github.io/blob/master/_includes/partials/scripts.html#L1-L10 https://github.com/Stanko/Stanko.github.io/blob/master/_incl... For comments I use staticman (https://staticman.net/ https://staticman.net/), and it is brilliant. Instead of having a 3rd party comment system, it will issue a pull request to your repo. You can set it to automatically merge PRs or to merge them manually (and moderate them). The only problem is that because of changes to the GitHub API quotas, their public instance gets overloaded. But you can easily setup your own instance. I use heroku, and their free tier is more than enough for my usecase (I get more than 100k users a year). I even wrote a short post how to set it up on heroku: https://muffinman.io/running-staticman-on-heroku/ https://muffinman.io/running-staticman-on-heroku/ Hope that helps, happy hacking!
- cluoma 7y ago
- deleted 7y ago[deleted]
- PMan74 7y agoI've a few sites on Hugo. If you're not an active developer (like me) you can deploy a site from a Netlify template and tweak from there. So pretty much the opposite of "zero to deployment" - gives you something working to start with. https://templates.netlify.com/template/hugo-starter-blog-theme-kaldi/ https://templates.netlify.com/template/hugo-starter-blog-the...
- jelger 7y agoI like the idea of static blogs. However, I didn't accomplish to find a great workflow to use hugo from my android phone while traveling. Using git on a phone is a pain
- rwmj 7y agoYes this is where I got blocked on this too. I like using the WP Android app to upload photos when travelling. Obviously a static site by its very nature cannot interact with a phone app, so this seems like a difficult/intractable problem.
- netsharc 7y agoI have the same use case and have been wondering about solutions too. I'm hosting on Netlify, and when I push to my gitlab repository, Netlify's CI fetches, builds and deploys the site. I've wondered if I can run a script somewhere that periodically checks a private Instagram account (so not my main one), and when it sees a new post, it would download the photo and caption, creates a Markdown post and pushes everything into the git repo.
- jl-gitlab 7y agoYou could potentially use a regularly scheduled pipeline in GitLab CI to do this. You'd need to use a user token instead of the pipeline token since you want to push back into the repository, but this should be possible. Then, when GitLab CI updates the repo, Netlify CI should jump in.
- kingosticks 7y agoI found an app called Teddy Hyde[0] which is designed to make this workflow easier. It's focused around Jekyll but perhaps it's flexible enough for Huge also? Ultimately I couldn't get myself to write anything regularly so I gave up with the whole idea, but the app seemed decent. [0] https://play.google.com/store/apps/details?id=com.EditorHyde.app&hl=en_US https://play.google.com/store/apps/details?id=com.EditorHyde...
- stock_toaster 7y agoI used hugo for a while, but found myself struggling against it more often than I liked. I have since moved on to using other options.
- franze 7y agoWhat other options?
- giu 7y ago(Not OP) I've been using Jekyll [0] for my personal homepage [1], and I'm very happy with it. [0] https://jekyllrb.com/ https://jekyllrb.com/ [1] http://accaputo.ch http://accaputo.ch
- devasiajoseph 7y ago(Not OP)Shameless plug: Please take a look at Wemebox CMS https://wemebox.com https://wemebox.com. I created this because I wanted a dead simple CMS for the websites I create for my clients.I believe it is much simpler than Hugo. Will be open sourcing the source code in a couple of months.
- sonar_un 7y agoI have been using Hexo for quite some time and it's very easy to use and setup. It's the node alternative to Hugo which uses Go.
- Avamander 7y agoI've been using Pelican¹ with m.css², it does math, sitemaps, RSS feeds, code, graphs and a lot other things very nicely for me. Other blog platforms are far from as powerful, what I've tried, with so little hassle. [1]: https://docs.getpelican.com/ https://docs.getpelican.com/ [2]: https://mcss.mosra.cz/ https://mcss.mosra.cz/
- stock_toaster 7y agonanoc with asciidoctor filter. I've also used pelican and Jekyll in the past, and they worked pretty well too.
- sacado2 7y agoI've been using Hugo for a few years now. Pretty long to set up if you want to addapt one of the available templates to suit your needs, but then it's really great! I would not advise it to a non-programmer/tech savvy person though.
- stilisstuk 7y agoAre Hugo really substantially better than say pelican or Nikola or all the other 'established' SSG?
- guitarbill 7y agonot really. although hugo is pretty established, too. for a personal blog, i'd just pick one and run with it. getting stuff out is more important than the "right" generator. (that said, personally, i prefer the runtime hackability of pelican, and i don't find the speed of generation to matter much under 200 posts)
- chrismorgan 7y agoYes, it is, specifically in ease of use of the static site generator itself, especially compared with a Python or Ruby one. (Node things tend to be more amenable to easily reproducible builds.) From experience, I say that installing Python or Ruby static site generators (Hyde and Jekyll specifically I have in mind) starts out markedly harder, and tends to get steadily harder over time, particularly if you don’t ride the upgrade treadmill¹, whereas the likes of Hugo (Go) and Zola (Rust) are a single binary that you just download and run, and it’ll continue to work forever, and when you switch computers you can just copy or download the binary again and it’ll still work. This difference concretely saved substantial quantities of time for redoing Fastmail’s website last year in Zola: once it genuinely was just “download Zola 0.8 from such-and-such a location and run `zola serve`”, a few people that would have given up on setting up a Jekyll or Pelican or similar environment, and instead gone with a longer “try modifying it, deploy it and see what happens” or “ask someone else to do it” approach, instead did just download the single binary and use it, because it genuinely did Just Work™. If it’s hard (here probably meaning “takes longer than five minutes of effort”) to get an editing environment going for your blog or website or whatever, you will abandon your website sooner or later, for a cause that you wouldn’t if you were using one where it was easy. So I say: prefer a single-binary for your occasionally-updated website, so that it’s your fault when you abandon it, rather than the SSG’s! ___ ¹ For example: I used Hyde for the previous iteration of my personal website, and last time I tried to spin up a fresh build environment for it, I genuinely failed—I knew what I was doing, but a couple of packages in there would no longer build. Admittedly Hyde is abandoned and you’re not likely to have quite such trouble on an actively-maintained project, but still: treadmills, and processes that you can’t be confident in.
- feistypharit 7y agoAnyone looking for a static blog but that wants a decent interface for editing, check out forestry.io. once setup, it commits to GitHub for you, your user is none the wiser. If the service ever goes away, you still have your blog in GitHub. And you can deploy anywhere (s3, netlify, etc). I use this setup for my non technical wife.
- Tepix 7y agoI think this is just what I was looking for, thanks!
- cyberferret 7y agoThe author seems adamant that blog.domain.com is a worse setup than domain.com/blog - I've seen this argument go back and forth a lot, with both sides claiming advantages and disadvantages. I am interested to hear the consensus from HN users as to which is better, and why.
- zirobi 7y agoIt's not a matter of one being objectively better than the other but which suits your needs. The basic distinction, from a purely SEO perspective, is that blog.domain.com will be treated as its own entity whereas domain.com/blog will be treated as part of the main domain.com entity. The question you have to ask yourself is whether you want to bolster the "value" of your main domain or if you want your blog to be an asset in its own right. There is no right or wrong answer — there is simply what's best for your situation.
- michaelbuckbee 7y agoObjectively better for SEO - and in particular if this isn’t a personal blog, but say a marketing site for your SAAS and then an accompanying blog. Having them in separate domains with very similar content hurts you This has been fairly well beaten into the ground at this point.
- toddmorey 7y agoI’d say objectively safer. Google is getting better at reconciling content split across subdomains as coming from a common source. Some Google experts have called it pretty much a solved problem, but I don’t think the data plays that out just yet. I do believe there will soon be a time that subdomain vs subfolder won’t matter for SEO. Just not quite there yet.
- johnchristopher 7y agoI have some reasons to prefer domain.com/thing now : - You don't have to add and manage subdomain - You don't have to stop and restart the reverse-proxy of your VPS - Only one cert to deal with (I use traefik w/ automatic LE renewal but that implied more things to set up on the chain) But I still use blog.domain.com because I find it prettier. And when I need to type it in the URL bar it's just $service<tab>.domain<tab><enter>. Now the SEO crowd has other requirements that make their choice more valid than my own (one user, one set of idiosyncrasies).
- heinrichhartman 7y agoOff-topic: Any advise on how to migrate a Jekyll blog to Hugo? Is it practical to keep the rendered HTML as static pages, and just use hugo/markdown for new posts? Migrating the markdown files to hugo looks like a pain. Header files need to be migrated. Also jekyll plugins will obviously not work. Might be better to just leave the old stuff as-is...
- concerned_user 7y agoWe did that on our project were using markdown in jekyll and kept it in hugo. Hugo has its own plugins, not that hard really. EDIT: Hugo has a plugin to import a jekyll project, you can check maybe it will do most of the work for you. Link https://gohugo.io/commands/hugo_import_jekyll/ https://gohugo.io/commands/hugo_import_jekyll/
- bjarneh 7y ago> Don’t try to be clever by using a localized domain, don’t use .io. .com just gives a better impression... https://gohugo.io https://gohugo.io - Hugo website > My suggestion is to avoid subdomains completely. https://themes.gohugo.io https://themes.gohugo.io - Hugo themes https://discourse.gohugo.io https://discourse.gohugo.io - Hugo forum Hmm
- doublerabbit 7y agoIt’s a shame there we are so whipped to .com
- robjan 7y agoThese days nobody types an address into the search bar so any TLD that's not country based should be fine. I say that because your home country is a fluid concept.
- ldoughty 7y agoIt really depends if you want them connected or not. In the Hugo example, completely agree. But sometimes it can make sense: Example.com vs members.example.com vs login.example.com Example.com can be a static website, while login attempts go to the login domain (which also helps for auth/postback config), and members might be the dynamic content that is viewable once logged in. separates infrastructure in an easy way that has no real impact on SEO
- apexalpha 7y agothe reasoning is the following: >Note on subdomains: every subdomain, to Google, is a different website. So if your domain is flaviocopes.com, and you create your blog in blog.flaviocopes.com, then that’s a completely new website to Google, and it will have its own ranking separate from the main domain. So from a SEO perspective it might make sense, if you're running a small blog and traffic is one of your main goals.
- tuesday20 7y agoThose using static site generators - how do you handle search?
- CiaranMcNulty 7y agoGoogle Search, JS solutions like lunr.js, paid options like Algolia...
- stankot 7y agoCheck my comment on this thread: https://news.ycombinator.com/item?id=21978989 https://news.ycombinator.com/item?id=21978989
- ripley12 7y agoOutsourcing it to a search engine is pretty easy. I do something like the following for DuckDuckGo: <form id="search" method="get" action="//duckduckgo.com/"> <input type="text" name="q"/> <input type="hidden" name="sites" value="mywebsite.com"> </form>
- _emacsomancer_ 7y agoAnd if you want to do it from inside Emacs/using org-mode, see: https://ox-hugo.scripter.co/ https://ox-hugo.scripter.co/
- throwaway0x77 7y agoWhen comes to static site, I found that MkDocs[1] is easier to use. I like when I use it with Material theme[2]. [1]: https://www.mkdocs.org/ https://www.mkdocs.org/ [2]: https://squidfunk.github.io/mkdocs-material/ https://squidfunk.github.io/mkdocs-material/
- NickBusey 7y agoMkDocs is great for what it was built for, documentation. I also use the Material theme myself. For a blog though, it would be a terrible format. They meet very different use cases.
- koevet 7y agoThere is no lack of technical choices when it comes to starting a blog. I can start five blogs in the next 30 minutes, each one on a different platform/infrastructure. What I do lack is something interesting to write about, in a consistent manner. I have been writing code for a long time. I did build some interesting stuff. I'm currently working on a startup that does use some blog-worthy tech: any attempt ends up with very long essay-shaped posts, which are extremely time-consuming to write and frankly not so interesting. Any suggestion on how to find a niche and consistently write about it?
- tenaciousDaniel 7y agoI'm not one to give advice, since I don't have a blog of my own. But I'd assume you want to look for an area where (a) you have a natural interest, and (b) for which there aren't a lot of existing resources online.
- sharcerer 7y agoThis might be helpful. https://www.perell.com/blog/my-writing-syllabus https://www.perell.com/blog/my-writing-syllabus Follow David Perell for writing inspiration. https://twitter.com/david_perell/status/1213894632943296516 https://twitter.com/david_perell/status/1213894632943296516
- zigzaggy 7y agoI also follow Perell and find him inspiring. Writing is a lifelong passion but since a big part of my work is writing, the flame has gone out. These days is all about relighting the fire.
- Matty1992 7y agoWrite about yourself and what you know, its probably the most interesting thing you could write about anyway. I've been preparing articles for my future blog about my interests and struggles (security, beer, books, mental health). Weird mix but theres no doubt that its more interesting than me trying to force myself to write on one of them consistently
- 7y ago
- Tepix 7y agoIs there a web-based editor that can be used together with these static site generators? This editor should be small, self-contained and secure and could be located in a separate access-restricted area of the site.
- habi 7y agoNot really in a separate access-restricted area of the site, but I use https://forestry.io/ https://forestry.io/ to update my (netlify-hosted, github-backed) blog when I don't have access to my own machine (or correct a typo from my phone).
- lowmagnet 7y agoYou could use the built-in editing suite at Github, or use something like codestar or equivalents on other platforms.
- mattlondon 7y agoI set up a small charity's site I maintain to use GitHub pages and Jekyll. The in-browser editor for markdown is good enough for the non-technical users, and GitHub pages takes care of rebuilding the site. The revision history is handy in case someone does something weird and we need to undo it. I believe that GitLab pages offers something similar that also supports Hugo, but I opted to use GitHub+Jekyll as I personally find it significantly easier to custom-build a website than with Hugo (I really struggled with on some basic stuff, e.g. I had a lot of blank pages at dir roots (e.g. /something/goes/here would have blank pages at something/ and something/goes/ etc)). Hugo feels over-complicated to me.
- Already__Taken 7y agoNetlify CMS has been impressive for me set and customize. I just wish these static sites has a smooth way to do image layouts (crop, resize, layout and picset generation). I'd give up MD for that, html+emmet is basically just as simple as markdown. * edit as for access, I gitlab pages host the static site and leave gitlab to handle the netlify cms auth part.
- newscracker 7y ago
- Kovah 7y agoI moved from WordPress to Hugo last year and dont regret it. If you search for some configuration examples for multi-language blogs and some shortcodes for image generation and so on, feel free to check out the blog post about it. https://blog.kovah.de/en/2019/static-blog-with-hugo/ https://blog.kovah.de/en/2019/static-blog-with-hugo/ Source is available on Github: https://github.com/Kovah/blog.kovah.de https://github.com/Kovah/blog.kovah.de
- heycesr 7y agoShameless plug: I built https://typehut.com https://typehut.com as a simpler alternative to classic blog and publishing systems. It's super easy to get started and it has some nice things like email subscriptions built-in. If anybody tries it out let me know!
- dablweb 7y agoI use Hugo for my website too! Highly recommend. I also put together a video tutorial of how I set up my CI/CD pipeline to deploy to AWS using Terraform. https://devbrett.com/videos/2018-07-22-static-website-terraform/ https://devbrett.com/videos/2018-07-22-static-website-terraf... The whole site costs me about 50c a month on S3 + Cloudfront.
- tkainrad 7y agoVery nice and detailed tutorial! I like also other content on your page and bookmarked your blog :) I created a similar post a while ago, might be interesting for some who want to use GitLab instead of GitHub + Netlify: https://tkainrad.dev/posts/using-hugo-gitlab-pages-and-cloudflare-to-create-and-run-this-website/ https://tkainrad.dev/posts/using-hugo-gitlab-pages-and-cloud...
- lewis1028282 7y agoI run my blog https://www.lewis8s.codes https://www.lewis8s.codes on AWS Amplify. It connects to a GitHub repo and builds it every time there is a commit to master. Uses CloudFront on the backend too. Costs me around $0.01 per build which isn't bad. Just easier than writing my own script.
- ripley12 7y agoI've been using Hugo for a few years. I like it generally, but I have mixed feelings about using Go for templating. Compilation and generation is blazing fast, which is great for short edit-compile-debug cycles. On the other hand, Go's lack of generics makes working with collections harder than it should be... and much of templating involves working with collections. To give a concrete example, I wanted to create a page where I group categories by post count. Hugo has methods to group pages, but not categories, so I rolled my own imperative grouping code. It wasn't difficult, but it would have been simpler to do declaratively in many other ecosystems (say, .NET with LINQ).