Reputation: 3542
I have set up my professional website/homepage using Github Pages
. I know if this was just HTML
being served up from somewhere, my downloadable file would need to be in the directory of my .html
file, and then I could reference it in the .html
file and link it up. However, since this is served by Github through repository, I am unsure on how to do this.
.html
file?Also, I am aware that the Automatic Page Generator
makes it possible to hardly touch the HTML, but it seems pretty restrictive as far as customizing where links and other content appears on your page...
Upvotes: 11
Views: 16285
Reputation: 1
Since it is done in GitHub pages. It can also be done like this (in markdown fashion): [download]({{ site.baseurl }}{% link file.txt %})
. It has the advantage to work locally without pushing the file to the repo.
Upvotes: 0
Reputation: 2224
You could just link it normally in your html. Commit it to your repository and have users right click to save.
I just tried this on one of my repositories where I put a link to my CSS file.
<a href="css/style.css">style.css</a>
I was able to right click the link and download the file. If you wanted to create a download from the root you would do:
<a href="file.txt">Download File</a>
I'm pushing my repositories manually instead of using the Automatic Page Generator. The steps are pretty straight forward Creating Project Pages Manually - GitHub Help
Upvotes: 10