Skip to content
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

Astro in Github Pages can not correctly show css, javascript and images. #13023

Closed
1 task done
CYC241002 opened this issue Jan 21, 2025 · 3 comments
Closed
1 task done
Labels
needs repro Issue needs a reproduction

Comments

@CYC241002
Copy link

CYC241002 commented Jan 21, 2025

Astro Info

Astro                    v4.16.10
Node                     v22.13.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

site I want to build
https://cyc241002.github.io/adventure_center/

Astro Config


// https://astro.build/config
export default defineConfig({
    site: "https://cyc241002.github.io/",
    base: "/adventure_center"
});

I have read this guidance.
https://docs.astro.build/en/guides/deploy/github/

I don't know why any files lost connection.
And I have already tried anything I can do
Is this like the bug?

What's the expected result?

I should see any pictures show correctly.

Link to Minimal Reproducible Example

https://cyc241002.github.io/adventure_center/

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 21, 2025
@ematipico ematipico added the needs repro Issue needs a reproduction label Jan 21, 2025
Copy link
Contributor

Hello @CYC241002. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Jan 21, 2025
@ascorbic
Copy link
Contributor

I can't tell without a repro, but it looks like you have images like this: <img src="/img/logo.png" >. Astro won't fix URLs like that for you. You either need to prefix them yourself, e.g. change them to <img src="/adventure_center/img/logo.png" >, or store the images in src and import them. See https://docs.astro.build/en/guides/images/#where-to-store-images for details.

@ascorbic
Copy link
Contributor

I'm closing this because it is behaving as expected. In the linked site all the Astro-generated assets are loaded correctly, including CSS and JS. You just need to fix the image paths.

@ascorbic ascorbic closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants