Skip to content

404 errors for requested js script and css stylesheet #168614

Answered by Anubhavick
ignat-ignatov asked this question in Pages
Discussion options

You must be logged in to vote

@ignat-ignatov

in your code

<link rel="stylesheet" href="/_libraries/highlightjs/styles/default.min.css">
<script src="/_libraries/highlightjs/highlight.min.js"></script>

This path works locally because the server runs at the root /, but on GitHub Pages, your site is served under:
/ignats-web-dev-experiments-sandbox-and-learning-area/

the solution for this is to Update your paths to be relative to the HTML file, or better, use a base tag or GitHub Pages-aware path.

<link rel="stylesheet" href="../../_libraries/highlightjs/styles/default.min.css">
<script src="../../_libraries/highlightjs/highlight.min.js"></script>

or Use GitHub Pages path prefix

<link rel="stylesheet" href="/ignats-web…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ignat-ignatov
Comment options

Answer selected by ignat-ignatov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pages Host a static website, right from your repo Question Ask and answer questions about GitHub features and usage
4 participants