I've been meaning to start blogging for a while now but I never got around to it. I do have some time this weekend and I thought I'll give it a whirl then.
I recently read about Hugo and I was wondering if it's good enough for me to start with? Has anyone used it? How has your experience been so far?
My posts will mainly focus on little programming tidbits that I learn while I'm working so yes, it will involve code snippets. Markdown support is a huge pro for me as well. I am aware of Jekyll as it's one of the biggest players in this segment but everyone's been complaining about its speed which is why I'm not leaning towards it.
If anyone's got some advice on what SSG I can use, fire away. If you can, highlight both the pros and cons so I can make an informed decision on this.
Thank you for your time! Cheers!
It's not a sexy answer, but it's practical. Just make sure you don't leave the WordPress site you use to generate static content open to the public.
I've been running my own blogs / portfolio in the last decade on static sites, from now now I'm using this new combo. Why? With the advent of the headless CMS scene static site generators just lost their unique advantage to spitting out HTML files. And meantime they didn't advance at all on the content creation side.
Creating, managing and distributing content with a CMS is far easier than with a static site generator. And when the final output is the same the choice is obvious.
Disclaimer: I'm not affiliated with HardyPress nor Wordpress, however I do create themes for Wordpress.
Notes: In my profile the first link is a statically generated site, as well as the others in the About section. The second link is a Wordpress+HardyPress combo and you can check it live the amazing speed it offers.
I've used it a little over a year ago and found things rather unintuitive when it came to setting up plugins. Not sure if it's gotten any better though. But, if you say it's practical, I'll give it another look and see if suits my needs. Thank you!
There's really no value in "static" websites, if by static you mean pure HTML and CSS. a 512MB server from vultr for $2.50/mo can host dozens of simultaneous visitors on a well-built WordPress site without any slowdown at all.
The fact that you mention it has a content-editor indicates you're not using it in a static fashion.
(Correction, I hadn't realised you could use it in a static way... I last touched WordPress back in the dark ages!)
I use it for a simple, mostly text, blog (https://kar.ai).
I also use it for an image-heavy company site (https://www.stonelandinc.com).
I also use it for 20+ other sites for clients.
It's undergoing heavy development, so that may be a pro or con, depending.
e.g. Recently they added image processing [0]. This eliminates a python script I was using for the same purpose. It's much faster as well, which matters when regenerating ~1k images.
Down side, documentation & community is still catching up on the newer features.
That unfortunately has happened to me with other static site generators (breaking changes between versions with no automatic way to resolve them or thorough documentation on the changes to make to the source).
Honestly, they were minor enough that I don't remember the specifics, and it didn't take me long to fix.
Since they're not at v1.0 yet, this is to be expected somewhat.
I do not think the blog is going to be too image heavy as I'd like to keep it simple for now but it's definitely a plus to have. Thank you! :)
-- Ghost (expensive but dead simple to apply themes) or
-- Hugo + Netflify (for hosting and automatically publishing your site when you push to your repo) + Forestry.io (for a nice front end to edit your posts if you want to avoid the command line)
I care about Markdown plus MathJax support (for math notation) and both these options support that.
Edit: ok, pricing page says „For professional bloggers“
If you're a developer and you want to just DIY - then you can. If you'd rather just pay someone else to manage the entire thing for you - then you can.
Thank you for Forestry though! Didn't know about it. Will definitely come in handy when I can't get to my personal laptop.
You push to a remote on your server, it runs the Makefile via post-receive hook and builds a single, static html file from your Markdown with Pandoc (inlineing everything, images even fonts if you want to) and copies it to the folder served by your nginx.
Here's an example of the kind of build script I use currently: https://github.com/tomhodgins/responsive.style/blob/master/s...
How would you build the contents of the /src folder with pandoc and your makefile?
Edit: for those looking for an example of the result of one of my Markdown -> Pandoc -> Git -> Static Hosting workflows, check out this page:
- Static HTML: https://responsive.style/techniques/child-element
- Markdown Source: https://raw.githubusercontent.com/tomhodgins/responsive.styl...
It's pretty similar to your shell script but builds are incremental with no extra work. I went with awk for index generation and metadata. There's still plenty of room for improvement but it does most of what I want.
It's very flexible, written in python, easy to customize, has plugins for any purpose. It supports markdown, latex, code snippets (with syntax highlighting). It's very simple to set up and you can use it for any purpose.
I've made a custom theme, configured it a bit, and served it with nginx on digital ocean(but you could also host it for free on github pages).
You can see the code and my custom theme here:
https://github.com/raymestalez/startuplab
----
Here's a few simple things I want to recommend, based on my experience:
- Immediately setup a mailchimp account and an RSS feed. Add a link in the header, and under each post (you can see how it works on my blog), you want to start build a list of followers right away.
- Ideally, write a short ebook or a guide to give people extra incentive to subscribe. The sooner you do this - the better. Here's a sexy landing page I've made for my blog to use as an example:
https://startuplab.io/free-guide
- Keep the design elegant and simple, nobody needs distracting sidebars or popups, avoid them unless absolutely necessary.
- Underneath my posts, I have 3 boxes recommending my other articles (or promoting my projects), it's a really neat way to keep people on your site.
- Don't forget to set up metadata and social images for good SEO and sharing. You can see how I did it in my template here:
https://github.com/raymestalez/startuplab/blob/master/themes...
- For a very simple commenting system I highly recommend isso:
It's really easy to setup and a pleasure to use. Although personally, I share my posts on HN/reddit, and have a link to the discussion thread automatically embedded in the post footer. That way you don't need any complex setup, and it's better for the exposure.
But then, I don't like Disqus myself. Can't imagine forcing someone else to use it. I'll think about it. Thanks for bringing this up and for everything as well!
https://begriffs.com/posts/2014-08-12-create-static-site-wit...
EDIT:
Tutorials about Hakyll: https://jaspervdj.be/hakyll/tutorials.html
- Single static binary for any platform for a static site generator; couldn't get better. - The fastest too! - The Go templating is great! It should be fairly easy to pick up by anyone knowing any programming language. I love it especially because it reminds me of Lisp. Example: {{ or (and $a $b) $c }}. (For the folks that are not a fan of Lisp, you can right the same as {{ and $a $b | or $c }}.)
Hugo has inbuilt support for Org mode. But I use more Org syntax than the inbuilt version can support. So I came up with an Emacs package that's an Org exporter backend that exports to Hugo/Blackfriday Markdown + front-matter -- ox-hugo. Folks appreciative of Emacs Org mode might want to check out the homepage https://ox-hugo.scripter.co/ "dog-fooded" by the package itself :)
I haven't used Lisp so I'm not sure of how similar they are.
Org mode support seems to be interesting. I've always wanted to pick that up as well. Could you share some good resources you might be aware of? A quick Google search led me to some really old articles. Thank you for bringing this up! I appreciate it :)
As I said, I can see the syntax to be easy to grasp for anyone knowing any coding language. But Lisp fans would be in for a treat.
In very simple terms, a list function always had the function symbol or identifier as the first element of a list (everything is a list in Lisp), and any number of arguments have to follow after that.
Example of an add function in Lisp:
(add 1 2)
The same thing in Go templates: {{ add 1 2 }}
> Org mode support seems to be interesting. I've always wanted to pick that up as well. Could you share some good resources you might be aware of?If you use Emacs, the best Org reference is the Org Info manual. Do `C-h i` to open info within Emacs and jump to the Org manual. (You probably aren't using Emacs as you mentioned that you are not familiar with Lisp. So may be this tidbit helps someone else).
If not using Emacs,
- Check out the section on Markup[1] in the official Org manual in HTML. - My blog source in Org[2] - Source of ox-hugo.scripter.co website (100% of the content) from this one Org file [3]
If you don't want to get into too much detail:
* Heading level 1
** Heading level 2, and so on
*bold* /italics/ _underline_ +strikethrough+
- list item 1
- list item 2
1. ordered list item 1
2. ordered list item 2
But if you are really getting into Org syntax, here's the mega test file[4] for ox-hugo package that exports to 100's (literally) of Hugo content posts here[5] and gets rendered to HTML by Hugo on https://ox-hugo.scripter.co/test/.The good news is that you don't have to use Emacs for Org mode, if you plan to use Org mode just like Markdown (and may be a little bit more). If you do use or end up using Emacs, then Org mode is like 1000x Markdown (or may be more :) ).
> Thank you for bringing this up! I appreciate it :)
You are welcome.
Hopefully this response wasn't too much of an information overload.
[1]: https://orgmode.org/manual/Markup.html
[2]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas...
[3]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master...
[4]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master...
[5]: https://github.com/kaushalmodi/ox-hugo/tree/master/test/site...
If all you need is a markdown-powered blog, then choose something that does only that. I use Gatsby because I'm familiar with React and it does what I need it to do.
I provide a few small businesses with simple websites to advertise their services (opening times and the like) where wordpress would have been the "traditional" choice, and the main thing I've learned from this is to stay away from loads of plugins or extra functionality until you absolutely need it - it's just more maintenance overhead and things to mess about with/configure. When I update a client site, I simply edit some text and regenerate the site - no plugins to update or config files to edit.
Absolutely correct. Unfortunately, I wouldn't trust most of my clients with a wordpress login so that's never been an option. Coming from wordpress sites that clients have installed all manner of plugins on and I have to fix every two weeks, updating some text files manually is a minor issue. I will never go back to wordpress hell.
I am looking into online editing of the content files to address this issue, but I would rather stick with making the edits myself than see a client site with 5 H1s in a page.
I'll be picking up Go as I'm unfamiliar with React and Go seems to be easy to grasp. Thank you for suggesting Gatsby though, I'll give it a shot once I learn React, which should happen this year.
GitHub pages is also a great way to get started quickly - Markdown is easy to learn and there are several cheat sheets out there.
What I did in the end is created my own very simple site generator (calling it that is probably being over generous) - it lacks many features of a full-blown generator like Hugo, but it suits me down to the ground. I then host (for free) on GitHub and publish also to neocities.org (for free). See my HN profile for link to website - from there you can pick up the source code if you're interested.
Good luck with your blogging!
Do you have your SSG up somewhere on GitHub? I'd like to give it a look. Seems to be a cool idea. Thank you for telling me about neocities. Wasn't aware of that!
Oh I really like neocities. You can sign up for pro membership and have custom domains and so on but I've not needed that so far - I may do at some point though.
All the best!
[1]: https://rootlesscontaine.rs/ [2]: https://umo.ci/ [3]: https://www.cyphar.com/
Also, you've mentioned in the sidebar that you've built it using Grav and Hugo. Would you mind explaining how you've used both? And why perhaps? Just curious because someone here suggested Grav over Hugo and you seem to be using both.
I could make one with Django (overkill, I know) as I primarily work with it but I don't have a VPS set up yet and I don't think I'm going to attempt to get one anytime soon. The main reason why I wanted a static site is to not deal with configuring and maintaining the server. Thank you!
Yup.
> I liked the second one as well. What theme is that? [...] Also, you've mentioned in the sidebar that you've built it using Grav and Hugo.
The theme is a Grav theme, ported to Hugo[1] (hence the "made with Grav and Hugo" -- the actual site is made with just Hugo). The source for the site is [2]. And the source for my other sites are here[3,4].
[1]: https://github.com/matcornic/hugo-theme-learn [2]: https://github.com/openSUSE/umoci/tree/b9e256550d732c14beeab... [3]: https://github.com/cyphar/rootlesscontaine.rs [4]: https://github.com/cyphar/cyphar.com
- Travis CI
- Cloudflare
- GitHub Pages
This is how I host my website completely for free with SSL. Whenever I commit it to GitHub it will build and deploy it for me.
What role does cloudflare play here? Just curious as I don't know what it's capable of doing.
I might end up adopting the same system as well since everyone here has been raving about Hugo. Thank you for the suggestions!
- [0] https://gohugo.io/
- [1] http://themes.gohugo.io/
- [2] https://pages.github.com/
I'm not familiar with Ruby at all as I primarily work on Django. Go has always been on my todo list so I'm mostly leaning towards that for now.
Thank you for the link! I can have a good look at all the available options :D
EDIT: typos
MVP: You need a domain name, some hosting, 1 index.html at root for the main menu of links and 1 new file for each blog post. Make the title of each file the same as the title of your post like "Whats-a-good-static-site-generator.html" and dump the files in root as you go, link them from the main menu. You can write your posts and make the files using any text editor.
Worry about the stack later once you have a few posts under your belt and understand your mid-term use case.
But start now.
I've got the domain, gonna end up hosting it on either Firebase, Netlify or GH Pages and I think I'm settling for Hugo since everyone here has spoken positively about it.
Thank you for your suggestions! :)
https://news.ycombinator.com/item?id=16346187 (89 comments)
I tried all the others and none worked for me. Had to install all these new development environments, lots of issues setting up the local servers and building sites, etc. It's not perfect and I probably would not recommend it to anyone else (no docs yet, after all), but it works for me and doesn't take too much time to throw something together if you want simplicity.
The main reason is, that I really like jupyter notebooks and my blog began as experiments in Jupyter that I wanted to somehow preserve, i.e. http://notes.asaleh.net/posts/monoid-pattern-in-python/
Second reason is, that I like to experiment with format of my posts quite often (several were made in org-mode, i.e: http://notes.asaleh.net/posts/experimenting-with-purescripts...)
But it depends on what you want. I decided I want to write. So I focused on on writing and experimenting and try not to spend too much time on setup :-)
Good luck with your blog!
After you’ve put a dozen or so posts together you’ll have a better feel for what your needs are and you can then migrate your posts to the new platform of your choice - you can even write a blog post about it :-)
You're right though. From what I can tell, most of these alternatives seem to be interoperable and I can jump around easily if need be. I'll start with hugo and see where that leads me. And I'll blog about that as well :) Great idea :D Thank you!
I'll check it out. Seems to be mature enough to give it a try. Thank you!
So, in case you need customizaton: just stick with any static site generator written in a familiar language and don't be afraid to fiddle with generation process.
Used it to build a few static sites at work and have quite enjoyed it as you get to use React.
If it's for blogging, you can also take a look at Blogger, half the programming & security blogs I follow are on it.
https://www.vox.com/2016/7/30/12303070/dennis-cooper-blog-de...
https://www.theguardian.com/music/2010/feb/11/google-deletes...
http://www.nydailynews.com/news/national/artist-loses-14-yea...
It was specifically built to help non technical people edit and compose pages. (which is not you :) )
I'm settling with Hugo as it seems to make sense for me. Thank you!
Its really different than other generators - it's a static CMS with GUI and themes. Comes with WP migrator, GitHub pages, Netlify, S3, Google cloud or sftp.
i.e. if you program mostly with python then use Restructured Text and sphinx, etc.
Why? because then you can't say you are unfamiliar with the tools when it comes time to writing docs for your project, something we all suck at doing.
Other than that I've never really understood the appeal of static site generators for normal websites or blogs that don't have millions of monthly page views.
Tools like Hugo for many common use cases (like ordinary websites with ordinary scalability requirements) often come across as a solution desperately looking for a problem while at the same time creating a few new problems: Compared with dynamic website software like WordPress they can be difficult to set up and they tend to be more difficult to use, especially for non-technical users.