Testing locally, linking to another repository

In my rgplantz.github.io I have an index.md file that links to another repository with [My example](./example/). I also have an index.md file in the gh-pages branch of the example repository. It works quite nicely online.

I would like to test things locally. I cloned both repositories to my computer. From within the rgplantz.github.io local directory I use bundle exec jekyll serve. The content of the index.md file in rgplantz.github.io renders very nicely at localhost:4000. But when I click on the My example link, I get a 404 error.

Is there any way to get this link to work locally like it does on the GitHub server?

If it’s a separate repository, rather than just a directory inside the same repository, then there isn’t a way to make this work locally too, no.

To get it to work locally you’d need to clone the second repository and host it using bundle exec jekyll serve, but it would also need to be served on the same port 4000, which isn’t possible if you’re running 2 separate webservers to host both repos locally.

Thank you, thomasshaped. Pretty much as I had guessed.

This is a site for two books. I’m providing both answers (text and figures) to exercises and code source. I originally thought that a good organization would be to place the code source files in the main branch and the answers in the gh-pages branch. Now I’m thinking that a better organization is to place the answers in separate directories in the primary pages repository (rgplantz.github.io) and the code sources in separate repositories. That would easier for me to work locally on the answers text.

1 Like