Custom URLs for static files

I have got two files in the project directory.

static/filetype1/filetype1-file1.ext
static/filetype1/filetype1-file2.ext

Their urls need to be the following.

example.com/filetype1-file1.ext
example.com/filetype1-file2.ext

Is this possible?

In my case, ext is usually pdf, svg or png.

If you do this, nothing else in the static/ directory will be published.

config.toml

[[module.mounts]]
  source = 'static/filetype1'
  target = 'static'

If you do this, everything in the static/ directory will be published as expected, and your “filetype” files will be published to the site root and to the /filetype1 directory.

[[module.mounts]]
  source = 'static'
  target = 'static'
[[module.mounts]]
  source = 'static/filetype1'
  target = 'static'
1 Like

Does mount apply to content/ too?

https://gohugo.io/hugo-modules/configuration/#module-config-mounts

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.