Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[DOCS Added new hierarchical field for Coveo (#27569)

Andrzej Kopytko250f0015716b
diff --git a/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py b/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py
index c82e0a8d599..ca93d02d75c 100644
--- a/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py
+++ b/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py
@@ -120,15 +120,24 @@ def process_coveo_meta(meta, url, link):
for namespace, values in meta:
namespace_element = ET.SubElement(url, namespace)
+ loc_element = url.find("loc")
for tag_name, tag_value in values.items():
if tag_name == 'ovdoctype':
- processed_link = process_link(link)
- ET.SubElement(namespace_element, tag_name).text = processed_link
- else:
+ ET.SubElement(namespace_element, tag_name).text = process_link(link)
+ elif tag_name == 'ovcategory' and loc_element is not None:
+ ET.SubElement(namespace_element, tag_name).text = extract_link(loc_element.text)
+ elif tag_name == 'ovversion':
ET.SubElement(namespace_element, tag_name).text = tag_value
def process_link(link):
if '/' in link:
return link.split('/')[0].replace("-", " ")
- return link.split('.html')[0].replace("-", " ")
\ No newline at end of file
+ return link.split('.html')[0].replace("-", " ")
+
+def extract_link(link):
+ path = link.split("://")[-1]
+ segments = path.split('/')[1:]
+ if segments and segments[-1].endswith('.html'):
+ segments = segments[:-1]
+ return '|'.join(segments)
\ No newline at end of file
diff --git a/docs/sphinx_setup/conf.py b/docs/sphinx_setup/conf.py
index 01c74de0175..8bf8438fb5e 100644
--- a/docs/sphinx_setup/conf.py
+++ b/docs/sphinx_setup/conf.py
@@ -84,7 +84,8 @@ ov_sitemap_urlset = [
ov_sitemap_meta = [
('coveo:metadata', {
'ovversion': version_name,
- 'ovdoctype': 'null'
+ 'ovdoctype': 'null',
+ 'ovcategory': 'null'
})
]