Skip to content

refactor(search): derive result labels from products.yml - #7571

Open
jstirnaman wants to merge 3 commits into
masterfrom
refactor-search-labels-from-products
Open

refactor(search): derive result labels from products.yml#7571
jstirnaman wants to merge 3 commits into
masterfrom
refactor-search-labels-from-products

Conversation

@jstirnaman

Copy link
Copy Markdown
Contributor

Stacked on #7569. Review that one first; this PR's base is
fix-search-version-label.

What changed

Search result labels now come from data/products.yml instead of two
hardcoded maps in assets/js/components/doc-search.js.

  • Added assets/js/utils/product-labels.js. It maps a URL path to a
    product by matching whole content_path segments, longest path first,
    and returns that product's name.
  • doc-search.js imports products from
    assets/js/services/influxdata-products.js and deletes both display-name
    maps, including the product-scoped override added in fix(search): label /influxdb3/cloud hits as Cloud, not Cloud (TSM) #7569.
  • Added content_path to telegraf_controller and telegraf_enterprise
    in products.yml. Both publish content and both are in the search index.
  • Replaced the fix(search): label /influxdb3/cloud hits as Cloud, not Cloud (TSM) #7569 unit test with
    assets/js/__tests__/product-labels.test.mjs, which runs against the real
    products.yml.

Second commit, required by the products.yml change: feedback.html
resolves /telegraf/controller/ and /telegraf/enterprise/ to their own
product entries.

Why

The URL path segment is not the product name. Concatenating
productDisplayNames[segment0] and versionDisplayNames[segment1] produced
three wrong labels:

Path Rendered products.yml name
/influxdb3/cloud-dedicated/ InfluxDB 3 Cloud Dedicated InfluxDB Cloud Dedicated
/influxdb3/cloud-serverless/ InfluxDB 3 Cloud Serverless InfluxDB Cloud Serverless
/influxdb3/clustered/ InfluxDB 3 Clustered InfluxDB Clustered

namespace in products.yml records this: those three products have
namespace: influxdb, not influxdb3, even though they live under
/influxdb3/. The maps had no way to express that.

Hugo already passes products.yml into the browser bundle as a js.Build
param (layouts/partials/header/javascript.html:56), so the data was
available the whole time.

Impact

Three products lose the "3" in search result labels, matching their
official names. All other labels are unchanged, including
/influxdb/cloud/ -> "InfluxDB Cloud (TSM)" and /influxdb3/cloud/ ->
"InfluxDB 3 Cloud".

/telegraf/controller/ and /telegraf/enterprise/ no longer render a
"Submit Telegraf issue" button, and their feedback text now names the
product they document rather than "Telegraf". Both are licensed products,
so they now behave like every other licensed product: docs issue button
only, support contract link for the product. Flagging this explicitly since
it removes a button. If Telegraf Controller and Telegraf Enterprise are
meant to accept public issues on influxdata/telegraf, the fix instead is
a product_issue_url on both entries, and I will swap it.

Search tags and the Algolia index are untouched. See below.

Verification

node --test 'assets/js/__tests__/*.test.mjs'
# tests 13  # pass 13  # fail 0

node cypress/support/run-e2e-specs.js --spec "cypress/e2e/content/article-feedback.cy.js" --no-mapping
# 16 passing, 0 failing

node .ci/scripts/check-feedback-links.js
# check-feedback-links: all checks passed

npx hugo --quiet   # exit 0
yarn eslint assets/js/components/doc-search.js assets/js/utils/product-labels.js   # 0 problems

Rendered output, from public/ after a full build:

/telegraf/controller/  Submit docs issue                      (was: + Submit Telegraf issue)
/telegraf/enterprise/  Submit docs issue                      (was: + Submit Telegraf issue)
/telegraf/v1/          Submit docs issue, Submit Telegraf issue   (unchanged)
/influxdb3/cloud/      Submit docs issue                      (unchanged)

The unit tests load the real data/products.yml, so they also fail if a
content_path is dropped or a product is renamed.

Not done, and why

The plan included switching search.html and search-attributes.html off
findRE path parsing and onto the product cascade param. The data says
not to. docsearch:searchTag is an index key, and 53,135 records are
already crawled under path-derived tags. content_path does not reproduce
them for five products:

Product content_path Indexed searchTag
telegraf telegraf telegraf-v1
chronograf chronograf chronograf-v1
kapacitor kapacitor kapacitor-v1
flux flux flux-v0
enterprise_influxdb enterprise_influxdb enterprise_influxdb-v1

content_path points at the product root; the tag includes the version
segment. Switching the tag source would orphan those five products from
their indexed records. The tag stays path-derived. Only the display names
move to products.yml.

Follow-up

Four places derive product identity from the URL path, and each handles
/influxdb3/cloud/ differently:

  • assets/js/utils/product-mappings.ts:101URL_PATTERN_MAP has no
    /influxdb3/cloud/, so getProductKeyFromPath() returns null. It also
    matches /telegraf/ before /telegraf/controller/.
  • assets/js/page-context.ts:29 — no /influxdb3/cloud/ pattern, so
    getCurrentProductData() returns { product: 'other' }. That feeds
    analytics context and ask-ai.
  • layouts/partials/article/feedback.html:17 — special-case ladder, which
    this PR adds a fourth branch to.
  • layouts/partials/footer/search.html:1 and
    header/search-attributes.html:1findRE, which must stay for the
    reason above.

