wjh18 / hugo-liftoff

Minimal blog/portfolio theme with a focus on content creation and SEO best practices. An ideal choice for technical users jump-starting a personal brand.
https://hugo-liftoff.netlify.app
MIT License
93 stars 27 forks source link

Make theme a hugo module #22

Closed deining closed 1 year ago

deining commented 1 year ago

Description

This PR turns the theme into a hugo module. It also fixes a typo I spotted on the way.

Type of change

deining commented 1 year ago

Thanks, been meaning to get to modules. One small thing I'm noticing. Having two theme keys in config.toml will cause a toml error on initial server start by default.

Error: command error: failed to load config: failed to unmarshal config for path "/Users/will/tech/projects/hugo-liftoff-demo/config/_default/hugo.toml": "_stream.toml:1:1": unmarshal failed: toml: key theme is already defined

I forgot to comment out the second line, declaring the theme as module.

I would like to keep it so the site runs with the example config out of the box which means only having 1 theme field.

Yes, of course, the example site needs t run out of the box.

Also, I could be wrong about this as I haven't done enough research into modules, but I think the themes field is reserved for traditional theme config.

No. You can use the theme keyword to declare a theme as hugo module:

theme = "github.com/wjh18/hugo-liftoff"

I did this many times, I did this for your example site and it worked, too.

I did get modules to work by creating a [module] import config like so in config.toml (see docs)

[module]
[[module.imports]]
  path = 'hugo-liftoff'

That's certainly the recommended way of including hugo module(s). I added this as comment to your config.toml. Is this fine for you?