jekyll-relative-links icon indicating copy to clipboard operation
jekyll-relative-links copied to clipboard

Support relative links pointing outside of the Jekyll site?

Open hugovdm opened this issue 4 years ago • 0 comments

Problem

We have Markdown documentation for a software project. Let's call the repo directory "repo". The /docs directory in this project is served via GitHub Pages, so repo/docs/index.md is served as $user.github.io/repo/index.html

For local use and viewed on GitHub, index.md could link to source code, or other content outside of docs/: index.md could link to "../src/main.cc" for example. Currently this rewrites to $user.github.io/src/index.html

I'd love to be able to configure a Jekyll plugin to rewrite relative links that point at the parent of docs/, to rather point at https://github.com/$user/repo/tree/master or https://github.com/$user/repo/tree/$selected_release_tag

Preferred solution

I'd love to configure Jeyll Relative Links to indicate what URL I wish it to consider to be the parent of docs/ - perhaps if I tell it the parent of docs/ should be considered to be http://example.com/foo/bar/baz/, it could even handle grandparent (.../foo/bar/) or great-grandparent (.../foo/) of docs.

Alternative solution

  • If this feels too out of scope for Jekyll Relative Links, it might need to be a different plugin?
  • I've considered creating a new repo for $user, called $src, so that I can serve a simple html redirect page on $user.github.io/src/ - but I think I'd need a page for every page I want to redirect, I don't think I can set up a redirect for the whole tree.

hugovdm avatar Mar 07 '21 10:03 hugovdm