-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploying to GitHub Pages and using %PUBLIC_URL% #2513
Comments
Have you added the |
@Timer Yes, I have the URL in the homepage field on my package.json. https://github.com/ryanwiemer/cal-factor/blob/master/package.json#L4 |
That is the correct path, as |
Great question. I suppose it doesn't matter too much. The only thing in particular that seemed to require an absolute path was the following:
I was more interested to see if something was wrong with how I was using the %PUBLIC_URL% prefix or if it was a bug. Thanks, |
Nope, you're using it correctly! We ask for the full URL but only the path matters. |
Got it. I appreciate the help! |
Hi, guys. I tried a log of things but it does not work.. If a set a custom domain in Github, should I change homepage on the package.json to my custom domain? CNAME = www.herbertviana.com |
Yes, your |
@Timer I changed the homepage but it does not work. I don't know what I can do. My domain is from GoDaddy, on CNAME www I pointed to aeciolevy.github.io I guess the the dns it is ok, because it can get the index.html file font awesome that is there too. But never get the files inside static file. |
Sorry, I didn't include the |
Yeah, it should be because of the missing |
@Timer it works, thanks a lot!!!! |
@Timer So sorry for reopening this. I have the same issue like @aeciolevy and @ryanwiemer. I added 'homepage' to my package.json already, which is I added '#' in between 'http://hauph.github.io/' and '/currency-converter' because I followed a solution in this link: https://stackoverflow.com/questions/46056414/getting-404-for-links-with-create-react-app-deployed-to-github-pages I did so and I also have 'http://' like @Timer said, but it still can not work. Do I have to change it to 'https://'? It only works after I have fixed the routes to my css, js and images in 'index.html' file and the static folder manually (hardcore way) on gh-pages branch (https://hauph.github.io/currency-converter/) What must I do to make github pages understand all the routes to my css, js and image files at the first place instead of fixing them manually on gh-pages branch? The image problem is the worst since github pages get completely wrong route. Instead of 'https://hauph.github.io/currency-converter/static/media/Loading_icon.f4404720.gif', it becomes 'https://hauph.github.io/static/media/Loading_icon.f4404720.gif', which lost the route 'currency-converter' and therefore make it unable to load the image. I am grateful for any support out there. |
I have followed the directions in the readme to successfully set up and deploy my app to GitHub Pages for a website with a custom domain. When I run
npm run deploy
it runs everything smoothly and pushes it out to the correct gh-pages branch. The one question I have is related to the%PUBLIC_URL%
prefix. It seems like those are being omitted or ignored and instead I see a relative path. Is that something I can add in a config other than in my package.json? As it stands now the following URL will not get output correctly:Example:
In public/index.html
<meta property="og:image" content="%PUBLIC_URL%/example.jpg" />
this gets output as:
<meta property="og:image" content="/example.jpg" />
Obviously I can simply "hardcode" the actual URL as an easy workaround but I was just curious as to why this was happening.
Thanks,
Ryan
The text was updated successfully, but these errors were encountered: