Reputation: 11
I am using GitHub Pages to create a static web site.
It does a great job processing links such that file1.md
becomes file1.html
in the rendered output:
For example:
[Link text](https://github.com/some-repo/some-file.md)
in the Markdown source becomes this when rendered using GitHub Pages:
<a href="https://github.com/some-repo/some-file.html">Link text</a>
Can I override this conversion somehow and link to an actual md file? In other words, output that looks like this:
<a href="http://https://github.com/some-repo/some-file.md">Link text</a>
Thanks for any insight you can lend!
I have tried embedding the HTML <a>
element in the source, but the conversion still happens.
Upvotes: 1
Views: 104
Reputation: 42176
You can get the path to a particular page (.md
file) using the page.path
variable.
That path is relative to the branch directory in your repo.
So you can link to the .md
source file using this URL:
https://github.com/YourUsername/YourRepo/blob/your-branch/{{ page.path }}
For my purposes, I use this URL:
https://github.com/KevinWorkman/HappyCoding/blob/gh-pages/{{ page.path }}
If you already know the path, then you can use that directly instead of using the page.path
variable:
https://github.com/YourUsername/YourRepo/blob/your-branch/some/path/some-file.md
Upvotes: 2