im new to coding and need some help. I made a react project (using create-react-app), and the website has been running on my gh-pages branch
(heres my repo: https://github.com/simchaleh/shivisihashem.git)
ive been trying to host the gh-pages project on a custom domain instead. my react project looks great when its hosted on gh-pages, but when i try to connect it to my custom domain, all i get is a solid white screen.
heres a screen pic of my dns settings on custom domain. (u can also see that gh-pages says its hosting on my domain): dns settings and gh-pages/settings page
I have a CNAME file in gh-pages branch, with one line, where i put: shivisihashem.com
does anyone have any ideas why im just getting a blank white screen on my custom domain?
thanks!
i just got an answer from github staff. it solved my issue. heres the answer if anyone else has this same issue:
The file you need to edit is here:
https://github.com/simchaleh/shivisihashem/blob/gh-pages/index.html
Currently, these two sections have errors:
<script type="text/javascript"
> src="/ShivisiHashem/static/js/main.7cdb5ccf.js"></script>
>
> <link href="/ShivisiHashem/static/css/main.ff643f95.css"
> rel="stylesheet">
You should be able to resolve the issue by replacing them with these:
<script type="text/javascript"
> src="/static/js/main.7cdb5ccf.js"></script>
>
> <link href="/static/css/main.ff643f95.css" rel="stylesheet">
I hope that helps! Let us know if you have any other issues.
Had this same problem. I believe this issue is caused when you use the PUBLIC_URL environment variable, like so:
%PUBLIC_URL%/main.css
which works for the github.io site but causes path problems in the custom domain, which adds the variable in front of the path like in Simcha's example. So, we need to manually remove every instance of the this variable (process.env.PUBLIC_URL) each time we build for gh-pages.
来源:https://stackoverflow.com/questions/44484377/hosting-gh-pages-on-custom-domain-white-empty-page