Add filter to json builds to prevent search indexing on hidden documents
All checks were successful
Run Tox Check / tox-py312 (pull_request) Successful in 15s
Run Tox Check / tox-pep8 (pull_request) Successful in 15s
Updates Opensearch filters / update-opensearch-filters (pull_request) Successful in 10s

This commit is contained in:
2025-09-09 12:11:27 +00:00
parent bd563ca9eb
commit 1f2c565de1
2 changed files with 10 additions and 0 deletions

View File

@ -41,7 +41,11 @@ commands =
sphinx-minify --input-directory doc/build/html_temp/ --output-directory doc/build/html
{%- for doc in docs %}
{[testenv:{{ doc.type }}]commands}
{#- To avoid hidden documents to be searchable -#}
{%- if (target_environment == 'internal' and doc.visibility != 'hidden')
or (target_environment == 'public' and doc.visibility == 'public') %}
{[testenv:json-{{ doc.type }}]commands}
{%- endif %}
{%- endfor %}
{% if docs|length > 0 %}
@ -90,6 +94,10 @@ commands =
cp -av doc/build/html/{{ doc.type }} {{ doc.type }}/build/html
{%- endif %}
{#- To avoid hidden documents to be searchable -#}
{%- if (target_environment == 'internal' and doc.visibility != 'hidden')
or (target_environment == 'public' and doc.visibility == 'public') %}
# Json version (for search)
[testenv:json-{{ doc.type }}]
deps = {[testenv:docs]deps}
@ -109,6 +117,7 @@ commands =
mkdir -p {{ doc.type }}/build/json
cp -av doc/build/json/{{ doc.type }} {{ doc.type }}/build/json
{%- endif %}
{%- endif %}
# PDF version
[testenv:{{ doc.type }}-pdf-docs]

View File

@ -316,6 +316,7 @@ def process_repositories(args, service):
if doc["type"] == "dev":
doc["type"] = "dev-guide"
doc["pdf_enabled"] = cloud_environment["pdf_enabled"]
doc["visibility"] = cloud_environment["visibility"]
context["docs"].append(doc)
context["target_environment"] = args.target_environment