Is this possible?


Following is my directory

├── assets
│ ├── icons
│ │ └── logo.svg
│ └── scss
│ └── _variables_project.scss
├── config.toml
├── content
│ └── en
│ ├── blog
│ ├── community
│ ├── docs
│ ├── featured-background.jpg
│ ├── _index.html
│ ├── logo.png
│ ├──
│ └── start.png
├── layouts
│ ├── partials
│ │ ├── community-links.html
│ │ └── hooks
├── package.json
├── package-lock.json
├── resources
│ └── _gen
│ ├── assets
│ └── images
├── static
│ ├── css
│ │ └── tabs.css
│ └── js
│ └── tabs.js
└── themes
└── docsy
├── assets
├── config.toml
├── …

The directory is under /home/hugo/ and the config.toml has the following config

contentDir = “content/en”

from inside the /home/hugo directory ran hugo as follow

hugo serve --bind= --baseURL= -p 8080 --disableFastRender --navigateToChanged --ignoreCache --buildFuture

it all works fine but is it possible to link (via HREF) to a file that is outside /home/hugo ? in my case there is a file called that
reside under /home/friendsite




You can have as many content dirs as you want, and as long as the mount is defined in the main project, it can point anywhere on the file system, e.g. “/home/foo/bar”.


So I have currently configured the config.toml as follow

source = “…/…/friendsite”
target = “static”

Tried accessing the file using the url it doesn’t work ?

The target root (static, content, data etc.) matches the “virtual folder” in Hugo, so to speak.

So if you have:

source = “…/…/friendsite”
target = “static”

And there is a file named “…/…/friendsite/logo.png” you should be able do do http://localhost:1313/logo.png and similar

Thanks @bep it works. I have another question

If I have

source = “…/…/friendsite”
target = “static”

source = “…/…/differentfriendsite”
target = “static”

and both inside the friendsite and differentfriendsite has the same filename how to differentiate them in the config ?

You need to mount them into different subdirectories, e.g:

source = “…/…/friendsite”
target = “static/friend1”
source = “…/…/differentfriendsite”
target = “static/friend2”

Thank you very much @bep

It works like a charm :slight_smile:

1 Like

@bep The file inside …/…/friendsite called has markdown like follows

title: "GVisor"
date: 2019-07-31
weight: 4
description: >
  Using addons
## gVisor Addon

but it came out as raw text (displayed as it is). Tried changing it to content/friend1 but still not showing ?


Found the following sample , tried some of the following combination to see if it works


Mount it in content if you want it processed as markdown

To understand the full powers of mounts in Hugo (which I think is a pretty unique thing for Hugo, esp. considering the recursiveness and that you can mount folders on GitHub etc.), I think it’s important to read the documentation and esp. understand the relationship between the mount target and the different component types in Hugo (static, content etc.)