You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ge...@apache.org on 2025/02/06 18:29:44 UTC
(spark) branch branch-4.0 updated: [SPARK-51104][DOC] Self-host JavaScript and CSS in Spark website
This is an automated email from the ASF dual-hosted git repository.
gengliang pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 95f2d3b20f77 [SPARK-51104][DOC] Self-host JavaScript and CSS in Spark website
95f2d3b20f77 is described below
commit 95f2d3b20f77d722fb9c0a46f360dc63128c7ab2
Author: Gengliang Wang <ge...@apache.org>
AuthorDate: Thu Feb 6 10:29:22 2025 -0800
[SPARK-51104][DOC] Self-host JavaScript and CSS in Spark website
### What changes were proposed in this pull request?
Currently, the [Spark website](https://spark.apache.org/docs/latest/) fails to load bootstrap.bundle.min.js/jquery.js/etc due to the following errors
```
Refused to load the stylesheet '<URL>' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' data:". Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.
Understand this errorAI
latest/:1 Refused to load the script 'https://cdn.jsdelivr.net/npm/bootstrap5.0.2/dist/js/bootstrap.bundle.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://analytics.apache.org/". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Understand this errorAI
latest/:1 Refused to load the script 'https://code.jquery.com/jquery.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://analytics.apache.org/". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
...
```
As a result, the website looks like:
<img width="1040" alt="image" src="https://github.com/user-attachments/assets/77898702-c0be-4898-88d7-e5f4e368dfad" />
To fix the issue, I suggest using self-host javascript and CSS in Spark website
### Why are the changes needed?
Fix the broken styling on the Spark website.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Test locally
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #49823 from gengliangwang/fixWebsite.
Authored-by: Gengliang Wang <ge...@apache.org>
Signed-off-by: Gengliang Wang <ge...@apache.org>
(cherry picked from commit e89b19f0d162ace3cda0fc4d05de0771216b69ad)
Signed-off-by: Gengliang Wang <ge...@apache.org>
---
LICENSE | 1 +
docs/_layouts/global.html | 11 ++++-------
docs/js/vendor/docsearch.min.js | 2 ++
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/LICENSE b/LICENSE
index 97f41c447434..3f987cc7cdba 100644
--- a/LICENSE
+++ b/LICENSE
@@ -247,6 +247,7 @@ core/src/main/resources/org/apache/spark/ui/static/sorttable.js
docs/js/vendor/anchor.min.js
docs/js/vendor/jquery*
docs/js/vendor/modernizer*
+docs/js/vendor/docsearch.min.js
ISC License
-----------
diff --git a/docs/_layouts/global.html b/docs/_layouts/global.html
index f5a20dd441b0..b54e16889630 100755
--- a/docs/_layouts/global.html
+++ b/docs/_layouts/global.html
@@ -22,8 +22,7 @@
{% endif %}
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
- integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
+ <link rel="stylesheet" href="{{ rel_path_to_root }}css/bootstrap.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&Courier+Prime:wght@400;700&display=swap" rel="stylesheet">
@@ -193,15 +192,13 @@
<!-- /container -->
</div>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
- integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
- crossorigin="anonymous"></script>
- <script src="https://code.jquery.com/jquery.js"></script>
+ <script src="{{ rel_path_to_root }}js/vendor/jquery-3.5.1.min.js"></script>
+ <script src="{{ rel_path_to_root }}js/vendor/bootstrap.bundle.min.js"></script>
<script src="{{ rel_path_to_root }}js/vendor/anchor.min.js"></script>
<script src="{{ rel_path_to_root}}js/main.js"></script>
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
+ <script type="text/javascript" src="{{ rel_path_to_root }}js/vendor/docsearch.min.js"></script>
<script type="text/javascript">
// DocSearch is entirely free and automated. DocSearch is built in two parts:
// 1. a crawler which we run on our own infrastructure every 24 hours. It follows every link
diff --git a/docs/js/vendor/docsearch.min.js b/docs/js/vendor/docsearch.min.js
new file mode 100644
index 000000000000..efb45b8f6f29
--- /dev/null
+++ b/docs/js/vendor/docsearch.min.js
@@ -0,0 +1,2 @@
+/*! docsearch 2.6.3 | © Algolia | github.com/algolia/docsearch */
+(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["docsearch"]=factory();else root["docsearch"]=factory()})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules [...]
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org