GitHub Pages Symbolic Link Caveat
source link: http://siongui.github.io/2017/03/30/github-pages-symlink-caveat/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
GitHub Pages Symbolic Link Caveat
March 30, 2017
GitHub Pages set Content-Type according to the name of symlink, not the file name that the symlink references to.
I have a URL of word as follows:
/browse/s/sacca
I want this url linked to /, so I make a symlink as follows:
$ cd {{root of websit}} $ mkdir -p browse/s/ $ ln -sf ../../index.html browse/s/sacca
But this does not work as expected. When I open /browse/s/sacca, my browser downloads the file instead of rendering it as HTML, because the Content-Type is not text/html.
My solution is to add a trailing slash to the URL of the word as follows:
/browse/s/sacca/
And make symlink as follows:
$ cd {{root of websit}} $ mkdir -p browse/s/sacca/ $ ln -sf ../../../index.html browse/s/sacca/index.html
I open /browse/s/sacca/, and my browser renders it as HTML!
References:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK