question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploying to GitHub Pages and using %PUBLIC_URL%

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Timercommented, Jul 13, 2017

Yes, your homepage should be www.herbertviana.com.

1reaction
aeciolevycommented, Jul 13, 2017

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/" screen shot 2017-07-13 at 8 24 02 pm

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building and publishing a web app @ github pages using ...
We want to: use ParcelJS as a building tool; have index.html as an entry point; build into dist/; have whatever is under dist/...
Read more >
Configuring a publishing source for your GitHub Pages site
Under "Build and deployment", under "Branch", use the None or Branch drop-down menu and select a publishing source. Drop-down menu to select a...
Read more >
About GitHub Pages
You can use GitHub Pages to host a website about yourself, your organization, or your project directly from a repository on GitHub.com.
Read more >
How to Create and Deploy a React.js App to Github Pages
Creating a React.js App. One of the easiest ways to create a React app is by using create-react-app. In your terminal, run the...
Read more >
Deploying Next.js to GitHub Pages - Bravo LT
Bravo LT Mobile Developer, David Crawford, shares his knowledge on how to get a Next.js website deployed to GitHub Pages.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found