Skip to content

Commit

Permalink
[DOCS] changes for port to 24.4 (#27570)
Browse files Browse the repository at this point in the history
Port for hierarchical field to 24.4
#27569
  • Loading branch information
akopytko authored Nov 15, 2024
1 parent 19080c1 commit 86e6512
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,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("-", " ")
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)
3 changes: 2 additions & 1 deletion docs/sphinx_setup/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
ov_sitemap_meta = [
('coveo:metadata', {
'ovversion': version_name,
'ovdoctype': 'null'
'ovdoctype': 'null',
'ovcategory': 'null'
})
]

Expand Down

0 comments on commit 86e6512

Please sign in to comment.