Every page already declares its product via cascade
(content/*/*/_index.md), and layouts/partials/product/get-data.html
resolves it. Worth a separate pass.

@jstirnaman
jstirnaman requested a review from a team as a code owner July 27, 2026 19:43
@jstirnaman
jstirnaman requested review from sanderson and removed request for a team July 27, 2026 19:43
@github-actions

Copy link
Copy Markdown
Contributor

Release version check

No release-notes pages with a tracked version changed in this PR.

💡 Badge new features with the version

Documenting a new feature? Add a version badge in the page frontmatter — the
same mechanism used elsewhere in the docs:

  • metadata: [InfluxDB 3 Core v3.11+] — badge list under the page title
  • updated_in: v3.11 — an "Updated in v3.11" badge
  • introduced: v3.11 — a "‹Product› v3.11+" badge
  • menu.params.state: new — a "NEW" pill on the sidebar nav item

For inline version text, use {{< latest-patch >}} / {{< current-version >}},
which read the value from data/products.yml so it stays correct automatically.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🔗 Link Check Results — Link Check Bot

All links are valid

Metric Value
Files Checked 8
Total Links 3056
Errors 0
Warnings 14
Success Rate 99.18194%
⚠️ 14 warning(s) (do not fail CI)
Source File URL Issue
content/enterprise_influxdb/v1/introduction/installation/single-server/_index.md https://support.influxdata.com/ Network error: SSL certificate not trusted. Use --insecure if site is trusted (e…
content/influxdb/v1/introduction/install/_index.md https://support.influxdata.com/ Error (cached): Error (cached)
content/influxdb/v1/introduction/install/_index.md https://reddit.com/r/influxdb Error (cached)
content/influxdb/v2/install/_index.md https://support.influxdata.com/ Network error: SSL certificate not trusted. Use --insecure if site is trusted (e…
content/influxdb/v2/install/_index.md https://reddit.com/r/influxdb Error (cached)
content/influxdb/v2/install/_index.md https://docs.docker.com/engine/reference/run/#detached-vs-foreground Cannot find fragment: Cannot find fragment
content/influxdb3/core/install/_index.md https://support.influxdata.com/ Network error: SSL certificate not trusted. Use --insecure if site is trusted (e…
content/influxdb3/enterprise/install/_index.md https://support.influxdata.com/ Error (cached): Error (cached)
content/influxdb3/enterprise/install/_index.md https://reddit.com/r/influxdb Error (cached)
content/influxdb3/explorer/install/_index.md https://reddit.com/r/influxdb Error (cached)
content/influxdb3/explorer/install/_index.md https://support.influxdata.com/ Network error: SSL certificate not trusted. Use --insecure if site is trusted (e…
content/telegraf/v1/install/_index.md https://support.influxdata.com/ Error (cached): Error (cached)
content/telegraf/v1/install/_index.md https://reddit.com/r/influxdb Error (cached)
content/telegraf/v1/install/_index.md https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell… Cannot find fragment: Cannot find fragment

Full details: workflow run summary and artifact. Last updated: 2026-07-28 19:25:59 UTC

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📦 PR Preview — Preview Bot

Status Details
Result ✅ DEPLOYED (full site)
Preview View preview
Build time 84s
Last updated 2026-07-28 19:28:05 UTC

Preview auto-deploys on push. Will be cleaned up when PR closes.

Base automatically changed from fix-search-version-label to master July 27, 2026 21:40
feedback.html derives the product key from the URL path, with special
cases for InfluxDB 3 and Cloud (TSM). /telegraf/controller/ and
/telegraf/enterprise/ hit no special case, so both resolved to the
`telegraf` entry and rendered its name and its public issue-tracker
button.

Telegraf Controller and Telegraf Enterprise are licensed products. Like
every other licensed product, they should point customers to support
rather than a public tracker. Resolve them to their own products.yml
entries, which declare no product_issue_url, so the button does not
render.

The pages now also name the product they document in the feedback text.
Add both URLs to the licensed list in article-feedback.cy.js, along with
/influxdb3/cloud/, which was missing from it.
Search result labels were built by concatenating the product and version
URL segments through two hardcoded maps. The URL segment is not the
product name: /influxdb3/cloud-dedicated/, /influxdb3/cloud-serverless/,
and /influxdb3/clustered/ rendered as "InfluxDB 3 Cloud Dedicated",
"InfluxDB 3 Cloud Serverless", and "InfluxDB 3 Clustered". Their names
are "InfluxDB Cloud Dedicated", "InfluxDB Cloud Serverless", and
"InfluxDB Clustered".

Hugo already passes data/products.yml into the browser bundle as a
js.Build param, so take the names from there. Add
utils/product-labels.js, which maps a URL path to a product by matching
whole content_path segments, longest path first. Whole-segment matching
keeps /influxdb3/cloud/ from matching /influxdb3/cloud-dedicated/, and
longest-first keeps /telegraf/ from matching /telegraf/controller/.

Add the missing content_path for telegraf_controller and
telegraf_enterprise. Both publish content and both are in the search
index. getProductLabelMap() in .github/scripts/workflow-utils.js also
reads content_path but requires label_group, which neither product has,
so GitHub labeling is unchanged.

Replaces the product-scoped override map added for /influxdb3/cloud/,
which products.yml now covers.
@jstirnaman
jstirnaman force-pushed the refactor-search-labels-from-products branch from 0500a53 to 1dd0903 Compare July 28, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants