-
Notifications
You must be signed in to change notification settings - Fork 335
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
Unexpected token in bootstrap-toc.js #2207
Comments
I was just able to reproduce this issue with a simple webpage, which baiscally just loads <head>
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></script>
</head>
<body></body> Replacing the link with url_pkgdown <- "https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"
url_custom <- "https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"
for (file in list.files('docs/articles', pattern = "*.html", full.names = TRUE)) {
readLines(file) %>%
sub(url_pkgdown, url_custom, ., fixed = TRUE) %>%
writeLines(file)
} |
Thanks so much! |
@maelle Thank you for this timely fix. I can confirm that my pgkgdown site no longer needs patching when it is built with pkgown@7fe9e80. Note for future readers of this issueThis bug only affects pkgdown websites which use bootstrap 5. All sites using bootstrap 3 (the default) are not affected and still work with the current CRAN version of pkgdown (2.0.6). Already deployed pkgdown websites which use bootstrap 5 need to be rebuild with the dev-version of pkgdown. To check if your package is affected, make sure to clear the browser cache using |
Thank you very much for this exceptional R package
I am currently getting javascript errors in one of my pkgdown sites which seems to break several functionalities of
pkgdown.js
.This includes (among others) the table of contents in the sidebar.
After looking closer in the chrome devtools, it seems
bootstrap-toc.js
is not properly loaded from https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js which is the cdn location from the pkgdown templatepkgdown/inst/BS5/templates/head.html
Lines 26 to 27 in d1a64f2
My browser is recieving HTML rather than JS from the cdn. Here is a screenshot where I prettified the contents of
bootstrap-toc.min.js
by hand for easier readability.Any advice on how this might happen would be very much appreciated.
The text was updated successfully, but these errors were encountered: