Fireship · @fireship

Hugo in 100 Seconds

Uploaded August 12, 2022 · Length 2:33

Hugo in 100 Seconds

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.

  1. 0:00

    hugo an open source static site

  2. 0:02

    generator famous for being the fastest

  3. 0:04

    way to render html in the world it was

  4. 0:06

    created in 2015 by steve francia and is

  5. 0:08

    made awesome today by bjorn eric

  6. 0:10

    peterson it's similar to tools like

  7. 0:12

    jekyll and eleventy but hugo is written

  8. 0:14

    in go and achieve sub millisecond

  9. 0:16

    rendering times it's fun to go fast but

  10. 0:18

    more importantly it's an extremely

  11. 0:20

    powerful content management system

  12. 0:22

    authors create content by writing

  13. 0:23

    markdown which gets rendered to html

  14. 0:25

    based on the structure of the file

  15. 0:27

    system developers use templates to

  16. 0:29

    control how the content is presented

  17. 0:30

    unlike regular html it uses go templates

  18. 0:33

    to interpolate and transform dynamic

  19. 0:35

    data from your content templates can

  20. 0:37

    define variables perform loops fetch

  21. 0:39

    remote data and all kinds of other stuff

  22. 0:41

    thanks to tons of built-in hugo

  23. 0:43

    functions these templates are organized

  24. 0:45

    into a hierarchy of layouts to minimize

  25. 0:47

    code duplication while maximizing

  26. 0:49

    flexibility and it can even manage

  27. 0:50

    relationships between content types

  28. 0:52

    thanks to its taxonomy system making it

  29. 0:54

    easy to implement menus tags and

  30. 0:57

    categories all without the need for

  31. 0:58

    third party plugins it's used on awesome

  32. 1:00

    websites like the cloudflare

  33. 1:02

    documentation smashing magazine and

  34. 1:04

    fireship io to get started install it on

  35. 1:06

    your machine then generate a new site

  36. 1:08

    create a new web page by writing

  37. 1:10

    markdown in the content directory or

  38. 1:12

    better yet use the cli to generate it

  39. 1:14

    which provides a default schema that can

  40. 1:16

    be customized in the archetypes

  41. 1:17

    directory now at this point you can

  42. 1:19

    install a theme by adding a git sub

  43. 1:21

    module to the themes directory or

  44. 1:22

    structure the html from scratch using

  45. 1:24

    layouts we might start with a default

  46. 1:26

    base of template which will be rendered

  47. 1:28

    on every page and has access to

  48. 1:30

    variables about the site like page has

  49. 1:32

    access to the front matter metadata and

  50. 1:34

    the markdown and site has access to

  51. 1:36

    global data that we might find in that

  52. 1:39

    file now within the template blocks can

  53. 1:41

    be defined that can be overridden by

  54. 1:43

    other templates for example the main

  55. 1:45

    content is entirely different on a

  56. 1:47

    single post versus a list of posts the

  57. 1:49

    single template can simply render the

  58. 1:51

    html content from the markdown the list

  59. 1:53

    template though will need to loop over a

  60. 1:56

    range of pages in that directory then

  61. 1:58

    render a truncated preview of the

  62. 1:59

    content the website will also likely