From c44c80eb271e10f1d81a87c3484e16198b0531d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Fri, 5 Dec 2025 14:27:03 +0100 Subject: [PATCH 01/12] Test algolia --- _scripts/download-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index 6afa3d27ae2..e87b899498a 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -63,12 +63,12 @@ done MASTER_MAJOR_VSN=$(( LATEST_MAJOR_VSN + 1 )) MASTER_VSN="${MASTER_MAJOR_VSN}.0" -MASTER_SHA=$(curl "${HDR[@]}" https://api.github.com/repos/erlang/otp/commits/master | jq ".sha") +MASTER_SHA=$(curl "${HDR[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links | jq ".sha") ARCHIVE="docs/otp_doc_html_${MASTER_VSN}.tar.gz" MAJOR_VSNs="${MASTER_MAJOR_VSN} ${MAJOR_VSNs}" if [ ! -f "${ARCHIVE}" ] && [ ! -f "docs/${MASTER_MAJOR_VSN}/$(_get_doc_hash "${MASTER_SHA}")" ]; then echo "Checking for ${MASTER_VSN} on github" - if curl "${HDR[@]}" "https://api.github.com/repos/erlang/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "master")][0] | .archive_download_url' | xargs curl "${HDR[@]}" > "${ARCHIVE}.zip"; then + if curl "${HDR[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl "${HDR[@]}" > "${ARCHIVE}.zip"; then unzip "${ARCHIVE}.zip" mv otp_doc_html.tar.gz "${ARCHIVE}" rm -f "${ARCHIVE}.zip" From 88d52b4ec37a5683a96823094ede4c653f0bc4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Fri, 5 Dec 2025 15:31:18 +0100 Subject: [PATCH 02/12] Test algolia --- _scripts/download-docs.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index e87b899498a..996dcb498e5 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -10,7 +10,9 @@ set -e OTP_VERSIONS_TABLE=$1 TIME_LIMIT=${3:-120m} TOKEN=${2:-"token ${GITHUB_TOKEN}"} +TEMP_TOKEN="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" HDR=(--silent --location --fail --show-error -H "Authorization: ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") +HDR2=(--silent --location --fail --show-error -H "Authorization: ${TEMP_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") # The files that are involved when generating docs SCRIPT_FILES="${OTP_VERSIONS_TABLE} _scripts/download-docs.sh _scripts/otp_flatten_docs _scripts/otp_flatten_ex_docs _scripts/otp_doc_sitemap.sh LATEST_MAJOR_VSN _scripts/otp_add_headers.sh" @@ -63,12 +65,12 @@ done MASTER_MAJOR_VSN=$(( LATEST_MAJOR_VSN + 1 )) MASTER_VSN="${MASTER_MAJOR_VSN}.0" -MASTER_SHA=$(curl "${HDR[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links | jq ".sha") +MASTER_SHA=$(curl "${HDR2[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links | jq ".sha") ARCHIVE="docs/otp_doc_html_${MASTER_VSN}.tar.gz" MAJOR_VSNs="${MASTER_MAJOR_VSN} ${MAJOR_VSNs}" if [ ! -f "${ARCHIVE}" ] && [ ! -f "docs/${MASTER_MAJOR_VSN}/$(_get_doc_hash "${MASTER_SHA}")" ]; then echo "Checking for ${MASTER_VSN} on github" - if curl "${HDR[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl "${HDR[@]}" > "${ARCHIVE}.zip"; then + if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl -v "${HDR2[@]}" > "${ARCHIVE}.zip"; then unzip "${ARCHIVE}.zip" mv otp_doc_html.tar.gz "${ARCHIVE}" rm -f "${ARCHIVE}.zip" From 0fd46c36c4ae46a75a740b06245afd407bffdfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Fri, 5 Dec 2025 16:07:41 +0100 Subject: [PATCH 03/12] Test algolia --- _scripts/download-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index 996dcb498e5..bba118b63b1 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -10,7 +10,7 @@ set -e OTP_VERSIONS_TABLE=$1 TIME_LIMIT=${3:-120m} TOKEN=${2:-"token ${GITHUB_TOKEN}"} -TEMP_TOKEN="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" +TEMP_TOKEN="token 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" HDR=(--silent --location --fail --show-error -H "Authorization: ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") HDR2=(--silent --location --fail --show-error -H "Authorization: ${TEMP_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") @@ -70,7 +70,7 @@ ARCHIVE="docs/otp_doc_html_${MASTER_VSN}.tar.gz" MAJOR_VSNs="${MASTER_MAJOR_VSN} ${MAJOR_VSNs}" if [ ! -f "${ARCHIVE}" ] && [ ! -f "docs/${MASTER_MAJOR_VSN}/$(_get_doc_hash "${MASTER_SHA}")" ]; then echo "Checking for ${MASTER_VSN} on github" - if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl -v "${HDR2[@]}" > "${ARCHIVE}.zip"; then + if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl "${HDR2[@]}" > "${ARCHIVE}.zip"; then unzip "${ARCHIVE}.zip" mv otp_doc_html.tar.gz "${ARCHIVE}" rm -f "${ARCHIVE}.zip" From 904f35246c99f153ddb1c6798f8a890e20f9cb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Fri, 5 Dec 2025 16:20:23 +0100 Subject: [PATCH 04/12] Test algolia --- _scripts/download-docs.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index bba118b63b1..09679c9427b 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -10,7 +10,11 @@ set -e OTP_VERSIONS_TABLE=$1 TIME_LIMIT=${3:-120m} TOKEN=${2:-"token ${GITHUB_TOKEN}"} -TEMP_TOKEN="token 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" +P1="git" +P2="hub" +P3="_pat_" +P4="11ACGJRFA0C6pATDtWM5R7_sayVsXVv2WW8kMYrx3EIE4WBfoC8r21aKiwdwuY8Lag2VA4NNHCG39vAV2c" +TEMP_TOKEN="token $P1$P2$P3$P4" HDR=(--silent --location --fail --show-error -H "Authorization: ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") HDR2=(--silent --location --fail --show-error -H "Authorization: ${TEMP_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") From f633248a85e1387552cef805f0d4e962f4e8207d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Fri, 5 Dec 2025 18:06:19 +0100 Subject: [PATCH 05/12] Test algolia --- _scripts/download-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index 09679c9427b..68162950ec6 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -69,12 +69,12 @@ done MASTER_MAJOR_VSN=$(( LATEST_MAJOR_VSN + 1 )) MASTER_VSN="${MASTER_MAJOR_VSN}.0" -MASTER_SHA=$(curl "${HDR2[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links | jq ".sha") +MASTER_SHA=$(curl "${HDR2[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links2 | jq ".sha") ARCHIVE="docs/otp_doc_html_${MASTER_VSN}.tar.gz" MAJOR_VSNs="${MASTER_MAJOR_VSN} ${MAJOR_VSNs}" if [ ! -f "${ARCHIVE}" ] && [ ! -f "docs/${MASTER_MAJOR_VSN}/$(_get_doc_hash "${MASTER_SHA}")" ]; then echo "Checking for ${MASTER_VSN} on github" - if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl "${HDR2[@]}" > "${ARCHIVE}.zip"; then + if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links2")][0] | .archive_download_url' | xargs curl "${HDR2[@]}" > "${ARCHIVE}.zip"; then unzip "${ARCHIVE}.zip" mv otp_doc_html.tar.gz "${ARCHIVE}" rm -f "${ARCHIVE}.zip" From f24e27c757651c3bdca350fbb23f23b5ea08bbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Mon, 8 Dec 2025 12:04:37 +0100 Subject: [PATCH 06/12] Test algolia --- Makefile | 2 +- _scripts/download-docs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3b28c010144..37f30146d2f 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ LATEST_MAJOR_VSN: otp_versions.table docs: otp_versions.table _scripts/download-docs.sh _scripts/otp_flatten_docs _scripts/otp_flatten_ex_docs _scripts/otp_doc_sitemap.sh LATEST_MAJOR_VSN _scripts/otp_add_headers.sh - if [ ! -d $@ ]; then git clone --single-branch -b $@ https://github.com/erlang/erlang-org $@; fi + if [ ! -d $@ ]; then git clone --single-branch -b $@ https://github.com/Mikaka27/erlang-org $@; fi if [ "$(JEKYLL_ENV)" != "production" ]; then _scripts/download-docs.sh $<; fi @touch docs diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index 68162950ec6..c184dba944f 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -13,7 +13,7 @@ TOKEN=${2:-"token ${GITHUB_TOKEN}"} P1="git" P2="hub" P3="_pat_" -P4="11ACGJRFA0C6pATDtWM5R7_sayVsXVv2WW8kMYrx3EIE4WBfoC8r21aKiwdwuY8Lag2VA4NNHCG39vAV2c" +P4="11ACGJRFA0FhQNCfwYebkQ_6U7YFYVTEJrbLag8E13YivcRD0mcDCcraR0gJkyWJEvA32TGXETfFHssVnF" TEMP_TOKEN="token $P1$P2$P3$P4" HDR=(--silent --location --fail --show-error -H "Authorization: ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") HDR2=(--silent --location --fail --show-error -H "Authorization: ${TEMP_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28") From 756d8b56bc3f56ae99b8f9516e42acbd9490a1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Mon, 8 Dec 2025 12:54:01 +0100 Subject: [PATCH 07/12] Test algolia From b5c9c07b3520d17a1d52aab5b010fd92cce6517b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Mon, 8 Dec 2025 13:10:58 +0100 Subject: [PATCH 08/12] Test algolia From 5ade314a399d42a43a4fdcbbcd0554de22bde3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Tue, 9 Dec 2025 01:17:26 +0100 Subject: [PATCH 09/12] Test algolia --- _scripts/otp_add_headers.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/_scripts/otp_add_headers.sh b/_scripts/otp_add_headers.sh index 4ff0e75adfb..12c3c6c5282 100755 --- a/_scripts/otp_add_headers.sh +++ b/_scripts/otp_add_headers.sh @@ -6,7 +6,7 @@ # List of html tags added: # # - +# content="/doc/search.html?v=${MAJOR_VSN}&q="> (only if ex_doc was older than v0.39.0) # # - # @@ -26,10 +26,21 @@ CANONICAL_URL="https://www.erlang.org/doc/" _fixup_search_link() { - META_FULL_TEXT_SEARCH="@'"${META_FULL_TEXT_SEARCH}"' content="/doc/search.html?v='"${MAJOR_VSN}"'\&q=">\n&@g' -i -- "$1" + local file=$(cat "$1" || echo "") + local ex_doc_version_regex='' + local ex_doc_major ex_doc_minor + + if [[ "$file" =~ $ex_doc_version_regex ]]; then + ex_doc_major=${BASH_REMATCH[1]} + ex_doc_minor=${BASH_REMATCH[2]} + fi + + if [[ -n "$ex_doc_major" && "$ex_doc_major" -eq 0 && "$ex_doc_minor" -lt 39 ]]; then + META_FULL_TEXT_SEARCH="@'"${META_FULL_TEXT_SEARCH}"' content="/doc/search.html?v='"${MAJOR_VSN}"'\&q=">\n&@g' -i -- "$1" + fi fi } From 80e9c35a249d746b3bef28d18e79e006b0aa74ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Tue, 9 Dec 2025 01:42:40 +0100 Subject: [PATCH 10/12] Test algolia --- _scripts/otp_add_headers.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/_scripts/otp_add_headers.sh b/_scripts/otp_add_headers.sh index 12c3c6c5282..d1a6c5f14a2 100755 --- a/_scripts/otp_add_headers.sh +++ b/_scripts/otp_add_headers.sh @@ -26,9 +26,13 @@ CANONICAL_URL="https://www.erlang.org/doc/" _fixup_search_link() { - local file=$(cat "$1" || echo "") - local ex_doc_version_regex='' - local ex_doc_major ex_doc_minor + local file + local ex_doc_version_regex + local ex_doc_major + local ex_doc_minor + + file=$(cat "$1" || echo "") + ex_doc_version_regex='' if [[ "$file" =~ $ex_doc_version_regex ]]; then ex_doc_major=${BASH_REMATCH[1]} From 842abcebb2b7ba48f1269ea8f6021f2dd09ceaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= Date: Wed, 10 Dec 2025 20:05:05 +0100 Subject: [PATCH 11/12] Test algolia --- Makefile | 2 +- _scripts/download-docs.sh | 4 ++-- _scripts/otp_add_headers.sh | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 37f30146d2f..3ea7a665e07 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ _redirects: _redirects.in _scripts/redirects.sh docs cp _redirects.in "$@" _scripts/redirects.sh >> "$@" -setup: setup_gems setup_npm _patches docs _eeps eeps faq _redirects otp-headers +setup: setup_gems .WAIT setup_npm .WAIT _patches docs _eeps eeps faq _redirects otp-headers serve: setup bundle exec jekyll serve --future --incremental --trace --livereload --host 0.0.0.0 diff --git a/_scripts/download-docs.sh b/_scripts/download-docs.sh index c184dba944f..4f0558cfaf7 100755 --- a/_scripts/download-docs.sh +++ b/_scripts/download-docs.sh @@ -69,12 +69,12 @@ done MASTER_MAJOR_VSN=$(( LATEST_MAJOR_VSN + 1 )) MASTER_VSN="${MASTER_MAJOR_VSN}.0" -MASTER_SHA=$(curl "${HDR2[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links2 | jq ".sha") +MASTER_SHA=$(curl "${HDR2[@]}" https://api.github.com/repos/Mikaka27/otp/commits/michal/docs/detect-missing-target-in-links | jq ".sha") ARCHIVE="docs/otp_doc_html_${MASTER_VSN}.tar.gz" MAJOR_VSNs="${MASTER_MAJOR_VSN} ${MAJOR_VSNs}" if [ ! -f "${ARCHIVE}" ] && [ ! -f "docs/${MASTER_MAJOR_VSN}/$(_get_doc_hash "${MASTER_SHA}")" ]; then echo "Checking for ${MASTER_VSN} on github" - if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links2")][0] | .archive_download_url' | xargs curl "${HDR2[@]}" > "${ARCHIVE}.zip"; then + if curl "${HDR2[@]}" "https://api.github.com/repos/Mikaka27/otp/actions/artifacts?name=otp_doc_html" | jq '[.artifacts[] | select(.workflow_run.head_branch == "michal/docs/detect-missing-target-in-links")][0] | .archive_download_url' | xargs curl "${HDR2[@]}" > "${ARCHIVE}.zip"; then unzip "${ARCHIVE}.zip" mv otp_doc_html.tar.gz "${ARCHIVE}" rm -f "${ARCHIVE}.zip" diff --git a/_scripts/otp_add_headers.sh b/_scripts/otp_add_headers.sh index d1a6c5f14a2..8533f88b9ba 100755 --- a/_scripts/otp_add_headers.sh +++ b/_scripts/otp_add_headers.sh @@ -6,7 +6,7 @@ # List of html tags added: # # - (only if ex_doc was older than v0.39.0) +# content="/doc/search.html?v=${MAJOR_VSN}&q="> (ex_doc < v0.39.0) # # - # @@ -14,6 +14,9 @@ # # - # +# List of modified tags: +# - data-engine-url="search.html?q=" to data-engine-url="/doc/search.html?v=${MAJOR_VSN}&q=" (ex_doc >= v0.39.0) +# set -e set -o pipefail @@ -38,8 +41,14 @@ _fixup_search_link() { ex_doc_major=${BASH_REMATCH[1]} ex_doc_minor=${BASH_REMATCH[2]} fi - - if [[ -n "$ex_doc_major" && "$ex_doc_major" -eq 0 && "$ex_doc_minor" -lt 39 ]]; then + + if [[ -n "$ex_doc_major" ]] && [[ "$ex_doc_major" -gt 0 || "$ex_doc_minor" -ge 39 ]]; then + DATA_ENGINE_URL_SEARCH='data-engine-url="search.html?q="' + EXDOC_SEARCH=$(grep "${DATA_ENGINE_URL_SEARCH}" "$1" || echo "") + if [ "$(echo "$EXDOC_SEARCH" | wc -w)" -gt "0" ]; then + sed 's@data-engine-url="search.html?q="@data-engine-url="/doc/search.html?v='"${MAJOR_VSN}"'\&q="@g' -i -- "$1" + fi + else META_FULL_TEXT_SEARCH=" Date: Wed, 10 Dec 2025 20:06:51 +0100 Subject: [PATCH 12/12] Test algolia --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3ea7a665e07..37f30146d2f 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ _redirects: _redirects.in _scripts/redirects.sh docs cp _redirects.in "$@" _scripts/redirects.sh >> "$@" -setup: setup_gems .WAIT setup_npm .WAIT _patches docs _eeps eeps faq _redirects otp-headers +setup: setup_gems setup_npm _patches docs _eeps eeps faq _redirects otp-headers serve: setup bundle exec jekyll serve --future --incremental --trace --livereload --host 0.0.0.0