Skip to content

Deploying to GitHub Pages and using %PUBLIC_URL%  #2513

Closed
@ryanwiemer

Description

@ryanwiemer

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions