Different repos corresponding to different sub-directories

For user.github.io, you can have different repos for different sub-directories. For example, user.github.io/dir1 can correspond to github.com/user/dir1. Can this be done for custom domains? I could not find any definitive answer, except for this StackOverflow post which suggests it is not possible.

Additionally, if it really is possible, does that mean that all those directories have to be on GitHub? If different directories are for different projects, all those projects would have to be hosted on GitHub.