8 Hugo Modules: Plugins for everybody

 

This chapter covers

  • Using Hugo Modules for distributing and using themes
  • Adding dependencies in a theme or a website with Hugo Modules
  • Embedding template plugins to get reusable Go template code
  • Including plugins that provide configurable content

In this chapter, we will set up and utilize Hugo Modules—one of the most powerful, underrated, and underutilized features of Hugo. We have worked in isolation so far and have an independent website with no external dependency. That’s an incredible feat to have in modern-day software. Lots of poorly maintained dependencies make managing software difficult. That does not mean that we should always build our website as a monolith. There are immense advantages of splitting our site into modules that can work independently. We can then reuse the theme across multiple sites. Shortcodes, debugging utilities, and certain types of content can have a life of their own.

8.1 Setting up Hugo Modules

8.2 Themes as Hugo Modules

8.3 Importing themes

8.4 Enabling themes other than Eclectic

8.5 Getting a specific version of a theme

8.6 Viewing the dependencies source code

8.7 Modifying dependencies locally

8.8 Adding nested dependencies

8.9 Modules as template plugins

8.10 Shared dependencies across the theme and website

8.11 Content plugins

8.12 Commonly used Hugo Modules APIs

Summary