Deploying to GitHub Pages and using %PUBLIC_URL%
See original GitHub issueI 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
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
Yes, your
homepage
should bewww.herbertviana.com
.Hi, guys. I deployed to GitHub Pages but it can’t load the static files, the js and css.
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
"homepage": "https://aeciolevy.github.io/HerbertBlog/"