diff --git a/.github/workflows/pr-check-links.yaml b/.github/workflows/pr-check-links.yaml
index e3e96b09a9..63608d20d4 100644
--- a/.github/workflows/pr-check-links.yaml
+++ b/.github/workflows/pr-check-links.yaml
@@ -29,10 +29,10 @@ jobs:
cd sites/${{ matrix.site }}
npm ci
- - name: Build search script
- run: |
- cd sites/${{ matrix.site }}
- npm run build:search
+# - name: Build search script
+# run: |
+# cd sites/${{ matrix.site }}
+# npm run build:search
- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
diff --git a/.platform/applications.yaml b/.platform/applications.yaml
index 36254922aa..87b7938c60 100644
--- a/.platform/applications.yaml
+++ b/.platform/applications.yaml
@@ -31,7 +31,6 @@
./build_docs.sh
deploy: |
cd $SITE_DIR
- ./deploy.sh
bash ./marker.sh "deployed" "${SITE_DIR}"
post_deploy:
cd $SITE_DIR && bash ./marker.sh "post_deploy" "${SITE_DIR}"
@@ -61,11 +60,6 @@
Content-Type: "text/plain; charset=UTF-8"
disk: 1024
- mounts:
- "sites/platform/public/scripts/xss/dist/config":
- source: local
- source_path: "sites/platform/config"
-
size: S
- # The name of this application, which must be unique within a project.
@@ -100,7 +94,6 @@
./build_docs.sh
deploy: |
cd $SITE_DIR
- ./deploy.sh
bash ./marker.sh "deployed" "${SITE_DIR}"
post_deploy:
cd $SITE_DIR && bash ./marker.sh "post_deploy" "${SITE_DIR}"
@@ -130,9 +123,4 @@
disk: 1024
- mounts:
- "sites/upsun/public/scripts/xss/dist/config":
- source: local
- source_path: "sites/upsun/config"
-
size: S
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 04efe1b69a..d297e8a459 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -168,7 +168,7 @@ To ensure the docs work smoothly, a few checks run on each pull request:
npm install
# Generate necessary files
npm run dev
- npm run build:search
+# npm run build:search
# Build HTML pages to check
hugo
# Run the check
diff --git a/build_local.sh b/build_local.sh
index f5c28d826e..bc41e9d10f 100755
--- a/build_local.sh
+++ b/build_local.sh
@@ -34,7 +34,7 @@ clean_dir resources
cp ../../themes/psh-docs/postcss.config.js .
npm install
npm run build
-npm run build:search
+# npm run build:search
hugo
clear
diff --git a/cypress/e2e/search.cy.js b/cypress/e2e/search.cy.js
index f09bd8e4e5..0e4345bb34 100644
--- a/cypress/e2e/search.cy.js
+++ b/cypress/e2e/search.cy.js
@@ -1,144 +1,144 @@
-//Both should return results for "opensearch"
-//Only Upsun should return a match for "vertical scaling"
-//Only platform should return a match for "24.55 gb"
-describe("Searches",()=>{
- beforeEach(()=>{
- if('local' == Cypress.env('environment')) {
- cy.intercept("/indexes/*_docs/search*", { "hits":[] })
- }
-
- //cy.visit("/")
- })
-
- context("Search tests",()=>{
- it("Searches for something that should match in both", () => {
- cy.visit("/")
- if('local' == Cypress.env('environment')) {
- cy.intercept({
- pathname: '/indexes/*_docs/search',
- query: {
- q: 'opensearch'
- }
- },{ fixture: "opensearchresults" }).as("searchresultsopensearch")
- }
-
- cy.wait(1000)
- cy.get("#searchwicon-header").type("opensearch")
-
- if ('local' == Cypress.env('environment')) {
- cy.wait('@searchresultsopensearch')
- }
-
- cy.get("#xssroot").find("h2").as("searchresultsheader")
- cy.get("@searchresultsheader").should("exist")
- cy.get("@searchresultsheader").contains("Documentation")
- cy.get("#xssroot").find("li").contains("OpenSearch").should("exist")
-
- cy.get("#searchwicon-header").type("{enter}")
- cy.location("pathname").should(
- "eq",
- "/search.html"
- )
-
- cy.get("#xssSearchPage").find("h2").as("searchpageresults")
- cy.get("@searchpageresults").should("exist")
- cy.get("@searchpageresults").contains("Documentation")
-
- cy.get("#xssSearchPage").find("li").contains("OpenSearch").should("exist")
-
- })
-
- it("Searches for something that should not match on Platformsh, but should on Upsun", ()=>{
- const searchDetails = {
- search: 'vertical scaling',
- header: 'No results',
- body: 'No documentation matched'
- }
-
- if ('upsun' == Cypress.env('site')) {
- searchDetails.header = 'Documentation'
- searchDetails.body = searchDetails.search
- }
-
- cy.visit("/")
- cy.wait(1000)
- cy.get("#searchwicon-header").type(searchDetails.search)
- cy.get("#xssroot").find("h2").as("searchresultsheader")
- cy.get("@searchresultsheader").should("exist")
- cy.get("@searchresultsheader").contains(searchDetails.header)
- cy.get("#xssroot").find("p").contains(searchDetails.body)
-
- cy.get("#searchwicon-header").type("{enter}")
- cy.location("pathname").should(
- "eq",
- "/search.html"
- )
-
- cy.get("#xssSearchPage").find("h2").as("searchpageresults")
- cy.get("@searchpageresults").should("exist")
- if ('upsun' == Cypress.env('site')) {
- cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
- } else {
- cy.get("#xssSearchPage").contains(searchDetails.header)
- }
-
- })
-
- it("Searches for something that should ONLY match on platformsh, but not on Upsun", () => {
- const searchDetails = {
- search: 'DG3',
- header: 'No results',
- body: 'No documentation matched'
- }
-
- console.log('Current site is ' + Cypress.env('site'))
-
- if ('platformsh' == Cypress.env('site')) {
- searchDetails.header = 'Documentation'
- searchDetails.body = searchDetails.search
- }
-
- cy.visit("/")
- if('local' == Cypress.env('environment')) {
- cy.intercept({
- pathname: '/indexes/*_docs/search',
- query: {
- q: 'opensearch'
- }
- },{ fixture: "searchosresults" }).as("searchresultsopensearch")
- }
-
- //console.log('Pausing before starting')
- cy.wait(1000)
- //console.log('finished pausing')
-
- cy.get("#searchwicon-header").clear().type(searchDetails.search)
-
- if ('local' == Cypress.env('environment')) {
- cy.wait('@searchresultsopensearch')
- }
-
- cy.get("#xssroot").find("h2").as("searchresultsheader")
- cy.get("@searchresultsheader").should("exist")
- cy.get("@searchresultsheader").contains(searchDetails.header)
- cy.get('#xssroot').find('p').contains(searchDetails.body)
-
- cy.get("#searchwicon-header").type("{enter}")
- cy.location("pathname").should(
- "eq",
- "/search.html"
- )
-
- cy.get("#xssSearchPage").find("h2").as("searchpageresults")
- cy.get("@searchpageresults").should("exist")
- cy.get("@searchpageresults").contains(searchDetails.header)
-
- if ('platformsh' == Cypress.env('site')) {
- cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
- } else {
- cy.get("#xssSearchPage").contains(searchDetails.body)
- }
-
- })
- })
-})
+// //Both should return results for "opensearch"
+// //Only Upsun should return a match for "vertical scaling"
+// //Only platform should return a match for "24.55 gb"
+// describe("Searches",()=>{
+// beforeEach(()=>{
+// if('local' == Cypress.env('environment')) {
+// cy.intercept("/indexes/*_docs/search*", { "hits":[] })
+// }
+
+// //cy.visit("/")
+// })
+
+// context("Search tests",()=>{
+// it("Searches for something that should match in both", () => {
+// cy.visit("/")
+// if('local' == Cypress.env('environment')) {
+// cy.intercept({
+// pathname: '/indexes/*_docs/search',
+// query: {
+// q: 'opensearch'
+// }
+// },{ fixture: "opensearchresults" }).as("searchresultsopensearch")
+// }
+
+// cy.wait(1000)
+// cy.get("#searchwicon-header").type("opensearch")
+
+// if ('local' == Cypress.env('environment')) {
+// cy.wait('@searchresultsopensearch')
+// }
+
+// cy.get("#xssroot").find("h2").as("searchresultsheader")
+// cy.get("@searchresultsheader").should("exist")
+// cy.get("@searchresultsheader").contains("Documentation")
+// cy.get("#xssroot").find("li").contains("OpenSearch").should("exist")
+
+// cy.get("#searchwicon-header").type("{enter}")
+// cy.location("pathname").should(
+// "eq",
+// "/search.html"
+// )
+
+// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
+// cy.get("@searchpageresults").should("exist")
+// cy.get("@searchpageresults").contains("Documentation")
+
+// cy.get("#xssSearchPage").find("li").contains("OpenSearch").should("exist")
+
+// })
+
+// it("Searches for something that should not match on Platformsh, but should on Upsun", ()=>{
+// const searchDetails = {
+// search: 'vertical scaling',
+// header: 'No results',
+// body: 'No documentation matched'
+// }
+
+// if ('upsun' == Cypress.env('site')) {
+// searchDetails.header = 'Documentation'
+// searchDetails.body = searchDetails.search
+// }
+
+// cy.visit("/")
+// cy.wait(1000)
+// cy.get("#searchwicon-header").type(searchDetails.search)
+// cy.get("#xssroot").find("h2").as("searchresultsheader")
+// cy.get("@searchresultsheader").should("exist")
+// cy.get("@searchresultsheader").contains(searchDetails.header)
+// cy.get("#xssroot").find("p").contains(searchDetails.body)
+
+// cy.get("#searchwicon-header").type("{enter}")
+// cy.location("pathname").should(
+// "eq",
+// "/search.html"
+// )
+
+// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
+// cy.get("@searchpageresults").should("exist")
+// if ('upsun' == Cypress.env('site')) {
+// cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
+// } else {
+// cy.get("#xssSearchPage").contains(searchDetails.header)
+// }
+
+// })
+
+// it("Searches for something that should ONLY match on platformsh, but not on Upsun", () => {
+// const searchDetails = {
+// search: '24.55',
+// header: 'No results',
+// body: 'No documentation matched'
+// }
+
+// console.log('Current site is ' + Cypress.env('site'))
+
+// if ('platformsh' == Cypress.env('site')) {
+// searchDetails.header = 'Documentation'
+// searchDetails.body = searchDetails.search
+// }
+
+// cy.visit("/")
+// if('local' == Cypress.env('environment')) {
+// cy.intercept({
+// pathname: '/indexes/*_docs/search',
+// query: {
+// q: 'opensearch'
+// }
+// },{ fixture: "searchosresults" }).as("searchresultsopensearch")
+// }
+
+// //console.log('Pausing before starting')
+// cy.wait(1000)
+// //console.log('finished pausing')
+
+// cy.get("#searchwicon-header").clear().type(searchDetails.search)
+
+// if ('local' == Cypress.env('environment')) {
+// cy.wait('@searchresultsopensearch')
+// }
+
+// cy.get("#xssroot").find("h2").as("searchresultsheader")
+// cy.get("@searchresultsheader").should("exist")
+// cy.get("@searchresultsheader").contains(searchDetails.header)
+// cy.get('#xssroot').find('p').contains(searchDetails.body)
+
+// cy.get("#searchwicon-header").type("{enter}")
+// cy.location("pathname").should(
+// "eq",
+// "/search.html"
+// )
+
+// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
+// cy.get("@searchpageresults").should("exist")
+// cy.get("@searchpageresults").contains(searchDetails.header)
+
+// if ('platformsh' == Cypress.env('site')) {
+// cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
+// } else {
+// cy.get("#xssSearchPage").contains(searchDetails.body)
+// }
+
+// })
+// })
+// })
diff --git a/sites/platform/build_docs.sh b/sites/platform/build_docs.sh
index 5dfc4d2ffc..c35c5f7713 100755
--- a/sites/platform/build_docs.sh
+++ b/sites/platform/build_docs.sh
@@ -4,7 +4,7 @@
set -e
# Build Interface app for search/autocomplete
-npm run build:search
+# npm run build:search
# Copy templates index so it will be served for search to grab
mkdir static/files/indexes && cp ../../shared/data/templates.yaml static/files/indexes/templates.yaml
diff --git a/sites/platform/deploy.sh b/sites/platform/deploy.sh
deleted file mode 100755
index d485ac4d1f..0000000000
--- a/sites/platform/deploy.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-# Get the data
-MEILI_CONFIG_DEST=public/scripts/xss/dist/config/config.json
-
-# The index won't be built until the post_deploy hook, so we hardcode it here.
-MEILI_INDEX="platform_docs"
-
-createSearchConfig() {
- # Use the shared PLATFORM_PROJECT_ENTROPY var as MEILI_MASTER_KEY to retrieve the public key for our autocomplete app.
- MEILI_TOKEN=$(curl -s -H "Authorization: Bearer ${PLATFORM_PROJECT_ENTROPY}" -X GET "search.internal/keys" | jq -r '.results[] | select(.name | startswith("Default Search API Key")) | .key')
- # Grab the backend URL so we can complete the query string to the backend search app at runtime.
- MEILI_URL=$(echo "${PLATFORM_ROUTES}" | base64 --decode | jq -r 'to_entries[] | select(.value.id == "search") | .key')
- # Make the config file containing the above information; save it to the already build search/autocomplete React app settings.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > "${MEILI_CONFIG_DEST}"
-}
-
-createSearchConfigLocal(){
- # Get the locally exported MEILI_MASTER_KEY var. (See Readme)
- MEILI_TOKEN=$(curl -s -H "Authorization: Bearer ${MEILI_MASTER_KEY}" -X GET "http://127.0.0.1:7700/keys" | jq -r '.results[] | select(.name | startswith("Default Search API Key")) |.key')
- # Meilisearch local server default.
- MEILI_URL="http://127.0.0.1:7700/"
-
- # Make the config file to the autocomplete app in public.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > "${MEILI_CONFIG_DEST}"
- # Also copy to the local development structure.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > static/scripts/xss/dist/config/config.json
-}
-
-set -e
-
-if [ -z ${PLATFORM_APP_DIR+x} ]; then
- createSearchConfigLocal
-else
- createSearchConfig
-fi
diff --git a/sites/platform/package.json b/sites/platform/package.json
index 1de24be875..566bdc6635 100644
--- a/sites/platform/package.json
+++ b/sites/platform/package.json
@@ -53,7 +53,6 @@
"tailwindcss": "^3.2.6"
},
"workspaces": [
- "static/scripts/xss",
"../themes/psh-docs"
],
"remarkConfig": {
diff --git a/sites/platform/static/files/fetch/docsappyaml/platformsh-docs b/sites/platform/static/files/fetch/docsappyaml/platformsh-docs
index c6fe7af1f3..230bb6355c 100644
--- a/sites/platform/static/files/fetch/docsappyaml/platformsh-docs
+++ b/sites/platform/static/files/fetch/docsappyaml/platformsh-docs
@@ -28,7 +28,7 @@ hooks:
# The configuration of the application when it is exposed to the web.
web:
commands:
- # Run (404) error handler
+ # Run (404) error handler
start: node 404.js
locations:
'/':
@@ -45,9 +45,4 @@ web:
disk: 1024
-mounts:
- "public/scripts/xss/dist/config":
- source: local
- source_path: "config"
-
size: S
diff --git a/sites/platform/static/scripts/xss/.babelrc b/sites/platform/static/scripts/xss/.babelrc
deleted file mode 100644
index d2aa23c070..0000000000
--- a/sites/platform/static/scripts/xss/.babelrc
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "presets": [
- "@babel/preset-env",
- "@babel/preset-react"
- ],
- "plugins": [
- ]
-}
\ No newline at end of file
diff --git a/sites/platform/static/scripts/xss/.eslintrc.json b/sites/platform/static/scripts/xss/.eslintrc.json
deleted file mode 100644
index e43ca6b78a..0000000000
--- a/sites/platform/static/scripts/xss/.eslintrc.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "env": {
- "browser": true,
- "es6": true
- },
- "extends": "airbnb",
- "rules": {
- "semi": 0,
- "react/jsx-filename-extension": [
- 1,
- {
- "extensions": [
- ".js",
- ".jsx"
- ]
- }
- ],
- "comma-dangle": 0,
- "jsx-a11y/anchor-is-valid": 0,
- "no-return-assign": 0,
- "react/function-component-definition": [2, { "namedComponents": "arrow-function" }],
- "react/destructuring-assignment": 0
- },
- "parser": "@babel/eslint-parser",
- "settings": {
- "ecmascript": 6,
- "jsx": true,
- "import/resolver": {
- "node": {
- "moduleDirectory": [
- "node_modules",
- "src"
- ]
- },
- "webpack": {
- "config": "./webpack.config.js"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/sites/platform/static/scripts/xss/.gitignore b/sites/platform/static/scripts/xss/.gitignore
deleted file mode 100644
index f9d9b4d566..0000000000
--- a/sites/platform/static/scripts/xss/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-node_modules
-dist/bundle.js
-dist/bundle.js.LICENSE.txt
-dist/config/config.json
diff --git a/sites/platform/static/scripts/xss/.gitkeep b/sites/platform/static/scripts/xss/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/platform/static/scripts/xss/README.md b/sites/platform/static/scripts/xss/README.md
deleted file mode 100644
index fc867d21f1..0000000000
--- a/sites/platform/static/scripts/xss/README.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## Getting Started
-
-These instructions will get a copy of the project running on your local machine.
-
-### Prerequisites
-
-* Node.js
-
-```
-$ brew install node
-```
-
-* create a meilisearch read only API key (see README at root)
-
-
-Clone the repo and install dependencies:
-
-```
-$ npm install
-```
-The 'dev' script is setup to pull an API_KEY from your bash environment. Define API_KEY:
-
-```
-$ export API_KEY=yourAPIkey
-```
-
-Finally, run the app on a local server. Application will automatically launch in your default browser:
-
-```
-$ npm run dev
-```
-
diff --git a/sites/platform/static/scripts/xss/dist/.gitkeep b/sites/platform/static/scripts/xss/dist/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/platform/static/scripts/xss/dist/config/.gitkeep b/sites/platform/static/scripts/xss/dist/config/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/platform/static/scripts/xss/package.json b/sites/platform/static/scripts/xss/package.json
deleted file mode 100644
index f9db2976da..0000000000
--- a/sites/platform/static/scripts/xss/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "docs-search-input",
- "version": "1.0.1",
- "description": "A React project offering an input for search",
- "main": "index.js",
- "scripts": {
- "build": "webpack --config webpack.prod.js",
- "dev": "webpack-dev-server --config webpack.dev.js --env API_KEY=$(echo $API_KEY)",
- "lint": "eslint src"
- },
- "author": "Stefan Age",
- "license": "ISC",
- "devDependencies": {
- "@babel/core": "^7.20.12",
- "@babel/eslint-parser": "^7.19.1",
- "@babel/preset-env": "^7.20.2",
- "@babel/preset-react": "^7.18.6",
- "babel-loader": "^9.1.2",
- "css-loader": "^6.7.3",
- "eslint": "^8.34.0",
- "eslint-config-airbnb": "^19.0.4",
- "eslint-import-resolver-webpack": "^0.13.2",
- "eslint-plugin-import": "^2.27.5",
- "eslint-plugin-jsx-a11y": "^6.7.1",
- "eslint-plugin-react": "^7.32.2",
- "eslint-webpack-plugin": "^4.0.0",
- "webpack-dev-server": "^4.11.1",
- "webpack": "^5.94.0",
- "webpack-cli": "^5.0.1",
- "webpack-merge": "^5.8.0"
- },
- "dependencies": {
- "axios": "^1.7.4",
- "buffer": "^6.0.3",
- "dompurify": "^3.0.0",
- "path-browserify": "^1.0.1",
- "platformsh-config": "^2.4.1",
- "process": "^0.11.10",
- "prop-types": "^15.8.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "regenerator-runtime": "^0.13.11",
- "stream-browserify": "^3.0.0",
- "style-loader": "^3.3.1"
- }
-}
diff --git a/sites/platform/static/scripts/xss/src/App.js b/sites/platform/static/scripts/xss/src/App.js
deleted file mode 100644
index a89259015d..0000000000
--- a/sites/platform/static/scripts/xss/src/App.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react'
-
-import Search from 'containers/Search'
-
-const App = ({ fullPage }) => (
-
-
-
-)
-
-App.propTypes = {
- fullPage: PropTypes.bool,
-}
-App.defaultProps = {
- fullPage: false,
-}
-
-export default App
diff --git a/sites/platform/static/scripts/xss/src/components/Suggestions.js b/sites/platform/static/scripts/xss/src/components/Suggestions.js
deleted file mode 100644
index 1d25a88ab9..0000000000
--- a/sites/platform/static/scripts/xss/src/components/Suggestions.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react'
-import DOMPurify from 'dompurify';
-
-// This class defines the template for "secondary" search results,
-// which in this case are documents coming from
-// api.platform.sh/docs, platform.sh, community.platform.sh, and GitHub templates.
-// All secondary results are presented together in the dropdown
-// below primary results from the documentation itself.
-const Suggestions = ({ hits }) => {
- const results = hits.map((r) => (
-
-
-
-
-
-
-
-
- ))
-
- return (
-
- )
-}
-
-Suggestions.propTypes = {
- hits: PropTypes.arrayOf(
- PropTypes.shape({
- section: PropTypes.string.isRequired,
- title: PropTypes.string.isRequired
- })
- ).isRequired
-}
-
-export default Suggestions
diff --git a/sites/platform/static/scripts/xss/src/components/SuggestionsPrimary.js b/sites/platform/static/scripts/xss/src/components/SuggestionsPrimary.js
deleted file mode 100644
index 46ac438caa..0000000000
--- a/sites/platform/static/scripts/xss/src/components/SuggestionsPrimary.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import PropTypes from 'prop-types';
-import DOMPurify from 'dompurify';
-import React from 'react';
-
-// This class defines the template for primary search results,
-// which in this case are documents coming from the public documentation.
-// These results are presented in a separate section in the dropdown,
-// and prioritized as primary results via the index's `rank` attribute.
-function pushSearchResult(title, url) {
- window.dataLayer.push({
- event: 'click_search_result',
- click_name: title,
- link_url: url
- })
-}
-
-const SuggestionsPrimary = ({ hits, title }) => {
- const results = hits.map((r) => (
-
-
- {/* Add keywords if they match */}
- {/* eslint-disable-next-line no-underscore-dangle */}
- {r.keywords
- && (
-
- Keywords:
- {' '}
- {/* eslint-disable-next-line no-underscore-dangle */}
- {r._formatted.keywords.map((keyword, index, keywords) => {
- /* Sanitize and separate the keywords by commas, except the last one */
- const sanitizedKeyword = `${DOMPurify.sanitize(keyword)}${keywords.length - 1 > index ? ', ' : ''}`
- /* eslint-disable-next-line react/no-danger */
- return
- })}
-
- )}
- {/* eslint-disable-next-line no-underscore-dangle, react/no-danger */}
-
-
- ))
-
- return (
-
- )
-}
-
-SuggestionsPrimary.propTypes = {
- hits: PropTypes.arrayOf(
- PropTypes.shape({
- keywords: PropTypes.arrayOf(PropTypes.string),
- section: PropTypes.string.isRequired,
- title: PropTypes.string.isRequired,
- url: PropTypes.string.isRequired
- })
- ).isRequired,
- title: PropTypes.string.isRequired
-}
-
-export default SuggestionsPrimary
diff --git a/sites/platform/static/scripts/xss/src/containers/Search.js b/sites/platform/static/scripts/xss/src/containers/Search.js
deleted file mode 100644
index d7559c41c3..0000000000
--- a/sites/platform/static/scripts/xss/src/containers/Search.js
+++ /dev/null
@@ -1,184 +0,0 @@
-import axios from 'axios'
-import PropTypes from 'prop-types';
-import React, { useEffect, useState } from 'react'
-import regeneratorRuntime from 'regenerator-runtime'; // eslint-disable-line no-unused-vars
-
-import Suggestions from 'components/Suggestions'
-import SuggestionsPrimary from 'components/SuggestionsPrimary'
-
-const getConfig = async () => {
- // Primary configuration occurs here,
- // which allows the Search bar in docs to communicate with the Meilisearch service.
- // The `config.json` file does not exist at build time,
- // but is built later during the deploy hook when the `search` container becomes available.
- // Webpack isn't a fan of reading from `config-reader-nodejs` or environment variables
- // here if they are not yet set, but a file works just fine.
- // The mount `public/scripts/xss/dist/config` has been defined to support this.
- const response = await fetch(`/scripts/xss/dist/config/config.json?version=${Date.now().toString()}`);
- return response.json();
-}
-
-const Search = ({ fullPage }) => {
- const basicMaxResults = 7
- const [query, setQuery] = useState('')
- const [hits, setHits] = useState({
- docs: [], templates: [], community: [], website: [], apidocs: []
- })
- const [maxResults, setMaxResults] = useState(basicMaxResults)
- const [config, setConfig] = useState({
- index: '',
- public_api_key: '',
- url: ''
- })
-
- let urlQuery = fullPage ? new URLSearchParams(window.location.search).get('q') : '';
-
- // If it's the 404 page, check the URL to prepopulate the search
- if (fullPage && document.querySelector('[data-page="404"]')) {
- const url = new URL(window.location.href)
- urlQuery = url.pathname.replace('.html', '').replaceAll('/', ' ').replaceAll('-', ' ')
- }
-
- const limit = fullPage ? maxResults : 7
-
- const getInfo = (infoConfig, infoQuery) => {
- if (!Object.hasOwn(infoConfig, 'url')) {
- // eslint-disable-next-line no-param-reassign
- infoConfig = getConfig().then((value) => {
- setConfig(value)
- })
- }
- axios.get(`${infoConfig.url}indexes/${infoConfig.index}/search?attributesToCrop=text&cropLength=200&attributesToHighlight=text,keywords&q=${infoQuery}&limit=${limit}&attributesToRetrieve=title,keywords,text,url,site,section`, { params: {}, headers: { Authorization: `Bearer ${infoConfig.public_api_key}` } })
- .then(({ data }) => {
- setHits({
- docs: data.hits.filter((hit) => hit.site === 'docs'),
- templates: data.hits.filter((hit) => hit.site === 'templates'),
- community: data.hits.filter((hit) => hit.site === 'community'),
- website: data.hits.filter((hit) => hit.site === 'website'),
- apidocs: data.hits.filter((hit) => hit.site === 'apidocs'),
- })
- })
- .catch((err) => console.error(err))
- }
-
- useEffect(() => {
- getConfig().then((value) => {
- setConfig(value)
- if (!query) {
- setQuery(urlQuery)
- getInfo(value, urlQuery)
- } else {
- getInfo(value, query)
- }
- })
- }, [maxResults, urlQuery])
-
- const clearInputFunc = () => {
- setQuery('')
- }
-
- const handleInputChange = (event) => {
- const { value } = event.target
- setQuery(value);
- getInfo(config, value)
- }
-
- const handleSubmit = (event) => {
- event.preventDefault()
- if (!fullPage) {
- window.location = `${window.location.origin}/search.html?q=${query}`
- }
- }
-
- const docs = hits.docs.length > 0 ? : ''
- const templates = hits.templates.length > 0 ? : ''
- const community = hits.community.length > 0 ? : ''
- const website = hits.website.length > 0 ? : ''
- const apidocs = hits.apidocs.length > 0 ? : ''
-
- const summedSecondary = hits.community.length + hits.website.length
- + hits.apidocs.length + hits.templates.length
- const noPrimaryResults = (hits.docs.length === 0 && summedSecondary > 0) ? (
-
-
Documentation
-
No documentation matched your search, but you can try the other resources below.
-
- ) : ''
- const noResults = (hits.docs.length === 0 && summedSecondary === 0) ? (
-
-
No results
-
No documentation matched your search.
-
- ) : ''
- const secondaryResults = summedSecondary > 0 ? Other resources from Platform.sh : ''
-
- const allResults = (
-
- {noResults}
- {docs}
- {noPrimaryResults}
-
- {secondaryResults}
- {templates}
- {community}
- {website}
- {apidocs}
-
-
- )
- const noQuery = ''
-
- return (
- <>
-
- {fullPage && hits.docs.length >= (basicMaxResults - 1) && query && query.length > 1
- && (
- {
- if (maxResults === basicMaxResults) setMaxResults(200)
- else setMaxResults(basicMaxResults)
- }}
- >
- {maxResults === basicMaxResults ? 'Show all results' : 'Hide extra results'}
-
- )}
- {(query && query.length > 1) ? allResults : noQuery}
- >
- )
-}
-
-Search.propTypes = {
- fullPage: PropTypes.bool,
-}
-Search.defaultProps = {
- fullPage: false,
-}
-
-export default Search
diff --git a/sites/platform/static/scripts/xss/src/index.js b/sites/platform/static/scripts/xss/src/index.js
deleted file mode 100644
index 1fe7f159e9..0000000000
--- a/sites/platform/static/scripts/xss/src/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-
-import App from 'App'
-
-if (document.getElementById('xssroot')) {
- ReactDOM.render(
- ,
- document.getElementById('xssroot')
- )
-}
-
-if (document.getElementById('xssSearchPage')) {
- ReactDOM.render(
- ,
- document.getElementById('xssSearchPage')
- )
-}
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept(App)
-}
diff --git a/sites/platform/static/scripts/xss/webpack.common.js b/sites/platform/static/scripts/xss/webpack.common.js
deleted file mode 100644
index bedf6a68f4..0000000000
--- a/sites/platform/static/scripts/xss/webpack.common.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const path = require('path')
-const webpack = require('webpack')
-const ESLintPlugin = require('eslint-webpack-plugin');
-
-module.exports = {
- context: path.resolve(__dirname, 'src'),
- entry: ['index.js'],
- output: {
- filename: 'bundle.js',
- path: path.resolve(__dirname, 'dist'),
- publicPath: '/'
- },
- module: {
- rules: [
- { test: /\.css$/i, use: ['style-loader', 'css-loader'] },
- { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
- {
- test: /\.jpe?g$|\.ico$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
- loader: 'file-loader',
- options: {
- name: '[name].[ext]'
- }
- }
- ]
- },
- plugins: [
- new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
- new webpack.ProvidePlugin({ process: ['process'] }),
- new ESLintPlugin()
- ],
- performance: {
- hints: process.env.NODE_ENV === 'production' ? 'warning' : false
- },
- resolve: {
- modules: [
- path.join(__dirname, 'src'),
- 'node_modules'
- ],
- fallback: {
- path: require.resolve('path-browserify'),
- stream: require.resolve('stream-browserify'),
- buffer: require.resolve("buffer/"),
- }
- }
-}
diff --git a/sites/platform/static/scripts/xss/webpack.dev.js b/sites/platform/static/scripts/xss/webpack.dev.js
deleted file mode 100644
index 1257a0a2ad..0000000000
--- a/sites/platform/static/scripts/xss/webpack.dev.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const path = require('path')
-const { merge } = require('webpack-merge')
-const webpack = require('webpack')
-const common = require('./webpack.common.js')
-
-module.exports = (env) => {
- if (env.API_KEY) {
- console.log('\x1b[36m%s\x1b[0m', '\nAPI key loaded\n')
- } else {
- console.log('\x1b[33m%s\x1b[0m', '\nWarning - No API_KEY declared\n')
- }
-
- return merge(common, {
- mode: 'development',
- devServer: {
- static: path.join(__dirname, 'dist'),
- compress: true,
- historyApiFallback: true,
- hot: true,
- host: '0.0.0.0',
- open: true,
- // port: process.env.PORT,
- allowedHosts: 'all',
- },
- devtool: 'eval',
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new webpack.DefinePlugin({
- 'process.env.API_KEY': JSON.stringify(env.API_KEY)
- })
- ]
- })
-}
diff --git a/sites/platform/static/scripts/xss/webpack.prod.js b/sites/platform/static/scripts/xss/webpack.prod.js
deleted file mode 100644
index 4f7d055e57..0000000000
--- a/sites/platform/static/scripts/xss/webpack.prod.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const { merge } = require('webpack-merge');
-const common = require('./webpack.common.js');
-
-module.exports = merge(common, {
- mode: 'production'
-});
diff --git a/sites/upsun/build_docs.sh b/sites/upsun/build_docs.sh
index 125dd8ac4b..c54e3814d5 100755
--- a/sites/upsun/build_docs.sh
+++ b/sites/upsun/build_docs.sh
@@ -4,7 +4,7 @@
set -e
# Build Interface app for search/autocomplete
-npm run build:search
+# npm run build:search
# Copy templates index so it will be served for search to grab
mkdir static/files/indexes && cp ../../shared/data/templates.yaml static/files/indexes/templates.yaml
diff --git a/sites/upsun/deploy.sh b/sites/upsun/deploy.sh
deleted file mode 100755
index 7a4d395371..0000000000
--- a/sites/upsun/deploy.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-# Get the data
-MEILI_CONFIG_DEST=public/scripts/xss/dist/config/config.json
-
-# The index won't be built until the post_deploy hook, so we hardcode it here.
-MEILI_INDEX="upsun_docs"
-
-createSearchConfig() {
- # Use the shared PLATFORM_PROJECT_ENTROPY var as MEILI_MASTER_KEY to retrieve the public key for our autocomplete app.
- MEILI_TOKEN=$(curl -s -H "Authorization: Bearer ${PLATFORM_PROJECT_ENTROPY}" -X GET "search.internal/keys" | jq -r '.results[] | select(.name | startswith("Default Search API Key")) | .key')
- # Grab the backend URL so we can complete the query string to the backend search app at runtime.
- MEILI_URL=$(echo "${PLATFORM_ROUTES}" | base64 --decode | jq -r 'to_entries[] | select(.value.id == "search") | .key')
- # Make the config file containing the above information; save it to the already build search/autocomplete React app settings.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > "${MEILI_CONFIG_DEST}"
-}
-
-createSearchConfigLocal(){
- # Get the locally exported MEILI_MASTER_KEY var. (See Readme)
- MEILI_TOKEN=$(curl -s -H "Authorization: Bearer ${MEILI_MASTER_KEY}" -X GET "http://127.0.0.1:7700/keys" | jq -r '.results[] | select(.name | startswith("Default Search API Key")) |.key')
- # Meilisearch local server default.
- MEILI_URL="http://127.0.0.1:7700/"
-
- # Make the config file to the autocomplete app in public.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > "${MEILI_CONFIG_DEST}"
- # Also copy to the local development structure.
- echo $( jq -n --arg ix "${MEILI_INDEX}" --arg key "${MEILI_TOKEN}" --arg url "${MEILI_URL}" '{index: $ix, public_api_key: $key, url: $url}' ) > static/scripts/xss/dist/config/config.json
-}
-
-set -e
-
-if [ -z ${PLATFORM_APP_DIR+x} ]; then
- createSearchConfigLocal
-else
- createSearchConfig
-fi
diff --git a/sites/upsun/local_docs.sh b/sites/upsun/local_docs.sh
index a1ee6bd5fc..0a8e0a84ef 100755
--- a/sites/upsun/local_docs.sh
+++ b/sites/upsun/local_docs.sh
@@ -7,12 +7,8 @@ pwd
cd docs
npm install
npm run dev
-npm run build:search
-hugo
-
-# Export master key again in this process.
-export MEILI_MASTER_KEY=test
-./deploy.sh
+# npm run build:search
+hugo
# 2. Update the Meilisearch server.
diff --git a/sites/upsun/package.json b/sites/upsun/package.json
index 7c3892f93f..512bbeaf94 100644
--- a/sites/upsun/package.json
+++ b/sites/upsun/package.json
@@ -51,7 +51,6 @@
"tailwindcss": "^3.2.6"
},
"workspaces": [
- "static/scripts/xss",
"../themes/psh-docs"
],
"remarkConfig": {
diff --git a/sites/upsun/static/scripts/xss/.babelrc b/sites/upsun/static/scripts/xss/.babelrc
deleted file mode 100644
index d2aa23c070..0000000000
--- a/sites/upsun/static/scripts/xss/.babelrc
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "presets": [
- "@babel/preset-env",
- "@babel/preset-react"
- ],
- "plugins": [
- ]
-}
\ No newline at end of file
diff --git a/sites/upsun/static/scripts/xss/.eslintrc.json b/sites/upsun/static/scripts/xss/.eslintrc.json
deleted file mode 100644
index e43ca6b78a..0000000000
--- a/sites/upsun/static/scripts/xss/.eslintrc.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "env": {
- "browser": true,
- "es6": true
- },
- "extends": "airbnb",
- "rules": {
- "semi": 0,
- "react/jsx-filename-extension": [
- 1,
- {
- "extensions": [
- ".js",
- ".jsx"
- ]
- }
- ],
- "comma-dangle": 0,
- "jsx-a11y/anchor-is-valid": 0,
- "no-return-assign": 0,
- "react/function-component-definition": [2, { "namedComponents": "arrow-function" }],
- "react/destructuring-assignment": 0
- },
- "parser": "@babel/eslint-parser",
- "settings": {
- "ecmascript": 6,
- "jsx": true,
- "import/resolver": {
- "node": {
- "moduleDirectory": [
- "node_modules",
- "src"
- ]
- },
- "webpack": {
- "config": "./webpack.config.js"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/sites/upsun/static/scripts/xss/.gitignore b/sites/upsun/static/scripts/xss/.gitignore
deleted file mode 100644
index f9d9b4d566..0000000000
--- a/sites/upsun/static/scripts/xss/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-node_modules
-dist/bundle.js
-dist/bundle.js.LICENSE.txt
-dist/config/config.json
diff --git a/sites/upsun/static/scripts/xss/.gitkeep b/sites/upsun/static/scripts/xss/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/upsun/static/scripts/xss/README.md b/sites/upsun/static/scripts/xss/README.md
deleted file mode 100644
index fc867d21f1..0000000000
--- a/sites/upsun/static/scripts/xss/README.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## Getting Started
-
-These instructions will get a copy of the project running on your local machine.
-
-### Prerequisites
-
-* Node.js
-
-```
-$ brew install node
-```
-
-* create a meilisearch read only API key (see README at root)
-
-
-Clone the repo and install dependencies:
-
-```
-$ npm install
-```
-The 'dev' script is setup to pull an API_KEY from your bash environment. Define API_KEY:
-
-```
-$ export API_KEY=yourAPIkey
-```
-
-Finally, run the app on a local server. Application will automatically launch in your default browser:
-
-```
-$ npm run dev
-```
-
diff --git a/sites/upsun/static/scripts/xss/dist/.gitkeep b/sites/upsun/static/scripts/xss/dist/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/upsun/static/scripts/xss/dist/config/.gitkeep b/sites/upsun/static/scripts/xss/dist/config/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/sites/upsun/static/scripts/xss/package.json b/sites/upsun/static/scripts/xss/package.json
deleted file mode 100644
index a3613ae32c..0000000000
--- a/sites/upsun/static/scripts/xss/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "docs-search-input",
- "version": "1.0.1",
- "description": "A React project offering an input for search",
- "main": "index.js",
- "scripts": {
- "build": "webpack --config webpack.prod.js",
- "dev": "webpack-dev-server --config webpack.dev.js --env API_KEY=$(echo $API_KEY)",
- "lint": "eslint src"
- },
- "author": "Stefan Age",
- "license": "ISC",
- "devDependencies": {
- "@babel/core": "^7.20.12",
- "@babel/eslint-parser": "^7.19.1",
- "@babel/preset-env": "^7.20.2",
- "@babel/preset-react": "^7.18.6",
- "babel-loader": "^9.1.2",
- "css-loader": "^6.7.3",
- "eslint": "^8.34.0",
- "eslint-config-airbnb": "^19.0.4",
- "eslint-import-resolver-webpack": "^0.13.2",
- "eslint-plugin-import": "^2.27.5",
- "eslint-plugin-jsx-a11y": "^6.7.1",
- "eslint-plugin-react": "^7.32.2",
- "eslint-webpack-plugin": "^4.0.0",
- "webpack-dev-server": "^4.11.1",
- "webpack": "^5.94.0",
- "webpack-cli": "^5.0.1",
- "webpack-merge": "^5.8.0"
- },
- "dependencies": {
- "axios": "^1.7.4",
- "buffer": "^6.0.3",
- "dompurify": "^3.2.4",
- "path-browserify": "^1.0.1",
- "platformsh-config": "^2.4.1",
- "process": "^0.11.10",
- "prop-types": "^15.8.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "regenerator-runtime": "^0.13.11",
- "stream-browserify": "^3.0.0",
- "style-loader": "^3.3.1"
- }
-}
diff --git a/sites/upsun/static/scripts/xss/src/App.js b/sites/upsun/static/scripts/xss/src/App.js
deleted file mode 100644
index a89259015d..0000000000
--- a/sites/upsun/static/scripts/xss/src/App.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react'
-
-import Search from 'containers/Search'
-
-const App = ({ fullPage }) => (
-
-
-
-)
-
-App.propTypes = {
- fullPage: PropTypes.bool,
-}
-App.defaultProps = {
- fullPage: false,
-}
-
-export default App
diff --git a/sites/upsun/static/scripts/xss/src/components/Suggestions.js b/sites/upsun/static/scripts/xss/src/components/Suggestions.js
deleted file mode 100644
index 1d25a88ab9..0000000000
--- a/sites/upsun/static/scripts/xss/src/components/Suggestions.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react'
-import DOMPurify from 'dompurify';
-
-// This class defines the template for "secondary" search results,
-// which in this case are documents coming from
-// api.platform.sh/docs, platform.sh, community.platform.sh, and GitHub templates.
-// All secondary results are presented together in the dropdown
-// below primary results from the documentation itself.
-const Suggestions = ({ hits }) => {
- const results = hits.map((r) => (
-
-
-
-
-
-
-
-
- ))
-
- return (
-
- )
-}
-
-Suggestions.propTypes = {
- hits: PropTypes.arrayOf(
- PropTypes.shape({
- section: PropTypes.string.isRequired,
- title: PropTypes.string.isRequired
- })
- ).isRequired
-}
-
-export default Suggestions
diff --git a/sites/upsun/static/scripts/xss/src/components/SuggestionsPrimary.js b/sites/upsun/static/scripts/xss/src/components/SuggestionsPrimary.js
deleted file mode 100644
index 4b930f5f7c..0000000000
--- a/sites/upsun/static/scripts/xss/src/components/SuggestionsPrimary.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import PropTypes from 'prop-types';
-import DOMPurify from 'dompurify';
-import React from 'react';
-
-// This class defines the template for primary search results,
-// which in this case are documents coming from the public documentation.
-// These results are presented in a separate section in the dropdown,
-// and prioritized as primary results via the index's `rank` attribute.
-const SuggestionsPrimary = ({ hits, title }) => {
- const results = hits.map((r) => (
-
-
- {/* Add keywords if they match */}
- {/* eslint-disable-next-line no-underscore-dangle */}
- {r.keywords
- && (
-
- Keywords:
- {' '}
- {/* eslint-disable-next-line no-underscore-dangle */}
- {r._formatted.keywords.map((keyword, index, keywords) => {
- /* Sanitize and separate the keywords by commas, except the last one */
- const sanitizedKeyword = `${DOMPurify.sanitize(keyword)}${keywords.length - 1 > index ? ', ' : ''}`
- /* eslint-disable-next-line react/no-danger */
- return
- })}
-
- )}
- {/* eslint-disable-next-line no-underscore-dangle, react/no-danger */}
-
-
- ))
-
- return (
-
- )
-}
-
-SuggestionsPrimary.propTypes = {
- hits: PropTypes.arrayOf(
- PropTypes.shape({
- keywords: PropTypes.arrayOf(PropTypes.string),
- section: PropTypes.string.isRequired,
- title: PropTypes.string.isRequired,
- url: PropTypes.string.isRequired
- })
- ).isRequired,
- title: PropTypes.string.isRequired
-}
-
-export default SuggestionsPrimary
diff --git a/sites/upsun/static/scripts/xss/src/containers/Search.js b/sites/upsun/static/scripts/xss/src/containers/Search.js
deleted file mode 100644
index e1b4726fbb..0000000000
--- a/sites/upsun/static/scripts/xss/src/containers/Search.js
+++ /dev/null
@@ -1,178 +0,0 @@
-import axios from 'axios'
-import PropTypes from 'prop-types';
-import React, { useEffect, useState } from 'react'
-import regeneratorRuntime from 'regenerator-runtime'; // eslint-disable-line no-unused-vars
-
-import Suggestions from 'components/Suggestions'
-import SuggestionsPrimary from 'components/SuggestionsPrimary'
-
-const getConfig = async () => {
- // Primary configuration occurs here,
- // which allows the Search bar in docs to communicate with the Meilisearch service.
- // The `config.json` file does not exist at build time,
- // but is built later during the deploy hook when the `search` container becomes available.
- // Webpack isn't a fan of reading from `config-reader-nodejs` or environment variables
- // here if they are not yet set, but a file works just fine.
- // The mount `public/scripts/xss/dist/config` has been defined to support this.
- const response = await fetch(`/scripts/xss/dist/config/config.json?version=${Date.now().toString()}`);
- return response.json();
-}
-
-const Search = ({ fullPage }) => {
- const basicMaxResults = 7
- const [query, setQuery] = useState('')
- const [hits, setHits] = useState({
- docs: [], templates: [], community: [], website: [], apidocs: []
- })
- const [maxResults, setMaxResults] = useState(basicMaxResults)
- const [config, setConfig] = useState({
- index: '',
- public_api_key: '',
- url: ''
- })
-
- let urlQuery = fullPage ? new URLSearchParams(window.location.search).get('q') : '';
-
- // If it's the 404 page, check the URL to prepopulate the search
- if (fullPage && document.querySelector('[data-page="404"]')) {
- const url = new URL(window.location.href)
- urlQuery = url.pathname.replace('.html', '').replaceAll('/', ' ').replaceAll('-', ' ')
- }
-
- const limit = fullPage ? maxResults : 7
-
- const getInfo = (infoConfig, infoQuery) => {
- axios.get(`${infoConfig.url}indexes/${infoConfig.index}/search?attributesToCrop=text&cropLength=200&attributesToHighlight=text,keywords&q=${infoQuery}&limit=${limit}&attributesToRetrieve=title,keywords,text,url,site,section`, { params: {}, headers: { Authorization: `Bearer ${infoConfig.public_api_key}` } })
- .then(({ data }) => {
- setHits({
- docs: data.hits.filter((hit) => hit.site === 'docs'),
- templates: data.hits.filter((hit) => hit.site === 'templates'),
- community: data.hits.filter((hit) => hit.site === 'community'),
- website: data.hits.filter((hit) => hit.site === 'website'),
- apidocs: data.hits.filter((hit) => hit.site === 'apidocs'),
- })
- })
- .catch((err) => console.error(err))
- }
-
- useEffect(() => {
- getConfig().then((value) => {
- setConfig(value)
- if (!query) {
- setQuery(urlQuery)
- getInfo(value, urlQuery)
- } else {
- getInfo(value, query)
- }
- })
- }, [maxResults, urlQuery])
-
- const clearInputFunc = () => {
- setQuery('')
- }
-
- const handleInputChange = (event) => {
- const { value } = event.target
- setQuery(value);
- getInfo(config, value)
- }
-
- const handleSubmit = (event) => {
- event.preventDefault()
- if (!fullPage) {
- window.location = `${window.location.origin}/search.html?q=${query}`
- }
- }
-
- const docs = hits.docs.length > 0 ? : ''
- const templates = hits.templates.length > 0 ? : ''
- const community = hits.community.length > 0 ? : ''
- const website = hits.website.length > 0 ? : ''
- const apidocs = hits.apidocs.length > 0 ? : ''
-
- const summedSecondary = hits.community.length + hits.website.length
- + hits.apidocs.length + hits.templates.length
- const noPrimaryResults = (hits.docs.length === 0 && summedSecondary > 0) ? (
-
-
Documentation
-
No documentation matched your search, but you can try the other resources below.
-
- ) : ''
- const noResults = (hits.docs.length === 0 && summedSecondary === 0) ? (
-
-
No results
-
No documentation matched your search.
-
- ) : ''
- const secondaryResults = summedSecondary > 0 ? Other resources from Platform.sh : ''
-
- const allResults = (
-
- {noResults}
- {docs}
- {noPrimaryResults}
-
- {secondaryResults}
- {templates}
- {community}
- {website}
- {apidocs}
-
-
- )
- const noQuery = ''
-
- return (
- <>
-
- {fullPage && hits.docs.length >= (basicMaxResults - 1) && query && query.length > 1
- && (
- {
- if (maxResults === basicMaxResults) setMaxResults(200)
- else setMaxResults(basicMaxResults)
- }}
- >
- {maxResults === basicMaxResults ? 'Show all results' : 'Hide extra results'}
-
- )}
- {(query && query.length > 1) ? allResults : noQuery}
- >
- )
-}
-
-Search.propTypes = {
- fullPage: PropTypes.bool,
-}
-Search.defaultProps = {
- fullPage: false,
-}
-
-export default Search
diff --git a/sites/upsun/static/scripts/xss/src/index.js b/sites/upsun/static/scripts/xss/src/index.js
deleted file mode 100644
index 1fe7f159e9..0000000000
--- a/sites/upsun/static/scripts/xss/src/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-
-import App from 'App'
-
-if (document.getElementById('xssroot')) {
- ReactDOM.render(
- ,
- document.getElementById('xssroot')
- )
-}
-
-if (document.getElementById('xssSearchPage')) {
- ReactDOM.render(
- ,
- document.getElementById('xssSearchPage')
- )
-}
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept(App)
-}
diff --git a/sites/upsun/static/scripts/xss/webpack.common.js b/sites/upsun/static/scripts/xss/webpack.common.js
deleted file mode 100644
index bedf6a68f4..0000000000
--- a/sites/upsun/static/scripts/xss/webpack.common.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const path = require('path')
-const webpack = require('webpack')
-const ESLintPlugin = require('eslint-webpack-plugin');
-
-module.exports = {
- context: path.resolve(__dirname, 'src'),
- entry: ['index.js'],
- output: {
- filename: 'bundle.js',
- path: path.resolve(__dirname, 'dist'),
- publicPath: '/'
- },
- module: {
- rules: [
- { test: /\.css$/i, use: ['style-loader', 'css-loader'] },
- { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
- {
- test: /\.jpe?g$|\.ico$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
- loader: 'file-loader',
- options: {
- name: '[name].[ext]'
- }
- }
- ]
- },
- plugins: [
- new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
- new webpack.ProvidePlugin({ process: ['process'] }),
- new ESLintPlugin()
- ],
- performance: {
- hints: process.env.NODE_ENV === 'production' ? 'warning' : false
- },
- resolve: {
- modules: [
- path.join(__dirname, 'src'),
- 'node_modules'
- ],
- fallback: {
- path: require.resolve('path-browserify'),
- stream: require.resolve('stream-browserify'),
- buffer: require.resolve("buffer/"),
- }
- }
-}
diff --git a/sites/upsun/static/scripts/xss/webpack.dev.js b/sites/upsun/static/scripts/xss/webpack.dev.js
deleted file mode 100644
index 1257a0a2ad..0000000000
--- a/sites/upsun/static/scripts/xss/webpack.dev.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const path = require('path')
-const { merge } = require('webpack-merge')
-const webpack = require('webpack')
-const common = require('./webpack.common.js')
-
-module.exports = (env) => {
- if (env.API_KEY) {
- console.log('\x1b[36m%s\x1b[0m', '\nAPI key loaded\n')
- } else {
- console.log('\x1b[33m%s\x1b[0m', '\nWarning - No API_KEY declared\n')
- }
-
- return merge(common, {
- mode: 'development',
- devServer: {
- static: path.join(__dirname, 'dist'),
- compress: true,
- historyApiFallback: true,
- hot: true,
- host: '0.0.0.0',
- open: true,
- // port: process.env.PORT,
- allowedHosts: 'all',
- },
- devtool: 'eval',
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new webpack.DefinePlugin({
- 'process.env.API_KEY': JSON.stringify(env.API_KEY)
- })
- ]
- })
-}
diff --git a/sites/upsun/static/scripts/xss/webpack.prod.js b/sites/upsun/static/scripts/xss/webpack.prod.js
deleted file mode 100644
index 4f7d055e57..0000000000
--- a/sites/upsun/static/scripts/xss/webpack.prod.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const { merge } = require('webpack-merge');
-const common = require('./webpack.common.js');
-
-module.exports = merge(common, {
- mode: 'production'
-});
diff --git a/tests.sh b/tests.sh
index 12c73ec019..f0128d745a 100755
--- a/tests.sh
+++ b/tests.sh
@@ -12,7 +12,7 @@ pwd
npm ci
# 2. Build search script
-npm run build:search
+# npm run build:search
# 3. Build Hugo site
hugo
diff --git a/themes/psh-docs/layouts/_default/baseof.html b/themes/psh-docs/layouts/_default/baseof.html
index 743ccd4dc6..2b356e21c8 100644
--- a/themes/psh-docs/layouts/_default/baseof.html
+++ b/themes/psh-docs/layouts/_default/baseof.html
@@ -10,12 +10,12 @@
{{ partial "header/header" . }}
-
-
+
{{- block "main" . }}{{- end }}
-
-
-
{{ if .Page.Store.Get "hasMermaid" }}
diff --git a/themes/psh-docs/layouts/partials/header/search.html b/themes/psh-docs/layouts/partials/header/search.html
index 30e6359eb0..3c7cc53090 100644
--- a/themes/psh-docs/layouts/partials/header/search.html
+++ b/themes/psh-docs/layouts/partials/header/search.html
@@ -1,7 +1,7 @@
{{ if eq ( index .Site.Params.theme "use_vendor") true }}
-
+
{{ else }}
{{ end }}
diff --git a/themes/psh-docs/tailwind.config.js b/themes/psh-docs/tailwind.config.js
index 14b598502e..cacb152304 100644
--- a/themes/psh-docs/tailwind.config.js
+++ b/themes/psh-docs/tailwind.config.js
@@ -5,7 +5,6 @@ module.exports = {
"./content/**/*.{html,md}",
"../../themes/**/layouts/**/*.html",
"../../themes/**/content/**/*.{html,md}",
- "./static/scripts/xss/**/*.js"
],
safelist: ['-rotate-90','bg-pink-light'],
theme: {