Change a huge GitHub Pages repo to use collections and linking

Before going on, let me clarify what I believe you are asking, which is that you have a page called /docs/sometopic/thedoc.markdown, and in that file, you might have a link that looks like this:

<a href='/reference.html'>Check out this reference file</a>

And you want to change the URL to look like this:
<a href='/docs/anothertopic/reference.html'>Check out this reference file</a>

Is that correct?

If so, Jekyll does not really offer an option to change a URL for you essentially. That said, @MichaelCurrin solved a similar problem (bulk changing dates in a lot of files) by using a REGEX expression in Visual Studio Code. Here is the article:

I suspect you can do something similar for your requirement, which is to set up a one-time bulk search-and-replace that uses REGEX to search for, say, /reference.html to /docs/anothertopic/reference.html.

Unfortunately, I do not have the REGEX experience to provide you with all the details here, but it seems like a decent solution. Hopefully, a filename or YAML tag or something makes it easy to know what folder to point the updated href to.

1 Like