Can hugo -t params custom a directory?

such as ,hugo -t /foo/bar/theme

I want to develop theme in independent directory,not in themes.

I try use ln -s /directory themes/bar,it not work.

How can I do ?

hugo -t xxx tells Hugo to use theme xxx in your local themes directory. In otherwords, it will look in themes/xxx for files. You want to tell Hugo to use another directory for themes, so you have to add that to your config.toml file (or whichever config file your site is using):

themesDir = "/foo/bar/themes"

This is assuming that the final path you’re after is /foo/bar/themes/xxx.

Look at for a complete description of the configuration values.

EDIT: I’m wrong. I was assuming that viper.GetString("themesDir") would pick up the value from the config.toml file, but it doesn’t.

Thank you all the same

I added an issue for this. Seems to be an easy fix.

Still assuming /foo/bar/themes/xxx is the directory your theme is in:

# you have to remove the existing themes directory from your site
$ mv themes old.themes

# then create the symbolic link
$ ln -s /foo/bar/themes themes

This should allow hugo -t xxx to work.

1 Like

Thank you ,it works.