Fireship · @fireship
Hugo in 100 Seconds
Uploaded August 12, 2022 · Length 2:33
Summary
hugo tutorial: fast static site generator for web development
- hugo tutorial
- static site generator
- web development
- go programming language
- content management system
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
hugo an open source static site
- 0:02
generator famous for being the fastest
- 0:04
way to render html in the world it was
- 0:06
created in 2015 by steve francia and is
- 0:08
made awesome today by bjorn eric
- 0:10
peterson it's similar to tools like
- 0:12
jekyll and eleventy but hugo is written
- 0:14
in go and achieve sub millisecond
- 0:16
rendering times it's fun to go fast but
- 0:18
more importantly it's an extremely
- 0:20
powerful content management system
- 0:22
authors create content by writing
- 0:23
markdown which gets rendered to html
- 0:25
based on the structure of the file
- 0:27
system developers use templates to
- 0:29
control how the content is presented
- 0:30
unlike regular html it uses go templates
- 0:33
to interpolate and transform dynamic
- 0:35
data from your content templates can
- 0:37
define variables perform loops fetch
- 0:39
remote data and all kinds of other stuff
- 0:41
thanks to tons of built-in hugo
- 0:43
functions these templates are organized
- 0:45
into a hierarchy of layouts to minimize
- 0:47
code duplication while maximizing
- 0:49
flexibility and it can even manage
- 0:50
relationships between content types
- 0:52
thanks to its taxonomy system making it
- 0:54
easy to implement menus tags and
- 0:57
categories all without the need for
- 0:58
third party plugins it's used on awesome
- 1:00
websites like the cloudflare
- 1:02
documentation smashing magazine and
- 1:04
fireship io to get started install it on
- 1:06
your machine then generate a new site
- 1:08
create a new web page by writing
- 1:10
markdown in the content directory or
- 1:12
better yet use the cli to generate it
- 1:14
which provides a default schema that can
- 1:16
be customized in the archetypes
- 1:17
directory now at this point you can
- 1:19
install a theme by adding a git sub
- 1:21
module to the themes directory or
- 1:22
structure the html from scratch using
- 1:24
layouts we might start with a default
- 1:26
base of template which will be rendered
- 1:28
on every page and has access to
- 1:30
variables about the site like page has
- 1:32
access to the front matter metadata and
- 1:34
the markdown and site has access to
- 1:36
global data that we might find in that
- 1:39
file now within the template blocks can
- 1:41
be defined that can be overridden by
- 1:43
other templates for example the main
- 1:45
content is entirely different on a
- 1:47
single post versus a list of posts the
- 1:49
single template can simply render the
- 1:51
html content from the markdown the list
- 1:53
template though will need to loop over a
- 1:56
range of pages in that directory then
- 1:58
render a truncated preview of the
- 1:59
content the website will also likely


