Include markdown files from an external repository


#1

Hi everyone,

I have a problem which I don’t know exactly how to solve. I would like to hear your suggestions or any known solution to the same problem (quick scan through the forum did not help).

So let’s say that I have markdown file(s) in a folder /doc/widgets, hosted on some Github repository, that I want to be able to include in my Hugo website. I have tried using git submodule and then symlinking .md files into the content folder, but Hugo doesn’t allow that (Error: Error building site: Cannot read symbolic link).

The problem is that markdown files are part of a different project and I want to be able to edit them there. Then I would like to tell Hugo to use those files when building a site.

So I guess my question is:
Is it possible to include a markdown file that is hosted on another Github repository into the content folder of a Hugo project? If not, are there any workarounds?


#2

Is that external project one that you have access rights?

If yes why don’t you simply symlink from the local copy of the external repo instead of the remote.


If the external repository is not one that you maintain then I am afraid that you cannot dynamically include external markdown files in a Hugo project.


#3

If you are using CI/CD you can most likely do this just git pull your repo and put the markdown files in the proper dir before hugo build as part of your deploy process.