Multiple contentdirs


#1

Is there any way to configure Hugo to pull content from multiple disparate locations? Here’s the scenario:

Most site content is committed to the site’s git repo, in the content directory, but I also write draft posts from a variety of different devices like my phone or iPad. I use Dropbox to sync the posts between devices.

What I’d like to do is configure Hugo to look for content in multiple places, so I can add my Dropbox/hugo_content/ folder to the list and get content from both locations during a site build. Is that possible?

I’m willing to submit a patch to Hugo itself to support this, or to write a plugin (though it looks like there’s no plugin architecture in Hugo :disappointed_relieved:) if someone can point me to the right place in the Hugo source.


#2

As far as I know Hugo allows only a single path for the content dir. But we can tackle the problem one level deeper with the file system. Simply create a symbolic link that references inside the current folder your Dropbox.


#3

Yeah I was hoping to avoid that. It’s a bit difficult to set up, especially on Windows, because AFAIK you need a separate tool like ln.exe. But if that’s what it takes I’ll try it.


#4

This is currently not possible, but it is a very good idea and should be fairly straight forward to implement.

We currently use a union file system for the static files (theme vs project), see

You should start by creating a GitHub issue tracking this, and a PR would be welcomed.


#5

I filed an issue to track (sorry for the delay): https://github.com/gohugoio/hugo/issues/3757


#6

(same comment I made on the GitHub issue… not sure where it belonged)

I’m a big believer in the KISS principle. I think Hugo should stick to one function, that is to transform source content (provided in as simply specified as possible structure of files) into a set of static web pages.

Editing or syncing source content from multiple devices should be solved elsewhere. There are many other avenues to address this. For example:

  • One each device use an editor that can write to the single contentDirs. For example there are editors on all devices that can edit GitHub files, or DropBox files. So pick one location and then choose the editors that work with that. For example on iOS you can use Editorial + WorkingCopy to edit and publish Markdown your mobile device.
  • use git inti --separate-git-dir or git clone --separate-git-dirso that your contentDir working tree is in DropBox but your repository (.git dir) is not (to avoid syncing all the repo data, and to avoid allowing DropBox sync to corrupt it.). Edits made via your mobile device will be automatically seen on your main computer, from which you can commit the changes into the repo (and push into GitHub).
  • Us a syncing tool. For example, one that pushes new content from DropBox into GitHub.

I personally use the first two options. They both work well. The first option for when I have to get something published immediately from my mobile device, and the second for when I’m simply doing authoring on my mobile device that can be published later, via my laptop.

I also think the OP’s specific use case is problematic and misguided. The whole point of using git or GitHub for the contentDir is so that the source content is all under source control with full history and change tracking.


#7

Hi everybody. I am new to this forum. Recently I went ipad-only. I would like to know if there is a way to Install Hugo on iPad and deploy markdown content to my personal website the way I did it on Mac OS before? Thanks.