GitHub Pages Symbolic Link Caveat


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:

[1]
[2]