In GitHub pages, absolute links are not working as expected. My goal is that all links in the document are absolute in regards to the root directory, and when rendered in GitHub pages, to have it prefix links with the project name so all absolute URLs in links work correctly (e.g. /test/page.md
to /<PROJECT_NAME>/test/page.html
. However, I'm running into issues where links from pages in subfolders are being transformed incorrectly. For example, here is a sample file structure:
index.md
doc.md
folder
index.md
doc2.md
My _config.yml
contains the following:
baseurl: "/<PROJECT_NAME>"
Inside index.md
, I have the following link: [Link Text](/folder/index.md)
. This correctly get converted to an HTML link pointing to /<PROJECT_NAME>/folder/index.html
. A link in index.md
to [Link Text](/doc.md)
also works as expected.
Inside /folder/index.md
I have [Link Text](/folder/doc2.md)
. This is incorrectly converted to /folder/doc2.md
, while it should be <PROJECT_NAME>/folder/doc2.html
. Similarly, a [Link Text](/doc.md)
is incorrectly converted to /doc.md
, while it should be /<PROJECT_NAME>/doc.html
.
In summary: absolute links are correctly translated to include the base URL in the root directly, but not in any subfolders.
Any ideas?