I 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...
Similar 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.
My 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.
I 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.
The 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.
From a cloud perspective, it's easier (by a tiny bit of work) to point a subdomain to a service over pointing a folder.
E.g. blog.example.com pointing to a static website while project.example.com points to a server.
If you want both to be under the same domain and use a CDN for only one of them, you still have to configure the pass through of all others... But if it's only one subdomain, CloudFront no longer needs to know about non-Cloudfront endpoints.
I run my Hugo site on S3+CloudFront for a be penny a month (if that), despite also having a $5/month server... It protects my site from going down if one if the 5 WP sites I lazily host for friends gets directly attacked and someone pops a shell + container break out.
It'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.
As he said, a sub domain is often considered a separate domain when it comes to SEO. His other arguments about naming seems rather hand-wavy, though.
Security-wise, a subdomain can also be a different origin. Which is often positive, so a flaw in your blogging software doesn't allow someone to extract cookies or so from the main site.
I feel like x.example.com is preferred over example.com/x because it is simpler to move the files around (when you want the same app/bundle of static files to be y.example.com). Browsers by default will make <a href="/foo/bar.html"> into x.example.com/foo/bar.html when served from x.example.com, but it won't make it into example.com/x/foo/bar.html when served from example.com/x/; something else has to make sure the URLs are correct. The options available to make links work are to generate correct links in the first place (CGI back in the day provided enough information to make this possible, but modern reverse proxies have no way to convey this), never use absolute paths in links (restrictive), or to have some machinery intercept the document, parse the HTML, and rewrite links (super flaky). If you are always going to be at exmaple.com/x/ and never need to change the base URL, you can make it work. If you are making something reusable that people download and self-host, you will pull all your hair out making the /x/ case work well. Therefore, people tend to prefer the subdomain approach. It's just easier, because of an implicit base URL assumed by browsers (and even things like grpc clients). When you try to override defaults, it's like rolling a stone up an infinitely long hill. This is that, I think.
For your blog, it doesn't matter. You can hard-code the entire URL in every link and it will probably never go wrong. Applications are harder. Applications that various people are going to self-host are hardest.
What is the business justification for creating a blog on your website?
In general I would think that it is to create contents and SEO, in which case I believe that it is better to host it under the website's domain. On the other hand you may be targeting a different audience from your main site/product. For example Uber, Netflix at al have "engineering blogs" these days, which clearly have no relation to their product but perhaps rather aimed at being a recruitment tool. In such case you might want to use different domains (which incidentally is what both Uber and Netflix do).
I see people commenting on the technical aspects but the differences are minor and the business goals should be driving the decision.
If you host PHP software like phpBB on a VPS on forum.example.com and have your static website hosted on Netlify under blog.example.com, it's easier to do this with subdomains.
Of course, you can have a load balancer under example.com that acts as a reverse proxy for your forum unter example.com/forum, but the easier setup with different languages/software/servers is to use subdomains imho.
blog.domain.com is much better from a security perspective since logged-in session cookies from your main domain won't be sent in blog requests (different origin).
That provides protection for if someone manages to get a malicious script into your blog, they can't start making authenticated requests (since it isn't the same origin).
I 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.
I'm running my blog (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.
For comments I use staticman (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 use commento[1] on my site, running on my own server so no third party has access. I do not get many comments though so I don't know how it handles higher load.
Well, as long as Hugo remains a static site generator, it won't be able to support these features "out of the box". E.g. comments are simply not possible just with HTML + JS, so you'll either have to integrate a third-party service (Disqus, Staticman etc.), or move away from the "static site" concept.
There 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?
I typically write about things I want to tell people about. Maybe we had an interesting lunchtime conversation, something unusual came up, I'll read about it more and write a post.
Or maybe there's a decision I'm making: I'll write up how I'm thinking about it, where I am so far, and publish that. Often I get good feedback on these posts that makes me think about the problem differently.
I try to notice when I get ideas that would make good posts and write them down. Then, in the evening, I'll sit down, look over the ideas, and see if there's anything I feel like writing about.
Start journaling. Just keep a daily log of stuff you do, that you either think is interesting or that you want to reference later. Focus on getting the key points out succintly, writing as you go and then (quickly) editing once you have the problem all worked out. If you do this regularly, you'll get better at producing short and interesting summaries which are great blog topics.
[in my opinion] Don't write to be read. Write for you, write because you enjoy the process and the exposition helps you process and crystallise a concept. Write because you are interested and engaged.
My most popular blog post was 'deWiTTERS game loop', which ended up with plenty of links referring to it, including the "game programming patterns" book.
I wrote it because there was nothing else like it.
So if you're researching something, but have to combine various sources and figuring out stuff, because there is no easy blog post, write that easy blog post yourself.
Write 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
I used to feel such pressure as well because mostly of the current zeigeist that your blog is your platform to market yourself. This adds an enormous pressure for doing quality and interesting post as if you're attempting to publish a paper into a prestigious journal. I'm done with that. These days the main audience for my blog is myself. I like writing and I'm equally prone to write about the coffee I just had and about some clever coding thing.
We all have stories to tell. Treat your blog as a public journal. A place to organize thoughts, share ideas, it doesn't need to be longform in deep stuff. And if you end up doing longform in deep articles, just break them into a series.
What is the purpose of your blog? It heavy depends on this and your target audience.
If you do want to share things that usually end up a long essay, try to make it shorter and easy to understand. It means cut off ideas. Select only general knowledge, so that everyone can understand.
If you follow Medium.com, that’s what happens. Most of popular posts share basic knowledge. And posts with more technical details (some of them are great), often don’t get popular since less people want and understand it.
Also you can start writing random things and share it to learn what interest the audience
Anyone 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.
I'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).
I 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
I'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.
I'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.
[+] [-] ealexhudson|6 years ago|reply
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|6 years ago|reply
[+] [-] StavrosK|6 years ago|reply
[+] [-] ianmf|6 years ago|reply
[+] [-] cyberferret|6 years ago|reply
I am interested to hear the consensus from HN users as to which is better, and why.
[+] [-] ldoughty|6 years ago|reply
E.g. blog.example.com pointing to a static website while project.example.com points to a server.
If you want both to be under the same domain and use a CDN for only one of them, you still have to configure the pass through of all others... But if it's only one subdomain, CloudFront no longer needs to know about non-Cloudfront endpoints.
I run my Hugo site on S3+CloudFront for a be penny a month (if that), despite also having a $5/month server... It protects my site from going down if one if the 5 WP sites I lazily host for friends gets directly attacked and someone pops a shell + container break out.
[+] [-] zirobi|6 years ago|reply
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.
[+] [-] matsemann|6 years ago|reply
Security-wise, a subdomain can also be a different origin. Which is often positive, so a flaw in your blogging software doesn't allow someone to extract cookies or so from the main site.
[+] [-] jrockway|6 years ago|reply
For your blog, it doesn't matter. You can hard-code the entire URL in every link and it will probably never go wrong. Applications are harder. Applications that various people are going to self-host are hardest.
[+] [-] mytailorisrich|6 years ago|reply
In general I would think that it is to create contents and SEO, in which case I believe that it is better to host it under the website's domain. On the other hand you may be targeting a different audience from your main site/product. For example Uber, Netflix at al have "engineering blogs" these days, which clearly have no relation to their product but perhaps rather aimed at being a recruitment tool. In such case you might want to use different domains (which incidentally is what both Uber and Netflix do).
I see people commenting on the technical aspects but the differences are minor and the business goals should be driving the decision.
[+] [-] WA|6 years ago|reply
Of course, you can have a load balancer under example.com that acts as a reverse proxy for your forum unter example.com/forum, but the easier setup with different languages/software/servers is to use subdomains imho.
[+] [-] johnchristopher|6 years ago|reply
- 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).
[+] [-] diafygi|6 years ago|reply
That provides protection for if someone manages to get a malicious script into your blog, they can't start making authenticated requests (since it isn't the same origin).
[+] [-] Numberwang|6 years ago|reply
[deleted]
[+] [-] ThinkBeat|6 years ago|reply
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.
[+] [-] stankot|6 years ago|reply
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/_incl...
For comments I use staticman (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/
Hope that helps, happy hacking!
[+] [-] cluoma|6 years ago|reply
[1] https://gitlab.com/commento/commento
[+] [-] rob74|6 years ago|reply
[+] [-] wiggler00m|6 years ago|reply
[+] [-] koevet|6 years ago|reply
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?
[+] [-] jefftk|6 years ago|reply
Or maybe there's a decision I'm making: I'll write up how I'm thinking about it, where I am so far, and publish that. Often I get good feedback on these posts that makes me think about the problem differently.
I try to notice when I get ideas that would make good posts and write them down. Then, in the evening, I'll sit down, look over the ideas, and see if there's anything I feel like writing about.
[+] [-] sharcerer|6 years ago|reply
Follow David Perell for writing inspiration. https://twitter.com/david_perell/status/1213894632943296516
[+] [-] cloverich|6 years ago|reply
[+] [-] Ntrails|6 years ago|reply
[+] [-] koonsolo|6 years ago|reply
I wrote it because there was nothing else like it.
So if you're researching something, but have to combine various sources and figuring out stuff, because there is no easy blog post, write that easy blog post yourself.
[+] [-] Matty1992|6 years ago|reply
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
[+] [-] soapdog|6 years ago|reply
We all have stories to tell. Treat your blog as a public journal. A place to organize thoughts, share ideas, it doesn't need to be longform in deep stuff. And if you end up doing longform in deep articles, just break them into a series.
[+] [-] docuru|6 years ago|reply
If you do want to share things that usually end up a long essay, try to make it shorter and easy to understand. It means cut off ideas. Select only general knowledge, so that everyone can understand.
If you follow Medium.com, that’s what happens. Most of popular posts share basic knowledge. And posts with more technical details (some of them are great), often don’t get popular since less people want and understand it.
Also you can start writing random things and share it to learn what interest the audience
[+] [-] njacobs5074|6 years ago|reply
Just remember that when you write something, you're making an implicit promise to the reader: I will learn something new by reading your blog.
Keep them bite-sized. If it's more than 1-2 pages, probably worth turning into a series.
[+] [-] bjarneh|6 years ago|reply
https://gohugo.io - Hugo website
> My suggestion is to avoid subdomains completely.
https://themes.gohugo.io - Hugo themes
https://discourse.gohugo.io - Hugo forum
Hmm
[+] [-] feistypharit|6 years ago|reply
[+] [-] thomasedwards|6 years ago|reply
[+] [-] Tepix|6 years ago|reply
This editor should be small, self-contained and secure and could be located in a separate access-restricted area of the site.
[+] [-] _emacsomancer_|6 years ago|reply
[+] [-] ripley12|6 years ago|reply
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).
[+] [-] stock_toaster|6 years ago|reply
[+] [-] Kovah|6 years ago|reply
[+] [-] jelger|6 years ago|reply
[+] [-] PMan74|6 years ago|reply
https://templates.netlify.com/template/hugo-starter-blog-the...
[+] [-] tkainrad|6 years ago|reply
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-cloud...
[+] [-] saagarjha|6 years ago|reply
Where's the fun in that :)
[+] [-] sacado2|6 years ago|reply
I would not advise it to a non-programmer/tech savvy person though.
[+] [-] unknown|6 years ago|reply
[deleted]
[+] [-] tuesday20|6 years ago|reply
[+] [-] ripley12|6 years ago|reply
[+] [-] CiaranMcNulty|6 years ago|reply
[+] [-] stankot|6 years ago|reply
[+] [-] throwaway0x77|6 years ago|reply
[1]: https://www.mkdocs.org/ [2]: https://squidfunk.github.io/mkdocs-material/
[+] [-] NickBusey|6 years ago|reply
For a blog though, it would be a terrible format. They meet very different use cases.