Add filter to json builds to prevent search indexing on hidden documents #56

Merged
tischrei merged 1 commits from fix-json into main 2025-09-09 12:12:31 +00:00
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