Welcome to the nthState Blog, covering Swift & SwiftUI Packages, and Ideas for Xcode

DOCC is really great at generating a website for your documentation.

However, if you want to host multiple docc projects on the same domain, it's not obvious what to do.

I decided to take a look, one thing that stood out to me was the filenames all had what looked like a hash suffixed to them...which in my mind makes them unique (I'm yet to be proven wrong on this)

So I decided to merge most of the files from two project files into a new .doccarchive file.

The tool for the job is `rsync`

# Delete existing .doccarchive
rm -rf templates/AllProjects.doccarchive

# Create a working folder
mkdir templates/working_dir

# Copy most files, excluding the index and metadata.json files to the working directory
rsync -a --exclude 'index.html' --exclude 'metadata.json' templates/ProjectA.doccarchive/* templates/working_dir
rsync -a --exclude 'index.html' --exclude 'metadata.json' templates/ProjectB.doccarchive/* templates/working_dir

# Copy across the index.html file from each Archive, but give it a new name when copying
rsync templates/ProjectA.doccarchive/index.html templates/test/projectA.html
rsync templates/ProjectB.doccarchive/index.html templates/test/projectB.html

# Create a new .doccarchive folder
mv templates/working_dir templates/AllProjects.doccarchive

You can then host this on your server and point to `/documentation/ProjectA` or `/documentation/ProjectB`.

There is one current drawback I can see, the table of contents isn't unique.