Hugo is a very well-designed static site generator. The user experience is way better than what I have tried so far. One of the good things about Hugo is that the config file is very clean! Also, the installation is easy, version controlling it is quite simple, and it’s easy to share the source code and let people create post PR!
The quickstart guide on Hugo is pretty comprehensive. Please check it out!
sudo snap install hugo
brew install hugo
hugo new site [sitename]
By default, no theme is installed, so you need to install one on your own!
cd [sitename];\
git init;\
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\
# Edit your config.toml configuration file and add the Ananke theme.
echo 'theme = "ananke"' >> config.toml
Using git submodule is a very good idea since we can keep track of the separate projects version controlled by git easily.
Add some content: hugo new posts/my-first-post.md
. Notice that the draft mode by default is true, so it won’t be published unless you change it to false.
Start the development server: hugo server -D
Open config.toml
.toml
referenceIn order to let Github Pages to parse from docs
folder:
publishDir = "docs"
to config.toml
publishDir: docs
to config.yaml
Run hugo
to build it!
Push the generated static pages to Github, and wait for Github Pages to build! Enjoy!! It’s that easy!
hugo help
git submodule init
on project root and then run git submodule update
to get the themehugo server
! You are done setting up!This theme provides searching, tagging, and lot’s of shortcodes out-of-the-box. Worth a try!
git submodule add https://github.com/vjeantet/hugo-theme-docdock.git themes/docdock
cp themes/docdock/exampleSite/config.toml .
:
cp config.toml config.toml.bak
firstconfig.toml
:
theme = "docdock"
themesdir = "../.."
_index.md
document in the content folder
_index.md
with title:
and head:
front matter!archetypes
folder:
_header.md
page in content folder. Its content is what you get in the logo placeholder (top left of the screen).terms.html
file to layouts/_default
, for the tags
and categories
summary page to be renderedCreate a custom-head.html
into a layouts/partials
folder next to the content folder, this is where we should add the javascript code in every <head>
. Paste the following code in to the file in order for MathJax and inline latex to work!
<!-- Partial intended to be overwritten to add CSS -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
Also, if you have Google Analytics tracking code, you can add it here.
Check out the result $e = mc^2$ :)