Switching From Hexo to Hugo
My first hugo blog post.
Crazy time trying to figure out differences sections, types and layouts.
Finally the dust settles, with a few compromises.
TODOs
- Need to add tags apart from just categories in the template. A nice challenge!
- Need to figure out shortcodes for youtube and fontawesome. (About us page dependent on that)
- To figure out how to publish to sahil.cc (to a separate github repo to allow https)
- Using image in Hugo
- Deciding folder and URL structure of posts
- Finalize default archetype
- Galleries in Hugo (https://github.com/liwenyip/hugo-easy-gallery)
- Copy all posts
- Fix all posts
- Copy all drafts
- Fix disqus comments in theme (TODO: postback a pull request to fix in main theme)
- Fix all drafts
- Move remaining blogs from here
- Post in all old blogs that the new blog is now sahil.cc. List here
- https://sahilahuja.wordpress.com/
- An outdated (b)log
- Net smart @ NITT!!
- Gud4Nothin
- PC Based Oscilloscope
- Pragyan Development
- Pragyan ‘08 - All applicable posts
- Is there God? - NA, no posts
And the move is officially done!
Learnings
Categorization:
Categorization of posts in happen through two concepts:
- Sections:
The 1st level folder under which a post is created in the folder “content” is the section of that post.- Type = Section by default. The type can overridden through Front Matter. Sections can’t be overridden.
- Taxonomies:
Taxonomies are user defined groupings of content. Taxonomies have to be defined in the config file except fortags
andcategories
which exist by default.
Section Structure:
There are ways to disconnect the folder structure from the URL structure in Hugo. Per post this can be accomplished through front matter named url and on a website level the following config achieves the same:
1 | [permalinks] |
However fatigue prevailed and I decided to go for a structure where there is balance between the number of brain cycles that get extinguished trying to decide where every new post needs to placed and the logical structure of posts on the website. This middle ground was the decision to use only the year in the URL.
This allows one to achieve the minimum level of segregation required at the filesystem layer, prevents the URL from looking really bad and also informs the user if the post being read is too old (going for month in this case is an overkill). This also allows for zero manipulation of the path to url conversion.
Creating new posts:
See archetypes.
Command:
1 | hugo new <content-section>/<file-name.md> |
Eg: `hugo new post/2017/switching-from-hexo-to-hugo.md`
Switching From Hexo to Hugo